-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (30 loc) · 863 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
CXXFLAGS = -std=c++14 -mavx2 -mfma -O2 -flto -fopenmp $(INCLUDES)
INCLUDES := -Ilib -Ilib/yaml-cpp/include
OBJS := build/main.o \
build/scene.o \
build/ext/ply.o \
build/ext/image.o \
build/libyaml-cpp.a
PCH := build/all.gch
HEADERS := $(shell find src -type f -name '*.h')
all: mkdir main
main: $(OBJS)
$(CXX) -o $@ $(CXXFLAGS) $^
build/%.o: src/%.cc $(PCH) $(HEADERS)
$(CXX) -c -o $@ $(CXXFLAGS) -include $(PCH:.gch=) $<
build/ext/%.o: src/ext/%.cc src/ext/%.h
$(CXX) -c -o $@ $(CXXFLAGS) $<
$(PCH): src/all.h Makefile
$(CXX) -c -o $@ $(CXXFLAGS) -x c++-header $<
build/libyaml-cpp.a:
cd build/yaml-cpp \
&& cmake ../../lib/yaml-cpp \
&& cmake --build . \
&& mv libyaml-cpp.a ..
clean:
rm -f $(PCH) build/*.o
mkdir:
@mkdir -p build/ext build/yaml-cpp
FORCE:
.PHONY: all clean mkdir FORCE
-include run.mk