-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (43 loc) · 1.39 KB
/
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
51
52
53
54
55
56
57
58
# Parametros alteraveis
CXX := g++
CXXLIBS := $(shell pkg-config --cflags --libs opencv4)
CXXFLAGS := -std=c++14 -g -Wall -Wno-missing-braces -Ofast -fopenmp $(CXXLIBS)
SRC := main.cc filemanip.cc raytrace.cc\
graphics/geometry/vec.cc graphics/geometry/quaternion.cc graphics/geometry/intersection.cc\
graphics/geometry/line.cc graphics/geometry/plane.cc graphics/geometry/parametric.cc\
graphics/geometry/poisson_disc.cc\
graphics/shape/sphere.cc graphics/shape/box.cc graphics/shape/cylinder.cc\
graphics/shape/polyhedron.cc graphics/shape/transformed.cc graphics/shape/csg_tree.cc
OBJ := $(SRC:%.cc=build/%.o)
DEP := $(SRC:%.cc=deps/%.d)
NAME := raytracing
# Fim dos parametros
ALL := bin/$(NAME)
all default: $(ALL)
$(ALL): $(OBJ)
@mkdir -p $(shell dirname $(shell readlink -m -- $(@)))
$(CXX) $(OBJ) $(CXXFLAGS) -o $(@)
build: $(OBJ)
@:
build/%.o: src/%.cc deps/%.d
@mkdir -p $(shell dirname $(shell readlink -m -- $(@)))
$(CXX) $(<) $(CXXFLAGS) -c -o $(@)
autodeps deps: $(DEP)
@:
deps/%.d: src/%.cc
@mkdir -p $(shell dirname $(shell readlink -m -- $(@)))
@$(CXX) $(<) $(CXXFLAGS) -MM -MT $(@:deps/%.d=build/%.o) -o $(@)
check test: all
bin/$(NAME)
.PHONY: clean
clean:
$(RM) $(OBJ) $(DEP) $(ALL)
.DEFAULT: all
ifeq ($(MAKECMDGOALS),)
TYPES := all
else
TYPES := $(MAKECMDGOALS)
endif
ifneq ($(shell (echo $(TYPES) | grep -oP "(all|default|build|check|test)")),)
-include $(DEP)
endif