(linenum→info "unix/slp.c:2238")

glibc/2.7/malloc/Makefile

    1: # Copyright (C) 1991-1999, 2000, 2001, 2002, 2003, 2005, 2006
    2: # Free Software Foundation, Inc.
    3: # This file is part of the GNU C Library.
    4: 
    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.
    9: 
   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.
   14: 
   15: # You should have received a copy of the GNU Lesser General Public
   16: # License along with the GNU C Library; if not, write to the Free
   17: # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   18: # 02111-1307 USA.
   19: 
   20: #
   21: #       Makefile for malloc routines
   22: #
   23: subdir  := malloc
   24: 
   25: all:
   26: 
   27: dist-headers := malloc.h
   28: headers := $(dist-headers) obstack.h mcheck.h
   29: tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
   30:          tst-mallocstate tst-mcheck tst-mallocfork
   31: test-srcs = tst-mtrace
   32: 
   33: distribute = thread-m.h mtrace.pl mcheck-init.c stackinfo.h memusage.h \
   34:              memusage.sh memusagestat.c tst-mtrace.sh arena.c hooks.c
   35: 
   36: # Things which get pasted together into gmalloc.c.
   37: gmalloc-routines := malloc morecore
   38: # Things to include in the standalone distribution.
   39: dist-routines = $(gmalloc-routines) mcheck mtrace
   40: routines = $(dist-routines) obstack
   41: 
   42: install-lib := libmcheck.a
   43: non-lib.a := libmcheck.a
   44: 
   45: # Additional library.
   46: extra-libs = libmemusage
   47: extra-libs-others = $(extra-libs)
   48: 
   49: libmemusage-routines = memusage
   50: libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
   51: 
   52: # These should be removed by `make clean'.
   53: extra-objs = mcheck-init.o libmcheck.a
   54: 
   55: # Include the cleanup handler.
   56: aux := set-freeres thread-freeres
   57: 
   58: include ../Makeconfig
   59: 
   60: CPPFLAGS-memusagestat = -DNOT_IN_libc
   61: 
   62: # The Perl script to analyze the output of the mtrace functions.
   63: ifneq ($(PERL),no)
   64: install-bin-script = mtrace
   65: generated = mtrace
   66: 
   67: # The Perl script will print addresses and to do this nicely we must know
   68: # whether we are on a 32 or 64 bit machine.
   69: ifneq ($(findstring wordsize-32,$(config-sysdirs)),)
   70: address-width=10
   71: else
   72: address-width=18
   73: endif
   74: endif
   75: 
   76: # Unless we get a test for the availability of libgd which also works
   77: # for cross-compiling we disable the memusagestat generation in this
   78: # situation.
   79: ifneq ($(cross-compiling),yes)
   80: # If the gd library is available we build the `memusagestat' program.
   81: ifneq ($(LIBGD),no)
   82: others: $(objpfx)memusage
   83: install-bin = memusagestat
   84: install-bin-script += memusage
   85: generated += memusagestat memusage
   86: extra-objs += memusagestat.o
   87: 
   88: # The configure.in check for libgd and its headers did not use $SYSINCLUDES.
   89: # The directory specified by --with-headers usually contains only the basic
   90: # kernel interface headers, not something like libgd.  So the simplest thing
   91: # is to presume that the standard system headers will be ok for this file.
   92: $(objpfx)memusagestat.o: sysincludes = # nothing
   93: endif
   94: endif
   95: 
   96: # Another goal which can be used to override the configure decision.
   97: .PHONY: do-memusagestat
   98: do-memusagestat: $(objpfx)memusagestat
   99: 
  100: memusagestat-modules = memusagestat
  101: $(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o)
  102:         $(LINK.o) -o $@ $^ $(libgd-LDFLAGS) -lgd -lpng -lz -lm
  103: 
  104: include ../Rules
  105: 
  106: CFLAGS-mcheck-init.c = $(PIC-ccflag)
  107: 
  108: $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
  109:         -rm -f $@
  110:         $(patsubst %/,cd % &&,$(objpfx)) \
  111:         $(LN_S) $(<F) $(@F)
  112: 
  113: lib: $(objpfx)libmcheck.a
  114: 
  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
  124: 
  125: tst-mcheck-ENV = MALLOC_CHECK_=3
  126: 
  127: # Uncomment this for test releases.  For public releases it is too expensive.
  128: #CPPFLAGS-malloc.o += -DMALLOC_DEBUG=1
  129: 
  130: sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
  131: 
  132: $(objpfx)mtrace: mtrace.pl
  133:         rm -f $@.new
  134:         sed -e 's|@PERL@|$(PERL)|' -e 's|@XXX@|$(address-width)|' \
  135:             -e 's|@VERSION@|$(version)|' $^ > $@.new \
  136:         && rm -f $@ && mv $@.new $@ && chmod +x $@
  137: 
  138: $(objpfx)memusage: memusage.sh
  139:         rm -f $@.new
  140:         sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
  141:             -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' $^ > $@.new \
  142:         && rm -f $@ && mv $@.new $@ && chmod +x $@
  143: 
  144: 
  145: # The implementation uses `dlsym'
  146: $(objpfx)libmemusage.so: $(common-objpfx)dlfcn/libdl.so $(elfobjdir)/ld.so
  147: 
  148: # Extra dependencies
  149: $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c
Syntax (Markdown)