forked from servalproject/serval-dna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
241 lines (192 loc) · 7.79 KB
/
Makefile.in
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
# Makefile.in for Serval DNA
# vim: noet ts=8 sts=0 sw=8
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
sysconfdir=@sysconfdir@
localstatedir=@localstatedir@
NACL_BASE= nacl/src
include $(NACL_BASE)/nacl.mk
include sourcefiles.mk
include headerfiles.mk
OBJSDIR_SERVALD = objs_servald
OBJSDIR_LIB = objs_lib
OBJSDIR_TOOLS = objs
OBJSDIRS = $(OBJSDIR_SERVALD) $(OBJSDIR_LIB) $(OBJSDIR_TOOLS)
ALL_SOURCES = \
$(SERVAL_CLIENT_SOURCES) \
$(MDP_CLIENT_SOURCES) \
$(SERVAL_DAEMON_SOURCES) \
$(NACL_SOURCES) \
$(TEST_SOURCES) \
$(SERVAL_LIB_SOURCES) \
$(MONITOR_CLIENT_SRCS) \
$(SIMULATOR_SOURCES) \
$(SQLITE3_SOURCES)
SERVAL_DAEMON_OBJS = \
$(addprefix $(OBJSDIR_SERVALD)/, $(SERVAL_CLIENT_SOURCES:.c=.o)) \
$(addprefix $(OBJSDIR_SERVALD)/, $(MDP_CLIENT_SOURCES:.c=.o)) \
$(addprefix $(OBJSDIR_SERVALD)/, $(SERVAL_DAEMON_SOURCES:.c=.o))
SERVALD_OBJS = \
$(addprefix $(OBJSDIR_SERVALD)/, $(notdir $(SQLITE3_SOURCES:.c=.o))) \
$(addprefix $(OBJSDIR_SERVALD)/, $(NACL_SOURCES:.c=.o)) \
$(SERVAL_DAEMON_OBJS)
TEST_OBJS = \
$(addprefix $(OBJSDIR_SERVALD)/, $(TEST_SOURCES:.c=.o)) \
$(addprefix $(OBJSDIR_SERVALD)/, $(NACL_SOURCES:.c=.o)) \
$(addprefix $(OBJSDIR_SERVALD)/, $(SERVAL_CLIENT_SOURCES:.c=.o))
LIB_SERVAL_OBJS = \
$(addprefix $(OBJSDIR_LIB)/, $(SERVAL_CLIENT_SOURCES:.c=.o)) \
$(addprefix $(OBJSDIR_LIB)/, $(SERVAL_LIB_SOURCES:.c=.o)) \
$(addprefix $(OBJSDIR_LIB)/, $(MDP_CLIENT_SOURCES:.c=.o))
MONITOR_CLIENT_OBJS = \
$(addprefix $(OBJSDIR_LIB)/, $(SERVAL_CLIENT_SOURCES:.c=.o)) \
$(addprefix $(OBJSDIR_LIB)/, $(MONITOR_CLIENT_SRCS:.c=.o))
SIMULATOR_OBJS = \
$(addprefix $(OBJSDIR_TOOLS)/, $(SIMULATOR_SOURCES:.c=.o))
CC= @CC@
LDFLAGS=@LDFLAGS@ @LIBS@
CFLAGS= -Isqlite-amalgamation-3070900 @CPPFLAGS@ @CFLAGS@ -Inacl/include
CFLAGS+=-DSYSCONFDIR="\"$(sysconfdir)\"" -DLOCALSTATEDIR="\"$(localstatedir)\""
CFLAGS+=-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_DATETIME_FUNCS -DSQLITE_OMIT_COMPILEOPTION_DIAGS -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_VIRTUALTABLE -DSQLITE_OMIT_AUTHORIZATION
CFLAGS+=-fPIC
CFLAGS+=-Wall -Wno-unused-value -Werror
# Solaris magic
CFLAGS+=-DSHA2_USE_INTTYPES_H -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1
# OSX magic to compensate for the Solaris magic
CFLAGS+=-D_DARWIN_C_SOURCE
INSTALL= install
INSTALL_PROGRAM=$(INSTALL)
INSTALL_DATA= $(INSTALL) -m 644
-include Makefile.dbg
# More warnings, discover problems that only happen on some archs
CFLAGS+=-Wextra
# Security enhancements from Debian
CFLAGS+=-Wformat -Werror=format-security -D_FORTIFY_SOURCE=2
DEFS= @DEFS@
.PHONY: all test clean
all: servald libserval.so libmonitorclient.so libmonitorclient.a test
test: tfw_createfile directory_service fakeradio simulator serval-tests
covzero: | is_built_with_coverage
@echo REMOVE all .gcda files
@find $(OBJSDIRS) -type f -name '*.gcda' -print0 | xargs -0 $(RM)
covinit: servald-initial.info
covhtml: coverage_html/index.html
is_built_with_coverage:
@for obj in $(SERVALD_OBJS); do \
gcno="$${obj%.o}.gcno" ;\
if [ ! -r "$$gcno" ]; then \
echo "ERROR: servald has not been compiled for code coverage; missing $$gcno" ;\
exit 1 ;\
fi ;\
done
has_coverage_data: | is_built_with_coverage
@count=0; for obj in $(SERVALD_OBJS); do \
gcda="$${obj%.o}.gcda" ;\
[ -s "$$gcda" ] && count=$$(($$count + 1)) ;\
done ;\
if [ $$count -eq 0 ]; then \
echo "ERROR: no code coverage data; run some tests" ;\
exit 1 ;\
fi
servald-initial.info: Makefile servald | is_built_with_coverage
geninfo --quiet --initial --checksum --base-directory=$(abspath .) --no-external $(OBJSDIR_SERVALD) -o $@
servald-coverage.info: Makefile servald $(shell find $(OBJSDIR_SERVALD) -type f -name '*.gcda') | has_coverage_data
geninfo --quiet --checksum --base-directory=$(abspath .) --no-external $(OBJSDIR_SERVALD) -o $@ 2>&1 | { grep -v 'WARNING: no data found for .*\.h$$' || true; }
@[ -s $@ ]
coverage_html/index.html: Makefile servald-initial.info servald-coverage.info
$(RM) -r coverage_html
genhtml --quiet servald-initial.info servald-coverage.info -o coverage_html
.PRECIOUS: Makefile
Makefile: Makefile.in config.status
$(warning Makefile may be out of date, please run ./config.status)
config.status: configure
$(warning config.status may be out of date, please run ./configure)
configure: configure.in
$(warning configure may be out of date, please run autoreconf -f -i)
$(OBJSDIR_TOOLS)/version.o: $(ALL_SOURCES) $(HDRS) version_servald.c version_string.sh $(wildcard VERSION.txt) COPYRIGHT.txt
@echo CC version_servald.c
@mkdir -p $(dir $@)
@$(RM) $(@:.o=.gcno) $(@:.o=.gcda)
@V=`./version_string.sh --ignore-untracked` \
&& C="`sed -e :a -e N -e '$$!ba' -e 's/[\\\\"]/\\\\&/g' -e 's/\\n/\\\\n/g' COPYRIGHT.txt`" \
&& $(CC) $(CFLAGS) $(DEFS) -c version_servald.c -o $@ -DSERVALD_VERSION="\"$$V\"" -DSERVALD_COPYRIGHT="\"$$C\""
#' <-- fixes vim syntax highlighting
$(OBJSDIR_SERVALD)/sqlite3.o: sqlite-amalgamation-3070900/sqlite3.c Makefile
@echo SERVALD CC $<
@mkdir -p $(dir $@)
@$(RM) $(@:.o=.gcno) $(@:.o=.gcda)
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
# No object files in source directory!
%.o: %.c
$(OBJSDIR_TOOLS)/%.o: %.c
@echo CC $<
@mkdir -p $(dir $@)
@$(RM) $(@:.o=.gcno) $(@:.o=.gcda)
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
$(OBJSDIR_SERVALD)/%.o: %.c
@echo SERVALD CC $<
@mkdir -p $(dir $@)
@$(RM) $(@:.o=.gcno) $(@:.o=.gcda)
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
$(OBJSDIR_LIB)/%.o: %.c
@echo LIB CC $<
@mkdir -p $(dir $@)
@$(RM) $(@:.o=.gcno) $(@:.o=.gcda)
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
$(SERVAL_DAEMON_OBJS): $(HDRS)
$(SERVALD_OBJS): Makefile
$(LIB_SERVAL_OBJS): $(HDRS) Makefile
$(TEST_OBJS): $(HDRS) Makefile
$(MONITOR_CLIENT_OBJS): $(HDRS) Makefile
$(SIMULATOR_OBJS): $(HDRS) Makefile
servald: $(SERVALD_OBJS) $(OBJSDIR_TOOLS)/version.o
@echo LINK $@
@$(CC) -Wall -o $@ $(SERVALD_OBJS) $(OBJSDIR_TOOLS)/version.o $(LDFLAGS)
serval-tests: $(TEST_OBJS) $(OBJSDIR_TOOLS)/version.o
@echo LINK $@
@$(CC) -Wall -o $@ $(TEST_OBJS) $(OBJSDIR_TOOLS)/version.o $(LDFLAGS)
libserval.a: $(LIB_SERVAL_OBJS) $(OBJSDIR_TOOLS)/version.o
@echo AR $@
@$(AR) -cr $@ $(LIB_SERVAL_OBJS) $(OBJSDIR_TOOLS)/version.o
directory_service: $(OBJSDIR_TOOLS)/directory_service.o libserval.a
@echo LINK $@
@$(CC) -Wall -o $@ $(OBJSDIR_TOOLS)/directory_service.o libserval.a $(LDFLAGS)
tfw_createfile: $(OBJSDIR_TOOLS)/tfw_createfile.o libserval.a
@echo LINK $@
@$(CC) -Wall -o $@ $(OBJSDIR_TOOLS)/tfw_createfile.o libserval.a $(LDFLAGS)
fakeradio: $(OBJSDIR_TOOLS)/fakeradio.o libserval.a
@echo LINK $@
@$(CC) -Wall -o $@ $(OBJSDIR_TOOLS)/fakeradio.o libserval.a $(LDFLAGS)
simulator: $(SIMULATOR_OBJS) libserval.a
@echo LINK $@
@$(CC) -Wall -o $@ $(SIMULATOR_OBJS) libserval.a $(LDFLAGS)
copyright:
@if [ -x "$(COPYRIGHT_TOOL)" ]; then \
echo GENERATE COPYRIGHT.txt; \
$(COPYRIGHT_TOOL) -o COPYRIGHT.txt condense *.c *.h; \
else \
echo 'sp-copyright-tool is not in $$PATH; COPYRIGHT.txt not updated'; \
fi
findPATH = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
COPYRIGHT_TOOL := $(call findPATH,sp-copyright-tool)
libserval.so: $(SERVALD_OBJS) $(OBJSDIR_TOOLS)/version.o
@echo LINK $@
@$(CC) -Wall -shared -o $@ $(SERVALD_OBJS) $(OBJSDIR_TOOLS)/version.o $(LDFLAGS)
libmonitorclient.so: $(MONITOR_CLIENT_OBJS) $(OBJSDIR_TOOLS)/version.o
@echo LINK $@
@$(CC) -Wall -shared -o $@ $(MONITOR_CLIENT_OBJS) $(OBJSDIR_TOOLS)/version.o $(LDFLAGS)
libmonitorclient.a: $(MONITOR_CLIENT_OBJS) $(OBJSDIR_TOOLS)/version.o
@echo AR $@
@$(AR) -cr $@ $(MONITOR_CLIENT_OBJS) $(OBJSDIR_TOOLS)/version.o
install: servald
$(INSTALL_PROGRAM) -D servald $(DESTDIR)$(sbindir)/servald
uninstall:
$(RM) $(DESTDIR)$(sbindir)/servald
clean:
@$(RM) -r $(OBJSDIRS:%=%/*) \
servald libservald.so \
libserval.a libmonitorclient.so libmonitorclient.a \
fakeradio \
tfw_createfile