-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (29 loc) · 810 Bytes
/
Copy pathMakefile
File metadata and controls
43 lines (29 loc) · 810 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
36
37
38
39
40
41
42
43
export PROJECTDIR=$(realpath $(CURDIR))
export BUILDIR=$(PROJECTDIR)/build
export FLAGS=-Wall -Wpedantic -Wshadow -fstrict-aliasing -Wstrict-aliasing
export CC=gcc
OBJECTS=main.o
.PHONY: build code tests clean profile profile_flags debug debug_flags
profile: profile_flags all
debug: debug_flags all
release: release_flags all
all: build out
out: code $(OBJECTS)
@echo done
$(CC) $(FLAGS) -Icode/include -o $(BUILDIR)/$@ $(addprefix $(BUILDIR)/, $(OBJECTS)) -L$(BUILDIR)/code -lmemory
build:
mkdir -p $@
code:
@$(MAKE) -C $@
%.o: %.c
$(CC) $(FLAGS) -Icode/include -c -o $(BUILDIR)/$@ $^ -L$(BUILDIR)/code -lmemory
tests: debug_flags
@$(MAKE) -C $@
clean:
rm -fr $(BUILDIR)
profile_flags:
$(eval FLAGS += -pg)
debug_flags:
$(eval FLAGS += -ggdb3 -O0)
release_flags:
$(eval FLAGS += -O3)