-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
38 lines (27 loc) · 1.17 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
CC := gcc
debug: CFLAGS := -O0 -ggdb -fpic -Wall -I. -Iulib-svn/include
release: CFLAGS := -O3 -fpic -Wall -I. -Iulib-svn/include
LDFLAGS := -lpthread
SRCDIR := src
OBJDIR := objects
OBJECTS := util.o chunk.o object_table.o arena.o nvm_malloc.o
LIBNAME := libnvmmalloc.so
release: $(LIBNAME) libnvmmallocnoflush.so libnvmmallocnofence.so libnvmmallocnone.so
debug: $(LIBNAME)
$(LIBNAME): ulib-svn/lib/libulib.a $(addprefix $(OBJDIR)/, $(OBJECTS))
$(CC) $(CFLAGS) -shared -o $@ $(LDFLAGS) $(addprefix $(OBJDIR)/, $(OBJECTS)) ulib-svn/lib/libulib.a
libnvmmallocnoflush.so: $(SRCDIR)/*.c ulib-svn/lib/libulib.a
$(CC) $(CFLAGS) -shared -o $@ $(LDFLAGS) -DNOFLUSH $+ ulib-svn/lib/libulib.a
libnvmmallocnofence.so: $(SRCDIR)/*.c ulib-svn/lib/libulib.a
$(CC) $(CFLAGS) -shared -o $@ $(LDFLAGS) -DNOFENCE $+ ulib-svn/lib/libulib.a
libnvmmallocnone.so: $(SRCDIR)/*.c ulib-svn/lib/libulib.a
$(CC) $(CFLAGS) -shared -o $@ $(LDFLAGS) -DNOFLUSH -DNOFENCE $+ ulib-svn/lib/libulib.a
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(SRCDIR)/*.h
@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c -o $@ $<
ulib-svn/lib/libulib.a:
cd ulib-svn; make release
clean:
@rm -f $(LIBNAME)
@rm -rf $(OBJDIR)
.PHONY: test debug release