]> sourceware.org Git - glibc.git/blob - malloc/Makefile
Update.
[glibc.git] / malloc / Makefile
1 # Copyright (C) 1991-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
13
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
18
19 #
20 # Makefile for malloc routines
21 #
22 subdir := malloc
23
24 all:
25
26 dist-headers := malloc.h
27 headers := $(dist-headers) obstack.h mcheck.h
28 tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
29 tst-mallocstate
30 test-srcs = tst-mtrace
31
32 distribute = thread-m.h mtrace.pl mcheck-init.c stackinfo.h memusage.h \
33 memusage.sh memusagestat.c tst-mtrace.sh arena.c hooks.c
34
35 # Things which get pasted together into gmalloc.c.
36 gmalloc-routines := malloc morecore
37 # Things to include in the standalone distribution.
38 dist-routines = $(gmalloc-routines) mcheck mtrace
39 routines = $(dist-routines) obstack
40
41 install-lib := libmcheck.a
42 non-lib.a := libmcheck.a
43
44 # Additional library.
45 extra-libs = libmemusage
46 extra-libs-others = $(extra-libs)
47
48 libmemusage-routines = memusage
49 libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
50
51 # These should be removed by `make clean'.
52 extra-objs = mcheck-init.o libmcheck.a
53
54 # Include the cleanup handler.
55 aux := set-freeres
56
57 include ../Makeconfig
58
59 # The Perl script to analyze the output of the mtrace functions.
60 ifneq ($(PERL),no)
61 install-bin-script = mtrace
62 generated = mtrace
63
64 # The Perl script will print addresses and to do this nicely we must know
65 # whether we are on a 32 or 64 bit machine.
66 ifneq ($(findstring wordsize-32,$(config-sysdirs)),)
67 address-width=10
68 else
69 address-width=18
70 endif
71 endif
72
73 # Unless we get a test for the availability of libgd which also works
74 # for cross-compiling we disable the memusagestat generation in this
75 # situation.
76 ifneq ($(cross-compiling),yes)
77 # If the gd library is available we build the `memusagestat' program.
78 ifneq ($(LIBGD),no)
79 install-bin = memusagestat memusage
80 generated += memusagestat memusage
81 extra-objs += memusagestat.o
82 endif
83 endif
84
85 # Another goal which can be used to override the configure decision.
86 .PHONY: do-memusagestat
87 do-memusagestat: $(objpfx)memusagestat
88
89 memusagestat-modules = memusagestat
90 $(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o)
91 $(LINK.o) -o $@ $^ $(libgd-LDFLAGS) -lgd -lpng -lz -lm
92
93 include ../Rules
94
95 $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
96 -rm -f $@
97 $(patsubst %/,cd % &&,$(objpfx)) \
98 $(LN_S) $(<F) $(@F)
99
100 lib: $(objpfx)libmcheck.a
101
102 ifeq (no,$(cross-compiling))
103 ifeq (yes,$(build-shared))
104 ifneq ($(PERL),no)
105 tests: $(objpfx)tst-mtrace.out
106 $(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
107 $(SHELL) -e $< $(common-objpfx)
108 endif
109 endif
110 endif
111
112 # Uncomment this for test releases. For public releases it is too expensive.
113 #CPPFLAGS-malloc.o += -DMALLOC_DEBUG=1
114
115 $(objpfx)mtrace: mtrace.pl
116 rm -f $@.new
117 sed -e 's|@PERL@|$(PERL)|' -e 's|@XXX@|$(address-width)|' \
118 -e 's|@VERSION@|$(version)|' $^ > $@.new \
119 && rm -f $@ && mv $@.new $@ && chmod +x $@
120
121 $(objpfx)memusage: memusage.sh
122 rm -f $@.new
123 sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
124 -e 's|@SLIBDIR@|$(slibdir)|' -e 's|@BINDIR@|$(bindir)|' $^ > $@.new \
125 && rm -f $@ && mv $@.new $@ && chmod +x $@
126
127
128 # The implementation uses `dlsym'
129 $(objpfx)libmemusage.so: $(common-objpfx)dlfcn/libdl.so
130
131 # Extra dependencies
132 $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c
This page took 0.040991 seconds and 5 git commands to generate.