-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
47 lines (35 loc) · 1008 Bytes
/
makefile
File metadata and controls
47 lines (35 loc) · 1008 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
44
45
46
47
.ONESHELL:
.SECONDEXPANSION:
APP := render
#the default target
all: monkey.svg torus.svg
PKG := cairo libavformat libavcodec libavutil libswscale
PKG_CONFIG_FLAGS := $(shell pkg-config $(PKG) --cflags)
PKG_CONFIG_LD := $(shell pkg-config $(PKG) --libs)
CXXFLAGS += -std=c++14 -Iinclude -fno-rtti -fno-exceptions -Wall $(PKG_CONFIG_FLAGS)
ifdef DEBUG
CXXFLAGS += -D_GLIBCXX_DEBUG -g
else
CXXFLAGS += -ffunction-sections -fdata-sections -O3
endif
render.o: %.o : %.cpp
$(CXX) $(CXXFLAGS) $< -o $@ -c
render.cpp.format : %.format : %
clang-format -style="{BasedOnStyle: Chromium,ColumnLimit: 160}" -i $<
echo > $@
LDFLAGS += -lm
LDFLAGS += $(PKG_CONFIG_LD)
ifndef DEBUG
LDFLAGS += -Wl,--gc-sections
endif
$(APP) : render.o
$(CXX) $^ -o $@ $(LDFLAGS)
monkey.svg : $(APP) monkey.stl
./$^ $@ -m "0 2 0"
torus.svg : $(APP) torus.stl
./$^ $@ --rotate_x ".61" -m "0 2 0"
format: render.cpp.format
.PHONY: format
clean:
rm -rf $(APP) monkey.svg torus.svg render.o render.cpp.format
.PHONY: clean