/
Makefile
59 lines (45 loc) · 1.19 KB
/
Makefile
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
CFLAGS += -O3 -Wstrict-prototypes -fomit-frame-pointer -g -Wall
libdir = /usr/lib
LDFLAGS += -lpthread -rpath $(libdir) -version-info 1
CC = gcc
CXX = g++
LD = ld
ARCH = $(shell uname -m)
# Check Architecture
SUPPORTED_ARCH = NO
ifeq ($(ARCH), x86_64)
SUPPORTED_ARCH = YES
endif
ifeq ($(SUPPORTED_ARCH), NO)
$(error Your architecture $(ARCH) is not currently supported. See README.)
endif
define compile_rule
libtool --mode=compile --tag=CC \
$(CC) $(CFLAGS) $(CPPFLAGS) -Iinclude-$(ARCH) -c $<
endef
define cxx_compile_rule
libtool --mode=compile --tag=CC \
$(CXX) $(CFLAGS) $(CPPFLAGS) -Iinclude-$(ARCH) -c $<
endef
define link_rule
libtool --mode=link --tag=CC \
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
endef
LIBS = libssmalloc.la
libssmalloc_OBJS = ssmalloc.lo new_delete.lo
%.lo: %.c
$(call compile_rule)
%.lo: %.cpp
$(call cxx_compile_rule)
all: libssmalloc.la
libssmalloc.la: $(libssmalloc_OBJS)
$(call link_rule)
cp .libs/libssmalloc.so ./
cp .libs/libssmalloc.a ./
install/%.la: %.la
libtool --mode=install \
install -c $(notdir $@) $(libdir)/$(notdir $@)
install: $(addprefix install/,$(LIBS))
libtool --mode=finish $(libdir)
clean:
libtool --mode=clean rm *.la *.lo *.a *.so -f