-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (24 loc) · 707 Bytes
/
Copy pathMakefile
File metadata and controls
34 lines (24 loc) · 707 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
TARGET = libemalloc
TEST_TARGET = test
VARIANT ?= RELEASE
TOOLCHAIN_PREFIX ?=
CC ?= $(TOOLCHAIN_PREFIX)gcc
SOURCES = emalloc.c ebrk.c eslab.c eutil.c ebuddy.c emmap.c espinlock.c eapi.c
OBJECTS = $(SOURCES:.c=.o)
MAPFILE = exports.map
ifeq ($(VARIANT), RELEASE)
OPTFLAGS = -O2
else ifeq ($(VARIANT), DEBUG)
OPTFLAGS = -g -O0
endif
CFLAGS = -Wall -Wextra -fno-builtin-malloc -fno-builtin
LDFLAGS = -fPIC
$(TARGET).so: $(OBJECTS)
$(CC) -shared -Wl,--version-script=$(MAPFILE) $(OPTFLAGS) $(LDFLAGS) $(OBJECTS) -o $(TARGET).so
$(OBJECTS): %.o: %.c
$(CC) -c $(OPTFLAGS) $(CFLAGS) $< -o $@
build: $(TARGET).so
clean:
rm -f $(TARGET).so $(OBJECTS)
fresh: clean build
.PHONY: build clean fresh