-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
161 lines (113 loc) · 3.15 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
all: cfdg
#
# Dirs
#
OBJ_DIR = objs
COMMON_DIR = src-common
UNIX_DIR = src-unix
DERIVED_DIR = $(OBJ_DIR)
AGG_DIR = src-agg
FFMPEG_DIR = src-ffmpeg
SRC_DIRS = $(COMMON_DIR) $(UNIX_DIR) $(DERIVED_DIR) $(AGG_DIR)/src
vpath %.cpp $(SRC_DIRS)
INC_DIRS = $(COMMON_DIR) $(UNIX_DIR) $(DERIVED_DIR) $(AGG_DIR)/include $(COMMON_DIR)/agg-extras $(FFMPEG_DIR)/include
INC_DIRS += /usr/local/include
#
# Library directories for FFmpeg and libpng
#
LIB_DIRS = $(FFMPEG_DIR)/lib /usr/local/lib
#
# Sources and Objects
#
COMMON_SRCS = cfdg.cpp Rand64.cpp makeCFfilename.cpp \
cfdgimpl.cpp renderimpl.cpp builder.cpp shape.cpp \
variation.cpp tempfile.cpp commandLineSystem.cpp \
aggCanvas.cpp HSBColor.cpp SVGCanvas.cpp rendererAST.cpp \
primShape.cpp bounds.cpp shape.cpp shapeSTL.cpp tiledCanvas.cpp \
astexpression.cpp astreplacement.cpp pathIterator.cpp \
stacktype.cpp CmdInfo.cpp abstractPngCanvas.cpp ast.cpp
UNIX_SRCS = pngCanvas.cpp posixSystem.cpp main.cpp posixTimer.cpp \
posixVersion.cpp
DERIVED_SRCS = lex.yy.cpp cfdg.tab.cpp
AGG_SRCS = agg_trans_affine.cpp agg_curves.cpp agg_vcgen_contour.cpp \
agg_vcgen_stroke.cpp agg_bezier_arc.cpp agg_color_rgba.cpp
LIBS = png z m
# Use the first one for clang and the second one for gcc
#LIBS += c++
LIBS += stdc++
#
# FFmpeg support
#
# Uncomment these lines to enable FFmpeg support
#
# COMMON_SRCS += ffCanvas.cpp
# LIBS += avformat avcodec avutil
#
# Comment out this line to enable FFmpeg support
#
COMMON_SRCS += ffCanvasDummy.cpp
SRCS = $(COMMON_SRCS) $(UNIX_SRCS) $(DERIVED_SRCS) $(AGG_SRCS)
OBJS = $(patsubst %.cpp,$(OBJ_DIR)/%.o,$(SRCS))
DEPS = $(patsubst %.o,%.d,$(OBJS))
LINKFLAGS += $(patsubst %,-L%,$(LIB_DIRS))
LINKFLAGS += $(patsubst %,-l%,$(LIBS))
LINKFLAGS += -fexceptions
deps: $(OBJ_DIR) $(DEPS)
include $(DEPS)
$(OBJS): $(OBJ_DIR)/Sentry
#
# Executable
#
# Under Cygwin replace strip $@ with strip $@.exe
cfdg: $(OBJS)
$(LINK.o) $^ $(LINKFLAGS) -o $@
strip $@
#
# Derived
#
$(DERIVED_DIR)/lex.yy.cpp: $(COMMON_DIR)/cfdg.l
flex -o $@ $^
$(DERIVED_DIR)/cfdg.tab.hpp: $(DERIVED_DIR)/cfdg.tab.cpp
$(DERIVED_DIR)/cfdg.tab.cpp: $(COMMON_DIR)/cfdg.ypp
bison -o $(DERIVED_DIR)/cfdg.tab.cpp $(COMMON_DIR)/cfdg.ypp
$(OBJ_DIR)/lex.yy.o: $(DERIVED_DIR)/cfdg.tab.hpp
#
# Utility
#
clean :
rm -f $(OBJ_DIR)/*
rm -f cfdg
distclean: clean
rmdir $(OBJ_DIR)
$(OBJ_DIR)/Sentry :
mkdir -p $(OBJ_DIR) 2> /dev/null || true
touch $@
#
# Tests
#
RTEST_CFDG = input/rendering-tests.cfdg
OUTPUT_DIR = output
rtests: $(OUTPUT_DIR)/rtest-700.png $(OUTPUT_DIR)/rtest-2k.png
$(OUTPUT_DIR)/rtest-700.png: cfdg $(RTEST_CFDG)
./cfdg -s 700 $(RTEST_CFDG) $@
$(OUTPUT_DIR)/rtest-2k.png: cfdg $(RTEST_CFDG)
./cfdg -s 2000 $(RTEST_CFDG) $@
test: cfdg
./runtests.sh
#
# Rules
#
CPPFLAGS += $(patsubst %,-I%,$(INC_DIRS))
CPPFLAGS += -O3 -Wall -march=native -Wno-parentheses -std=c++0x
#CPPFLAGS += -g
# Add this for clang
#CPPFLAGS += -stdlib=libc++
$(OBJ_DIR)/%.o : %.cpp
$(COMPILE.cpp) $(OUTPUT_OPTION) $<
$(OBJ_DIR)/%.d : %.cpp
mkdir -p $(OBJ_DIR) 2> /dev/null || true
set -e; $(COMPILE.cpp) -MM $< \
| sed 's,\(.*\.o\)\( *:\),$(OBJ_DIR)/\1 $@\2,g' > $@; \
[ -s $@ ] || rm -f $@
$(OBJ_DIR)/cfdg.tab.d:
$(OBJ_DIR)/lex.yy.d: