-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMakefile
50 lines (34 loc) · 913 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
PWD=$(shell pwd)
PATH_SIMPLX= $(PWD)/../..
INCLUDES_SIMPLX= -I $(PATH_SIMPLX)/include
SRC_SIMPLX=$(shell find $(PATH_SIMPLX)/src/engine -iname "*.cpp")
SRC_UTILS=$(shell find $(PATH_SIMPLX)/src/util -iname "*.cpp")
V ?= 1
SRC=$(SRC_SIMPLX) $(SRC_UTILS) main.v$(V).cpp
FLAGS = -g -Wall -Wextra --std=c++11 -fno-access-control -Wno-unused-parameter -Wno-parentheses -Wfatal-errors
DEBUG ?= 1
ifeq ($(DEBUG), 1)
FLAGS+= -O0
else
FLAGS+= -O2 -DNDEBUG
endif
OBJ= $(SRC:.cpp=.o) $(OBJ_ZLIB)
DEP = $(OBJ:.o=.d)
LDFLAGS=-lpthread
all: main
%.o: %.c Makefile
gcc -O3 -c $< -o $@
%.o: %.cpp %.d Makefile
g++ -c $< -o $@ $(FLAGS) $(INCLUDES_SIMPLX)
-include $(DEP)
%.d: %.cpp Makefile
g++ $(FLAGS) $(INCLUDES_SIMPLX) $< -MM -MT $(@:.d=.o) >$@
main: $(OBJ) Makefile
g++ -o main.v$(V).bin $(OBJ) $(LDFLAGS)
.PHONY: clean
clean:
rm -f $(DEP)
rm -f $(OBJ)
rm -f *.d
rm -f *.o
rm -f main.v*.bin