# Clear out all vpaths, then set just one (default vpath) for the main build # directory. vpath vpath % . # Clear the default suffixes, so that built-in rules are not used. .SUFFIXES : SHELL := /bin/sh CC := @CC@ # Configuration parameters. BINDIR := @BINDIR@ INCLUDEDIR := @INCLUDEDIR@ LIBDIR := @LIBDIR@ MANDIR := @MANDIR@ # Build parameters. CPPFLAGS := @CPPFLAGS@ -I@srcroot@src -I@objroot@src CFLAGS := @CFLAGS@ -fPIC -DPIC ifeq (macho, @abi@) CFLAGS += -dynamic endif LDFLAGS := @LDFLAGS@ LIBS := @LIBS@ GDLIBS := @GDLIBS@ RPATH_EXTRA := @RPATH_EXTRA@ ifeq (macho, @abi@) SO := dylib else SO := so endif REV := 0 # Lists of files. BINS := @bins@ CHDRS := @objroot@src/jemalloc@install_suffix@.h \ @objroot@src/jemalloc_defs@install_suffix@.h CSRCS := @srcroot@src/jemalloc.c @srcroot@src/jemalloc_arena.c \ @srcroot@src/jemalloc_base.c @srcroot@src/jemalloc_chunk.c \ @srcroot@src/jemalloc_chunk_dss.c @srcroot@src/jemalloc_chunk_mmap.c \ @srcroot@src/jemalloc_chunk_swap.c @srcroot@src/ckh.c \ @srcroot@src/jemalloc_ctl.c @srcroot@src/jemalloc_extent.c \ @srcroot@src/hash.c @srcroot@src/jemalloc_huge.c @srcroot@src/mb.c \ @srcroot@src/jemalloc_mutex.c @srcroot@src/prof.c \ @srcroot@src/jemalloc_stats.c @srcroot@src/jemalloc_tcache.c \ @srcroot@src/jemalloc_trace.c DSOS := @objroot@lib/libjemalloc@install_suffix@.so.$(REV) \ @objroot@lib/libjemalloc@install_suffix@.so \ @objroot@lib/libjemalloc@install_suffix@_pic.a MAN3 := @objroot@doc/jemalloc@install_suffix@.3 .PHONY: all dist install check clean distclean relclean # Default target. all: $(DSOS) bins # # Include generated dependency files. # -include $(CSRCS:@srcroot@%.c=@objroot@%.d) @objroot@src/%.o: @srcroot@src/%.c $(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $< @$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) $< | sed \"s/\($(subst /,\/,$(notdir $(basename $@)))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.o \2/g\" > $(@:%.o=%.d)" $(DSOS): $(CSRCS:@srcroot@%.c=@objroot@%.o) @mkdir -p $(@D) $(CC) -shared -o $@ $+ $(LDFLAGS) $(LIBS) ln -sf libjemalloc@install_suffix@.so.$(REV) lib/libjemalloc@install_suffix@.so ar crus @objroot@lib/libjemalloc@install_suffix@_pic.a $+ bins: $(BINS) @objroot@bin/mtrgraph@install_suffix@: @objroot@src/mtrgraph.o @mkdir -p $(@D) $(CC) -o $@ $< $(LDFLAGS) $(LIBS) $(GDLIBS) @objroot@bin/%@install_suffix@: @objroot@src/%.o @mkdir -p $(@D) $(CC) -o $@ $< $(LDFLAGS) $(LIBS) install: install -d $(BINDIR) @for b in $(BINS); do \ echo "install -m 755 $$b $(BINDIR)"; \ install -m 755 $$b $(BINDIR); \ done install -d $(INCLUDEDIR) @for h in $(CHDRS); do \ echo "install -m 644 $$h $(INCLUDEDIR)"; \ install -m 644 $$h $(INCLUDEDIR); \ done install -d $(LIBDIR) install -m 755 @objroot@lib/libjemalloc@install_suffix@.so.$(REV) $(LIBDIR) ln -sf libjemalloc@install_suffix@.so.$(REV) $(LIBDIR)/libjemalloc@install_suffix@.so install -m 755 @objroot@lib/libjemalloc@install_suffix@_pic.a $(LIBDIR) install -d $(MANDIR)/man3 @for m in $(MAN3); do \ echo "install -m 644 $$m $(MANDIR)/man3"; \ install -m 644 $$m $(MANDIR)/man3; \ done check: clean: rm -f $(BINS) rm -f $(BINS:@objroot@bin/%=@objroot@src/%.o) rm -f $(BINS:@objroot@bin/%=@objroot@src/%.d) rm -f $(CSRCS:@srcroot@%.c=@objroot@%.o) rm -f $(CSRCS:@srcroot@%.c=@objroot@%.d) rm -f $(DSOS) distclean: clean rm -f @objroot@config.log rm -f @objroot@config.status rm -f @objroot@cfghdrs.stamp rm -f @objroot@cfgoutputs.stamp rm -f @cfghdrs_out@ rm -f @cfgoutputs_out@ relclean: distclean rm -rf @objroot@autom4te.cache rm -f @objroot@configure #=============================================================================== # Re-configuration rules. ifeq (@enable_autogen@, 1) @srcroot@configure : @srcroot@configure.ac cd ./@srcroot@ && @AUTOCONF@ @objroot@config.status : @srcroot@configure ./@objroot@config.status --recheck # cfghdrs rules. @srcroot@cfghdrs.stamp.in : @srcroot@configure.ac echo stamp > @srcroot@cfghdrs.stamp.in @objroot@cfghdrs.stamp : @cfghdrs_in@ @srcroot@configure ./@objroot@config.status @touch $@ @cfghdrs@ : @objroot@cfghdrs.stamp # cfgoutputs rules. @srcroot@cfgoutputs.stamp.in : @srcroot@configure.ac echo stamp > @srcroot@cfgoutputs.stamp.in @objroot@cfgoutputs.stamp : @cfgoutputs_in@ @srcroot@configure ./@objroot@config.status @touch $@ # There must be some action in order for make to re-read Makefile when it is # out of date. @cfgoutputs@ : @objroot@cfgoutputs.stamp @true endif