Fix documented parameters to execle.
[glibc.git] / malloc / Makefile
blob17421062f3146bafb88cf1974809b223120daa1a
1 # Copyright (C) 1991-1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2011
2 # Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <http://www.gnu.org/licenses/>.
20 # Makefile for malloc routines
22 subdir := malloc
24 all:
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 tst-mcheck tst-mallocfork tst-trim1
30 test-srcs = tst-mtrace
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
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
41 install-lib := libmcheck.a
42 non-lib.a := libmcheck.a
44 # Additional library.
45 extra-libs = libmemusage
46 extra-libs-others = $(extra-libs)
48 libmemusage-routines = memusage
49 libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
51 # These should be removed by `make clean'.
52 extra-objs = mcheck-init.o libmcheck.a
54 # Include the cleanup handler.
55 aux := set-freeres thread-freeres
57 include ../Makeconfig
59 CPPFLAGS-memusagestat = -DNOT_IN_libc
61 # The Perl script to analyze the output of the mtrace functions.
62 ifneq ($(PERL),no)
63 install-bin-script = mtrace
64 generated = mtrace
66 # The Perl script will print addresses and to do this nicely we must know
67 # whether we are on a 32 or 64 bit machine.
68 ifneq ($(findstring wordsize-32,$(config-sysdirs)),)
69 address-width=10
70 else
71 address-width=18
72 endif
73 endif
75 # Unless we get a test for the availability of libgd which also works
76 # for cross-compiling we disable the memusagestat generation in this
77 # situation.
78 ifneq ($(cross-compiling),yes)
79 # If the gd library is available we build the `memusagestat' program.
80 ifneq ($(LIBGD),no)
81 others: $(objpfx)memusage
82 install-bin = memusagestat
83 install-bin-script += memusage
84 generated += memusagestat memusage
85 extra-objs += memusagestat.o
87 # The configure.in check for libgd and its headers did not use $SYSINCLUDES.
88 # The directory specified by --with-headers usually contains only the basic
89 # kernel interface headers, not something like libgd. So the simplest thing
90 # is to presume that the standard system headers will be ok for this file.
91 $(objpfx)memusagestat.o: sysincludes = # nothing
92 endif
93 endif
95 # Another goal which can be used to override the configure decision.
96 .PHONY: do-memusagestat
97 do-memusagestat: $(objpfx)memusagestat
99 memusagestat-modules = memusagestat
100 $(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o)
101 $(LINK.o) -o $@ $^ $(libgd-LDFLAGS) -lgd -lpng -lz -lm
103 include ../Rules
105 CFLAGS-mcheck-init.c = $(PIC-ccflag)
106 CFLAGS-obstack.c = $(uses-callbacks)
108 $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
109 -rm -f $@
110 $(patsubst %/,cd % &&,$(objpfx)) \
111 $(LN_S) $(<F) $(@F)
113 lib: $(objpfx)libmcheck.a
115 ifeq (no,$(cross-compiling))
116 ifeq (yes,$(build-shared))
117 ifneq ($(PERL),no)
118 tests: $(objpfx)tst-mtrace.out
119 $(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
120 $(SHELL) -e $< $(common-objpfx)
121 endif
122 endif
123 endif
125 tst-mcheck-ENV = MALLOC_CHECK_=3
127 CPPFLAGS-malloc.c += -DPER_THREAD
128 # Uncomment this for test releases. For public releases it is too expensive.
129 #CPPFLAGS-malloc.o += -DMALLOC_DEBUG=1
131 sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
133 $(objpfx)mtrace: mtrace.pl
134 rm -f $@.new
135 sed -e 's|@PERL@|$(PERL)|' -e 's|@XXX@|$(address-width)|' \
136 -e 's|@VERSION@|$(version)|' $^ > $@.new \
137 && rm -f $@ && mv $@.new $@ && chmod +x $@
139 $(objpfx)memusage: memusage.sh
140 rm -f $@.new
141 sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
142 -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' $^ > $@.new \
143 && rm -f $@ && mv $@.new $@ && chmod +x $@
146 # The implementation uses `dlsym'
147 $(objpfx)libmemusage.so: $(common-objpfx)dlfcn/libdl.so $(elfobjdir)/ld.so
149 # Extra dependencies
150 $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c