blob: 1652ec985df891ddc42c5107cb6e867d28282eea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# 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@
DATADIR := @DATADIR@
MANDIR := @MANDIR@
# Build parameters.
CPPFLAGS := @CPPFLAGS@
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
# File lists.
CHDRS := src/jemalloc.h
CSRCS := src/jemalloc.c
DSO := lib/libjemalloc.so.$(REV)
MAN3 := doc/jemalloc.3
.PHONY: all dist install check clean distclean relclean
# Default target.
all: $(DSO)
src/%.o: src/%.c
$(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $+
$(DSO): $(CSRCS:%.c=%.o)
@mkdir -p $(@D)
gcc -shared -o $@ $+ $(LDFLAGS) $(LIBS)
ln -sf libjemalloc.so.$(REV) lib/libjemalloc.so
install:
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 $(DSO) $(LIBDIR)
install -d $(MANDIR)
@for m in $(MAN3); do \
echo "install -m 644 $$m $(MANDIR)/man3"; \
install -m 644 $$m $(MANDIR)/man3; \
done
check:
clean:
rm -f src/*.o
rm -f lib/libjemalloc.so
rm -f lib/libjemalloc.so.$(REV)
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
|