-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (24 loc) · 755 Bytes
/
Makefile
File metadata and controls
34 lines (24 loc) · 755 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
CC = gcc
CXX = g++
COMMON_FLAGS = -g -Wall -D_BSD_SOURCE
CFLAGS = -std=c99 $(COMMON_FLAGS) #-DDEBUG_MALLOC
CXXFLAGS = $(COMMON_FLAGS)
SHLIB_CFLAGS = -fPIC $(CFLAGS)
TEST_SRCS := $(shell ls t/test*.c*)
TEST_EXES := $(patsubst %.c,%,$(patsubst %.cpp,%,$(TEST_SRCS)))
t/test% : t/test%.c
$(CC) $(CFLAGS) -o $@ t/test$*.c -lm
t/test% : t/test%.cpp
$(CXX) $(CXXFLAGS) -o $@ t/test$*.cpp -lm
all : EasySandbox.so tests
EasySandbox.so : EasySandbox.o malloc.o
gcc -shared -o EasySandbox.so EasySandbox.o malloc.o -ldl
EasySandbox.o : EasySandbox.c
gcc -c $(SHLIB_CFLAGS) EasySandbox.c
malloc.o : malloc.c
gcc -c $(SHLIB_CFLAGS) malloc.c
tests : $(TEST_EXES)
runtests : all
./runalltests.sh $(TEST_EXES)
clean :
rm -f *.o *.so $(TEST_EXES) core