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.
|
2009-07-02 10:24:31 +08:00
|
|
|
BINDIR := @BINDIR@
|
2009-06-24 10:01:18 +08:00
|
|
|
INCLUDEDIR := @INCLUDEDIR@
|
|
|
|
LIBDIR := @LIBDIR@
|
|
|
|
MANDIR := @MANDIR@
|
|
|
|
|
|
|
|
# Build parameters.
|
|
|
|
CPPFLAGS := @CPPFLAGS@
|
|
|
|
CFLAGS := @CFLAGS@ -fPIC -DPIC
|
|
|
|
ifeq (macho, @abi@)
|
|
|
|
CFLAGS += -dynamic
|
|
|
|
endif
|
|
|
|
LDFLAGS := @LDFLAGS@
|
|
|
|
LIBS := @LIBS@
|
2009-07-02 10:24:31 +08:00
|
|
|
GDLIBS := @GDLIBS@
|
2009-06-24 10:01:18 +08:00
|
|
|
RPATH_EXTRA := @RPATH_EXTRA@
|
|
|
|
ifeq (macho, @abi@)
|
|
|
|
SO := dylib
|
|
|
|
else
|
|
|
|
SO := so
|
|
|
|
endif
|
|
|
|
REV := 0
|
|
|
|
|
|
|
|
# File lists.
|
2009-07-02 10:24:31 +08:00
|
|
|
BINS := @bins@
|
2009-06-26 09:06:48 +08:00
|
|
|
CHDRS := @srcroot@src/jemalloc.h @objroot@src/jemalloc_defs.h
|
|
|
|
CSRCS := @srcroot@src/jemalloc.c
|
|
|
|
DSOS := @objroot@lib/libjemalloc.so.$(REV) @objroot@lib/libjemalloc.so
|
|
|
|
MAN3 := @objroot@doc/jemalloc.3
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
.PHONY: all dist install check clean distclean relclean
|
|
|
|
|
|
|
|
# Default target.
|
2009-07-02 10:24:31 +08:00
|
|
|
all: $(DSOS) bins
|
2009-06-24 10:01:18 +08:00
|
|
|
|
2009-06-26 09:06:48 +08:00
|
|
|
@objroot@src/%.o: @srcroot@src/%.c
|
2009-06-24 10:01:18 +08:00
|
|
|
$(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $+
|
|
|
|
|
2009-06-26 09:06:48 +08:00
|
|
|
$(DSOS): $(CSRCS:@srcroot@%.c=@objroot@%.o)
|
2009-06-24 10:01:18 +08:00
|
|
|
@mkdir -p $(@D)
|
|
|
|
gcc -shared -o $@ $+ $(LDFLAGS) $(LIBS)
|
|
|
|
ln -sf libjemalloc.so.$(REV) lib/libjemalloc.so
|
|
|
|
|
2009-07-02 10:24:31 +08:00
|
|
|
bins: $(BINS)
|
|
|
|
|
|
|
|
@objroot@bin/mtrgraph: @objroot@src/mtrgraph.o
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
gcc -o $@ $+ $(LDFLAGS) $(LIBS) $(GDLIBS)
|
|
|
|
|
|
|
|
@objroot@bin/%: @objroot@src/%.o
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
gcc -o $@ $+ $(LDFLAGS) $(LIBS)
|
|
|
|
|
2009-06-24 10:01:18 +08:00
|
|
|
install:
|
2009-07-02 10:24:31 +08:00
|
|
|
install -d $(BINDIR)
|
|
|
|
@for b in $(BINS); do \
|
|
|
|
echo "install -m 755 $$b $(BINDIR)"; \
|
|
|
|
install -m 755 $$b $(BINDIR); \
|
|
|
|
done
|
2009-06-24 10:01:18 +08:00
|
|
|
install -d $(INCLUDEDIR)
|
|
|
|
@for h in $(CHDRS); do \
|
|
|
|
echo "install -m 644 $$h $(INCLUDEDIR)"; \
|
|
|
|
install -m 644 $$h $(INCLUDEDIR); \
|
|
|
|
done
|
|
|
|
install -d $(LIBDIR)
|
2009-06-26 09:06:48 +08:00
|
|
|
@for s in $(DSOS); do \
|
|
|
|
echo "install -m 755 $$s $(LIBDIR)"; \
|
|
|
|
install -m 755 $$s $(LIBDIR); \
|
|
|
|
done
|
2009-06-24 10:01:18 +08:00
|
|
|
install -d $(MANDIR)
|
|
|
|
@for m in $(MAN3); do \
|
|
|
|
echo "install -m 644 $$m $(MANDIR)/man3"; \
|
|
|
|
install -m 644 $$m $(MANDIR)/man3; \
|
|
|
|
done
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
|
|
|
clean:
|
2009-06-26 09:06:48 +08:00
|
|
|
rm -f @objroot@src/*.o
|
|
|
|
rm -f @objroot@lib/libjemalloc.so
|
|
|
|
rm -f @objroot@lib/libjemalloc.so.$(REV)
|
2009-06-24 10:01:18 +08:00
|
|
|
|
|
|
|
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@
|
|
|
|
rm -f @cfgoutputs@
|
|
|
|
|
|
|
|
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 : $(patsubst %, %.in, @cfghdrs@) \
|
|
|
|
@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 : $(patsubst %, @srcroot@%.in, @cfgoutputs@) \
|
|
|
|
@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
|