-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·35 lines (26 loc) · 781 Bytes
/
Makefile
File metadata and controls
executable file
·35 lines (26 loc) · 781 Bytes
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
CC = gcc
CPPFLAGS = -D_DEFAULT_SOURCE
CFLAGS = -Wall -Wextra -Werror -std=c99 -fPIC -fno-builtin
LDFLAGS = -shared
VPATH = src
TARGET_LIB = libmalloc.so
OBJS = malloc.o my_mmap.o small_allocator.o util.o hash_map.o malloc_api.o
CALL_LIB = libtracemalloc.so
CALL_OBJS = call_trace.o
all: $(TARGET_LIB)
check:
$(TARGET_LIB): CFLAGS += -pedantic -fvisibility=hidden
$(TARGET_LIB): LDFLAGS += -lpthread
$(TARGET_LIB): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
debug: CFLAGS += -g
debug: clean $(TARGET_LIB)
trace: $(CALL_LIB)
$(CALL_LIB): CPPFLAGS = -D_GNU_SOURCE
$(CALL_LIB): CFLAGS += -g
$(CALL_LIB): LDFLAGS += -ldl
$(CALL_LIB): $(CALL_OBJS)
$(CC) $(LDFLAGS) -o $@ $^
clean:
$(RM) $(TARGET_LIB) $(CALL_LIB) $(OBJS) $(CALL_OBJS)
.PHONY: all $(TARGET_LIB) $(CALL_LIB) trace clean