-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
31 lines (22 loc) · 906 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
CC := clang
CXX := clang++
CFLAGS := -g -Wall -Werror -fPIC
all: myallocator.so test/malloc-test
clean:
rm -rf obj myallocator.so test/malloc-test
obj/allocator.o: allocator.c
mkdir -p obj
$(CC) $(CFLAGS) -c -o obj/allocator.o allocator.c
myallocator.so: heaplayers/gnuwrapper.cpp heaplayers/wrapper.h obj/allocator.o
$(CXX) -shared $(CFLAGS) -o myallocator.so heaplayers/gnuwrapper.cpp obj/allocator.o
test/malloc-test: test/malloc-test.c
clang -fno-omit-frame-pointer -o test/malloc-test test/malloc-test.c -D_GNU_SOURCE
zip:
@echo "Generating malloc.zip file to submit to Gradescope..."
@zip -q -r malloc.zip . -x .git/\* .vscode/\* .clang-format .gitignore myallocator.so obj test
@echo "Done. Please upload malloc.zip to Gradescope."
format:
@echo "Reformatting source code."
@clang-format -i --style=file $(wildcard *.c) $(wildcard *.h)
@echo "Done."
.PHONY: all clean zip format