2009-06-24 10:01:18 +08:00
|
|
|
# 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.
|
2010-03-04 07:48:20 +08:00
|
|
|
DESTDIR =
|
2010-04-03 04:50:53 +08:00
|
|
|
BINDIR := $(DESTDIR)@BINDIR@
|
2010-03-04 07:48:20 +08:00
|
|
|
INCLUDEDIR := $(DESTDIR)@INCLUDEDIR@
|
|
|
|
LIBDIR := $(DESTDIR)@LIBDIR@
|
|
|
|
MANDIR := $(DESTDIR)@MANDIR@
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
# Build parameters.
|
2010-02-12 06:45:59 +08:00
|
|
|
CPPFLAGS := @CPPFLAGS@ -I@srcroot@include -I@objroot@include
|
2009-06-24 10:01:18 +08:00
|
|
|
CFLAGS := @CFLAGS@ -fPIC -DPIC
|
|
|
|
ifeq (macho, @abi@)
|
|
|
|
CFLAGS += -dynamic
|
|
|
|
endif
|
|
|
|
LDFLAGS := @LDFLAGS@
|
|
|
|
LIBS := @LIBS@
|
|
|
|
RPATH_EXTRA := @RPATH_EXTRA@
|
|
|
|
ifeq (macho, @abi@)
|
|
|
|
SO := dylib
|
|
|
|
else
|
|
|
|
SO := so
|
|
|
|
endif
|
|
|
|
REV := 0
|
|
|
|
|
2010-01-17 17:49:20 +08:00
|
|
|
# Lists of files.
|
2010-04-03 04:50:53 +08:00
|
|
|
BINS := @srcroot@bin/pprof
|
2010-03-04 07:48:20 +08:00
|
|
|
CHDRS := @objroot@include/jemalloc/jemalloc@install_suffix@.h \
|
|
|
|
@objroot@include/jemalloc/jemalloc_defs@install_suffix@.h
|
2010-02-12 06:45:59 +08:00
|
|
|
CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/base.c \
|
|
|
|
@srcroot@src/chunk.c @srcroot@src/chunk_dss.c \
|
|
|
|
@srcroot@src/chunk_mmap.c @srcroot@src/chunk_swap.c @srcroot@src/ckh.c \
|
|
|
|
@srcroot@src/ctl.c @srcroot@src/extent.c @srcroot@src/hash.c \
|
|
|
|
@srcroot@src/huge.c @srcroot@src/mb.c @srcroot@src/mutex.c \
|
|
|
|
@srcroot@src/prof.c @srcroot@src/stats.c @srcroot@src/tcache.c
|
2010-01-17 17:49:20 +08:00
|
|
|
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
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
.PHONY: all dist install check clean distclean relclean
|
|
|
|
|
|
|
|
# Default target.
|
2010-02-12 05:38:12 +08:00
|
|
|
all: $(DSOS)
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2010-01-17 01:53:50 +08:00
|
|
|
#
|
|
|
|
# Include generated dependency files.
|
|
|
|
#
|
|
|
|
-include $(CSRCS:@srcroot@%.c=@objroot@%.d)
|
|
|
|
|
2009-06-26 09:06:48 +08:00
|
|
|
@objroot@src/%.o: @srcroot@src/%.c
|
2010-02-12 06:45:59 +08:00
|
|
|
@mkdir -p $(@D)
|
2010-01-04 08:17:55 +08:00
|
|
|
$(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)"
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2010-04-08 14:37:35 +08:00
|
|
|
%.so : %.so.$(REV)
|
2009-06-24 10:01:18 +08:00
|
|
|
@mkdir -p $(@D)
|
2010-04-08 14:37:35 +08:00
|
|
|
ln -sf $(<F) $@
|
|
|
|
|
|
|
|
@objroot@lib/libjemalloc@install_suffix@.so.$(REV) : $(CSRCS:@srcroot@%.c=@objroot@%.o)
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(CC) -shared -Wl,-soname,$(@F) -o $@ $+ $(LDFLAGS) $(LIBS)
|
|
|
|
|
|
|
|
@objroot@lib/libjemalloc@install_suffix@_pic.a : $(CSRCS:@srcroot@%.c=@objroot@%.o)
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
ar crus $@ $+
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2010-04-03 04:50:53 +08:00
|
|
|
install_bin:
|
|
|
|
install -d $(BINDIR)
|
|
|
|
@for b in $(BINS); do \
|
|
|
|
echo "install -m 755 $$b $(BINDIR)"; \
|
|
|
|
install -m 755 $$b $(BINDIR); \
|
|
|
|
done
|
|
|
|
|
2010-03-04 07:48:20 +08:00
|
|
|
install_include:
|
2010-02-12 06:45:59 +08:00
|
|
|
install -d $(INCLUDEDIR)/jemalloc
|
2009-06-24 10:01:18 +08:00
|
|
|
@for h in $(CHDRS); do \
|
2010-02-12 06:45:59 +08:00
|
|
|
echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
|
|
|
|
install -m 644 $$h $(INCLUDEDIR)/jemalloc; \
|
2009-06-24 10:01:18 +08:00
|
|
|
done
|
2010-03-04 07:48:20 +08:00
|
|
|
|
|
|
|
install_lib: $(DSOS)
|
2009-06-24 10:01:18 +08:00
|
|
|
install -d $(LIBDIR)
|
2010-01-17 17:49:20 +08:00
|
|
|
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)
|
2010-03-04 07:48:20 +08:00
|
|
|
|
|
|
|
install_man:
|
2010-01-17 17:49:20 +08:00
|
|
|
install -d $(MANDIR)/man3
|
2009-06-24 10:01:18 +08:00
|
|
|
@for m in $(MAN3); do \
|
|
|
|
echo "install -m 644 $$m $(MANDIR)/man3"; \
|
|
|
|
install -m 644 $$m $(MANDIR)/man3; \
|
|
|
|
done
|
|
|
|
|
2010-04-03 04:50:53 +08:00
|
|
|
install: install_bin install_include install_lib install_man
|
2010-03-04 07:48:20 +08:00
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
check:
|
|
|
|
|
|
|
|
clean:
|
2010-01-04 08:17:55 +08:00
|
|
|
rm -f $(CSRCS:@srcroot@%.c=@objroot@%.o)
|
|
|
|
rm -f $(CSRCS:@srcroot@%.c=@objroot@%.d)
|
|
|
|
rm -f $(DSOS)
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
distclean: clean
|
2010-04-14 13:01:55 +08:00
|
|
|
rm -rf @objroot@autom4te.cache
|
2009-06-24 10:01:18 +08:00
|
|
|
rm -f @objroot@config.log
|
|
|
|
rm -f @objroot@config.status
|
|
|
|
rm -f @objroot@cfghdrs.stamp
|
|
|
|
rm -f @objroot@cfgoutputs.stamp
|
2010-01-17 17:49:20 +08:00
|
|
|
rm -f @cfghdrs_out@
|
|
|
|
rm -f @cfgoutputs_out@
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
relclean: distclean
|
|
|
|
rm -f @objroot@configure
|
2010-03-03 05:01:16 +08:00
|
|
|
rm -f @srcroot@VERSION
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
#===============================================================================
|
|
|
|
# Re-configuration rules.
|
|
|
|
|
|
|
|
ifeq (@enable_autogen@, 1)
|
|
|
|
@srcroot@configure : @srcroot@configure.ac
|
|
|
|
cd ./@srcroot@ && @AUTOCONF@
|
|
|
|
|
|
|
|
@objroot@config.status : @srcroot@configure
|
|
|
|
./@objroot@config.status --recheck
|
|
|
|
|
2010-04-08 14:37:35 +08:00
|
|
|
@srcroot@config.stamp.in : @srcroot@configure.ac
|
|
|
|
echo stamp > @srcroot@config.stamp.in
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2010-04-08 14:37:35 +08:00
|
|
|
@objroot@config.stamp : @cfgoutputs_in@ @cfghdrs_in@ @srcroot@configure
|
2009-06-24 10:01:18 +08:00
|
|
|
./@objroot@config.status
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
# There must be some action in order for make to re-read Makefile when it is
|
|
|
|
# out of date.
|
2010-04-08 14:37:35 +08:00
|
|
|
@cfgoutputs_out@ @cfghdrs_out@ : @objroot@config.stamp
|
2009-06-24 10:01:18 +08:00
|
|
|
@true
|
|
|
|
endif
|