-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
35 lines (25 loc) · 1016 Bytes
/
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
CXX = g++
CFLAGS = -std=c++11 -O3 -finline-functions -Wno-inline -Wall -pthread
LFLAGS =
IDEPS = aux_.h lite-hooks-wrap.h lite-malloc.h stack.h l-singleton.h
STATIC_LIB = liblite-malloc-static.a
SHARED_LIB = liblite-malloc-shared.so
all: $(STATIC_LIB) $(SHARED_LIB)
lite-malloc.o: $(IDEPS)
$(CXX) $(CFLAGS) lite-malloc.cpp -fPIC -c -o lite-malloc.o
$(STATIC_LIB): lite-malloc.o
-rm -f $(STATIC_LIB)
ar rc $(STATIC_LIB) lite-malloc.o
$(SHARED_LIB): lite-malloc.o
objcopy --redefine-sym __wrap_malloc=malloc \
--redefine-sym __wrap_free=free \
--redefine-sym __wrap_calloc=calloc \
--redefine-sym __wrap_realloc=realloc \
--redefine-sym __wrap_memalign=memalign \
--redefine-sym __wrap_posix_memalign=posix_memalign \
--redefine-sym __wrap_valloc=valloc \
--redefine-sym __wrap_aligned_alloc=aligned_alloc \
lite-malloc.o lite-malloc-shared.o
$(CXX) $(LFLAGS) lite-malloc-shared.o -shared -o $(SHARED_LIB)
clean:
-rm -f lite-malloc.o lite-malloc-shared.o $(STATIC_LIB) $(SHARED_LIB)