forked from trainman419/fiducials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
247 lines (203 loc) · 5.07 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# Copyright (c) 2013 by Wayne C. Gramlich. All rights reserved.
# ROS_ROOT needs to be a defined environment variable.
# Currently, mine is set to /opt/ros/groovy.
# See http://ros.org/ to see what it takes to get ROS installed.
ROS_INCLUDES := \
-I$(ROS_ROOT)/include
ROS_LIBRARIES_DIRECTORY := \
$(ROS_ROOT)/lib
POINT_GREY_INCLUDES := \
-I/usr/include/flycapture \
# The following warning options tend to work for both C and C++:
MIXED_WARNING_OPTIONS := \
-Wreturn-type \
-Wno-missing-braces \
-Wextra \
-Wno-missing-field-initializers \
-Wformat=2 \
-Wswitch-default \
-Wcast-align \
-Wpointer-arith \
-Winline \
-Wundef \
-Wshadow \
-Wunreachable-code \
-Wlogical-op \
-Wfloat-equal \
-Wstrict-aliasing=2 \
-Wstrict-overflow=5 \
# The following warning options tend not to work for C++; they do work for C:
C_ONLY_WARNING_OPTIONS := \
${MIXED_WARNING_OPTIONS} \
-Wbad-function-cast \
-Wstrict-prototypes \
-Wold-style-definition \
-Werror \
# The following warning options should be turned on, but are causing problems:
C_NOT_WORKING_RIGHT := \
-Wcast-qual \
# The following options are passed to the compiler.
# Warnings are done separately:
CC_OPTIONS := \
-DPTGREY=1 \
${POINT_GREY_INCLUDES} \
${ROS_INCLUDES} \
-L $(ROS_LIBRARIES_DIRECTORY) \
-std=c11 \
-g \
-MMD \
# The following options are used sometimes:
OTHER_CC_OPTIONS := \
-O3 \
-pg \
# Use different warning options depending if C++ is encountered or not:
CC := gcc
CC_MIXED := $(CC) ${CC_OPTIONS} ${MIXED_WARNING_OPTIONS}
CC_C_ONLY := $(CC) ${CC_OPTIONS} ${C_ONLY_WARNING_OPTIONS}
COMMON_O_FILES := \
Bounding_Box.o \
Character.o \
CRC.o \
Double.o \
FEC.o \
File.o \
Float.o \
Integer.o \
List.o \
Logical.o \
Memory.o \
String.o \
SVG.o \
Table.o \
Unsigned.o \
DEMO_O_FILES := \
Arc.o \
Camera_Tag.o \
CV.o \
Demo.o \
Fiducials.o \
Location.o \
Map.o \
Tag.o \
High_GUI2.o \
FLY_CAPTURE_O_FILES := \
Arc.o \
Camera_Tag.o \
CV.o \
FC2.o \
Fiducials.o \
Fly_Capture.o \
High_GUI2.o \
Location.o \
Map.o \
Tag.o \
FLYCAPTURE2TEST_O_FILES := \
FC2.o \
FlyCapture2Test.o \
MAP_TEST_O_FILES := \
Arc.o \
CV.o \
Camera_Tag.o \
Map.o \
Map_Test.o \
Tag.o \
TAGS_O_FILES := \
Tags.o \
VIDEO_CAPTURE_O_FILES := \
CV.o \
FC2.o \
High_GUI2.o \
Video_Capture.o \
ALL_O_FILES := \
${COMMON_O_FILES} \
${DEMO_O_FILES} \
${FLYCAPTURE2TEST_O_FILES} \
${MAP_TEST_O_FILES} \
${TAGS_O_FILES} \
${VIDEO_CAPTURE_O_FILES} \
ALL_C_BACKUPS := ${ALL_O_FILES:%.o=%.c~}
ALL_D_FILES := ${ALL_O_FILES:%.o=%.d}
ALL_H_BACKUPS := ${ALL_O_FILES:%.o=%.h~}
REVIEW_FILE_BASES := \
Arc \
Camera_Tag \
CV \
Fiducials \
List \
Location \
Map \
Memory \
String \
Table \
Tag
REVIEW_FILES := \
${REVIEW_FILE_BASES:%=%.c} \
${REVIEW_FILE_BASES:%=include/fiducials/%.h}
POINT_GREY_LIBRARIES := \
-lflycapture-c \
-lflycapture \
OPENCV_LIBRARIES := \
-lopencv_core \
-lopencv_imgproc \
-lopencv_calib3d \
-lopencv_highgui \
-lm \
PROGRAMS := \
Demo \
Fly_Capture \
FlyCapture2Test \
Map_Test \
Tags \
Video_Capture \
all: ${PROGRAMS}
# Program linking:
Tags: ${COMMON_O_FILES} ${TAGS_O_FILES}
${CC_C_ONLY} -o $@ ${TAGS_O_FILES} \
${COMMON_O_FILES} -lm
Demo: ${COMMON_O_FILES} ${DEMO_O_FILES}
${CC_C_ONLY} -o $@ ${DEMO_O_FILES} \
${COMMON_O_FILES} ${OPENCV_LIBRARIES} -lm
Fly_Capture: ${COMMON_O_FILES} ${FLY_CAPTURE_O_FILES}
${CC_MIXED} -o $@ ${FLY_CAPTURE_O_FILES} \
${COMMON_O_FILES} ${OPENCV_LIBRARIES} ${POINT_GREY_LIBRARIES} -lm
FlyCapture2Test: ${FLYCAPTURE2TEST_O_FILES}
${CC_MIXED} -o $@ ${FLYCAPTURE2TEST_O_FILES} \
${COMMON_O_FILES} ${POINT_GREY_LIBRARIES}
Map_Test: ${COMMON_O_FILES} ${MAP_TEST_O_FILES}
${CC_C_ONLY} -o $@ ${MAP_TEST_O_FILES} \
${COMMON_O_FILES} ${OPENCV_LIBRARIES} -lm
Video_Capture: ${COMMON_O_FILES} ${VIDEO_CAPTURE_O_FILES}
${CC_MIXED} -o $@ ${VIDEO_CAPTURE_O_FILES} \
${COMMON_O_FILES} ${OPENCV_LIBRARIES} ${POINT_GREY_LIBRARIES} -lm
review.pdf: ${REVIEW_FILES}
rm -rf /tmp/review /tmp/numbered
mkdir -p /tmp/review /tmp/numbered
cp ${REVIEW_FILES} /tmp/review
(cd /tmp/review ; \
for i in *.[ch] ; do \
echo $$i; \
cat -n $$i > ../numbered/$$i ; \
done)
(cd /tmp/numbered ; enscript *.h *.c -p review.pdf)
cp /tmp/numbered/review.pdf $@
rm -rf /tmp/review /tmp/numbered
# Individual C file compilation:
FlyCapture2Test.o: FlyCapture2Test.c
${CC_MIXED} -o $@ -c $<
FC2.o: FC2.c
${CC_MIXED} -o $@ -c $<
Video_Capture.o: Video_Capture.c
${CC_MIXED} -o $@ -c $<
Fly_Capture.o: Fly_Capture.c
${CC_MIXED} -o $@ -c $<
clean:
rm -f ${ALL_C_BACKUPS}
rm -f ${ALL_D_FILES}
rm -f ${ALL_H_BACKUPS}
rm -f ${ALL_O_FILES}
rm -f ${PROGRAMS}
rm -f Makefile~ Tags.ezc~
%.o: %.c
${CC_C_ONLY} -c -o $@ $<
# Used with gcc -MMD option to force automagic dependency checking:
-include ${ALL_D_FILES}