build: ldflags conversion: libgcrypt.
[paraslash.git] / Makefile.in
1 prefix := @prefix@
2 exec_prefix := @exec_prefix@
3
4 BINDIR := @bindir@
5 VARDIR := /var/paraslash
6 PKGDATADIR := @datarootdir@/@PACKAGE_NAME@
7 MANDIR := @datarootdir@/man/man1
8 PACKAGE_VERSION := @PACKAGE_VERSION@
9 PACKAGE_STRING := @PACKAGE_STRING@
10 INSTALL := @install@
11 STRIP := $(CROSS_COMPILE)strip
12 HOSTCC ?= cc
13 executables := $(addprefix para_, @executables@)
14 ggo_descriptions_declared := @ggo_descriptions_declared@
15 object_executable_matrix := @object_executable_matrix@
16
17
18 GENGETOPT := @gengetopt@
19 HELP2MAN := @help2man@
20 MKDIR_P := mkdir -p
21
22 speex_cppflags := @speex_cppflags@
23 opus_cppflags := @opus_cppflags@
24
25 id3tag_ldflags := @id3tag_ldflags@
26 ogg_ldflags := @ogg_ldflags@
27 vorbis_ldflags := @vorbis_ldflags@
28 speex_ldflags := @speex_ldflags@
29 opus_ldflags := @opus_ldflags@
30 faad_ldflags := @faad_ldflags@
31 mad_ldflags := @mad_ldflags@
32 flac_ldflags := @flac_ldflags@
33 oss_ldflags := @oss_ldflags@
34 alsa_ldflags := @alsa_ldflags@
35 ao_ldflags := @ao_ldflags@
36 readline_ldflags := @readline_ldflags@
37 samplerate_ldflags := @samplerate_ldflags@
38 osl_ldflags := @osl_ldflags@
39 openssl_ldflags := @openssl_ldflags@
40 gcrypt_ldflags := @gcrypt_ldflags@
41
42 build_date := $(shell date)
43 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
44 uname_rs := $(shell uname -rs)
45 cc_version := $(shell $(CC) --version | head -n 1)
46
47 GIT_VERSION := $(shell ./GIT-VERSION-GEN git-version.h)
48
49 m4_ggo_dir := m4/gengetopt
50 test_dir := t
51 ifeq ("$(origin O)", "command line")
52 build_dir := $(O)
53 else
54 build_dir := build
55 endif
56 ggo_dir := $(build_dir)/ggo
57 object_dir := $(build_dir)/objects
58 dep_dir := $(build_dir)/deps
59 man_dir := $(build_dir)/man/man1
60 cmdline_dir := $(build_dir)/cmdline
61 m4depdir := $(build_dir)/m4deps
62 help2man_dir := $(build_dir)/help2man
63 hostbin_dir := $(build_dir)/host/bin
64
65 DEBUG_CPPFLAGS += -g -Wunused -Wundef -W
66 DEBUG_CPPFLAGS += -Wredundant-decls
67 DEBUG_CPPFLAGS += -Wall -Wno-sign-compare -Wno-unknown-pragmas
68 DEBUG_CPPFLAGS += -Wformat-security
69 DEBUG_CPPFLAGS += -Wmissing-format-attribute
70
71 ifeq ($(uname_s),Linux)
72 CPPFLAGS += -fdata-sections -ffunction-sections
73 LDFLAGS += -Wl,--gc-sections
74 CPPFLAGS += -Wstrict-prototypes
75 CPPFLAGS += -Wshadow
76 # causes warnings on *BSD for the feature test macros
77 CPPFLAGS += -Wunused-macros
78 endif
79 CPPFLAGS += -Os
80 CPPFLAGS += -Wuninitialized
81 CPPFLAGS += -Wchar-subscripts
82 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
83 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
84 CPPFLAGS += -DUNAME_RS='"$(uname_rs)"'
85 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
86 CPPFLAGS += -Werror-implicit-function-declaration
87 CPPFLAGS += -Wmissing-noreturn
88 CPPFLAGS += -Wbad-function-cast
89 CPPFLAGS += -fno-strict-aliasing
90 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
91 CPPFLAGS += @arch_cppflags@
92 CPPFLAGS += -I/usr/local/include
93 CPPFLAGS += -I$(cmdline_dir)
94 CPPFLAGS += @osl_cppflags@
95
96 LDFLAGS += @clock_gettime_ldflags@
97
98 man_pages := $(patsubst %, $(man_dir)/%.1, $(executables))
99
100 autocrap := config.h.in configure
101 tarball_pfx := @PACKAGE_TARNAME@-$(PACKAGE_VERSION)
102 tarball_delete := $(addprefix $(tarball_pfx)/,\
103 web .changelog_before_cvs .changelog_cvs .gitignore)
104 tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2
105
106 # To put more focus on warnings, be less verbose as default
107 # Use 'make V=1' to see the full commands
108 ifeq ("$(origin V)", "command line")
109 Q :=
110 else
111 Q := @
112 endif
113
114 .PHONY: dep all clean distclean maintainer-clean install man tarball
115 all: dep $(executables) $(man_pages)
116 dep: $(deps)
117 man: $(man_pages)
118 tarball: $(tarball)
119
120 $(object_dir) $(man_dir) $(ggo_dir) $(cmdline_dir) $(dep_dir) $(m4depdir) \
121 $(help2man_dir) $(hostbin_dir):
122 $(Q) $(MKDIR_P) $@
123
124 -include $(m4_ggo_dir)/makefile
125
126 # When in doubt, use brute force (Ken Thompson)
127 TOUPPER = \
128 $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,\
129 $(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,\
130 $(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,\
131 $(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,\
132 $(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,\
133 $(subst z,Z,$1))))))))))))))))))))))))))
134
135 %_command_list.h: %.cmd %.c
136 @[ -z "$(Q)" ] || echo 'GEN $@'
137 $(Q) ./command_util.sh h < $< >$@
138 %_command_list.man: %.cmd %.c
139 @[ -z "$(Q)" ] || echo 'GEN $@'
140 $(Q) ./command_util.sh man < $< > $@
141 %_completion.h: %.cmd %.c
142 @[ -z "$(Q)" ] || echo 'GEN $@'
143 $(Q) ./command_util.sh compl $(strip $(call TOUPPER,$(*F)))_COMPLETERS \
144 $(strip $(call TOUPPER,$(*F)))_COMMANDS < $< > $@
145
146 server_command_list.h server_command_list.man server_completion.h: command.c
147 afs_command_list.h afs_command_list.man afs_completion.h: afs.c aft.c attribute.c
148 audiod_command_list.h audiod_command_list.man audiod_completion.h: audiod_command.c
149
150 server_command_lists_man = server_command_list.man afs_command_list.man
151 $(man_dir)/para_server.1: $(help2man_dir)/para_server $(server_command_lists_man) | $(man_dir)
152 @[ -z "$(Q)" ] || echo 'MAN $<'
153 $(Q) opts="`for i in $(server_command_lists_man); do printf "%s\n" "-i $$i"; done`"; \
154 $(HELP2MAN) $$opts ./$< > $@
155
156 $(man_dir)/para_audiod.1: $(help2man_dir)/para_audiod audiod_command_list.man | $(man_dir)
157 @[ -z "$(Q)" ] || echo 'MAN $<'
158 $(Q) $(HELP2MAN) -N -i audiod_command_list.man ./$< > $@
159
160 $(man_dir)/para_play.1: $(help2man_dir)/para_play play_command_list.man | $(man_dir)
161 @[ -z "$(Q)" ] || echo 'MAN $<'
162 $(Q) $(HELP2MAN) -N -i play_command_list.man ./$< > $@
163
164 $(man_dir)/%.1: $(help2man_dir)/% | $(man_dir)
165 @[ -z "$(Q)" ] || echo 'MAN $<'
166 $(Q) $(HELP2MAN) -N ./$< > $@
167
168 $(hostbin_dir)/error2: error2.c | $(hostbin_dir)
169 @[ -z "$(Q)" ] || echo 'HCC $<'
170 $(Q) $(HOSTCC) -o $@ $<
171 error2.h: $(hostbin_dir)/error2
172 @[ -z "$(Q)" ] || echo 'ER2 $<'
173 @echo "$(object_executable_matrix)" | $< > $@
174 $(object_dir)/crypt.o: crypt.c | $(object_dir)
175 @[ -z "$(Q)" ] || echo 'CC $<'
176 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @openssl_cppflags@ $<
177 $(object_dir)/spx_common.o: spx_common.c | $(object_dir)
178 @[ -z "$(Q)" ] || echo 'CC $<'
179 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(speex_cppflags) @ogg_cppflags@ $<
180
181 $(object_dir)/spxdec_filter.o: spxdec_filter.c | $(object_dir)
182 @[ -z "$(Q)" ] || echo 'CC $<'
183 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(speex_cppflags) @ogg_cppflags@ $<
184
185 $(object_dir)/spx_afh.o: spx_afh.c | $(object_dir)
186 @[ -z "$(Q)" ] || echo 'CC $<'
187 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $(speex_cppflags) @ogg_cppflags@ $<
188
189 $(object_dir)/oggdec_filter.o: oggdec_filter.c | $(object_dir)
190 @[ -z "$(Q)" ] || echo 'CC $<'
191 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
192
193 $(object_dir)/ogg_afh.o: ogg_afh.c | $(object_dir)
194 @[ -z "$(Q)" ] || echo 'CC $<'
195 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
196
197 $(object_dir)/ogg_afh_common.o: ogg_afh_common.c | $(object_dir)
198 @[ -z "$(Q)" ] || echo 'CC $<'
199 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
200
201 $(object_dir)/mp3dec_filter.o: mp3dec_filter.c | $(object_dir)
202 @[ -z "$(Q)" ] || echo 'CC $<'
203 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
204
205 $(object_dir)/compress_filter.o: compress_filter.c | $(object_dir)
206 @[ -z "$(Q)" ] || echo 'CC $<'
207 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) -O3 $<
208
209 $(object_dir)/aacdec_filter.o: aacdec_filter.c | $(object_dir)
210 @[ -z "$(Q)" ] || echo 'CC $<'
211 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
212
213 $(object_dir)/aac_common.o: aac_common.c | $(object_dir)
214 @[ -z "$(Q)" ] || echo 'CC $<'
215 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
216
217 $(object_dir)/aac_afh.o: aac_afh.c | $(object_dir)
218 @[ -z "$(Q)" ] || echo 'CC $<'
219 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
220
221 $(object_dir)/opus%.o: CPPFLAGS += $(opus_cppflags)
222 $(object_dir)/mp3_afh.o: CPPFLAGS += @id3tag_cppflags@
223 $(object_dir)/mp3_afh.o: mp3_afh.c | $(object_dir)
224
225 $(object_dir)/gui%.o: gui%.c | $(object_dir)
226 @[ -z "$(Q)" ] || echo 'CC $<'
227 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @curses_cppflags@ $<
228 $(object_dir)/ao_write.o: ao_write.c | $(object_dir)
229 @[ -z "$(Q)" ] || echo 'CC $<'
230 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ao_cppflags@ $<
231
232 $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h | $(object_dir)
233 @[ -z "$(Q)" ] || echo 'CC $<'
234 $(Q) $(CC) -c $(CPPFLAGS) -Wno-unused-function -o $@ $<
235
236 $(object_dir)/%.o: %.c | $(object_dir)
237 @[ -z "$(Q)" ] || echo 'CC $<'
238 $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
239
240 $(dep_dir)/%.cmdline.d: $(cmdline_dir)/%.cmdline.c | $(dep_dir)
241 @[ -z "$(Q)" ] || echo 'DEP $<'
242 $(Q) ./depend.sh $(dep_dir) $(object_dir) $(cmdline_dir) \
243 $(CPPFLAGS) $< > $@
244
245 $(dep_dir)/%.d: %.c | $(dep_dir)
246 @[ -z "$(Q)" ] || echo 'DEP $<'
247 $(Q) ./depend.sh $(dep_dir) $(object_dir) $(cmdline_dir) \
248 $(CPPFLAGS) $< > $@
249
250 # sort removes duplicate words, which is all we need here
251 all_objs := $(sort @recv_objs@ @filter_objs@ @client_objs@ @gui_objs@ \
252 @audiod_objs@ @audioc_objs@ @fade_objs@ @server_objs@ \
253 @write_objs@ @afh_objs@ @play_objs@)
254 deps := $(addprefix $(dep_dir)/, $(all_objs:.o=.d))
255 m4_deps := $(addprefix $(m4depdir)/, $(addsuffix .m4d, @executables@))
256
257 recv_objs := $(addprefix $(object_dir)/, @recv_objs@)
258 filter_objs := $(addprefix $(object_dir)/, @filter_objs@)
259 client_objs := $(addprefix $(object_dir)/, @client_objs@)
260 gui_objs := $(addprefix $(object_dir)/, @gui_objs@)
261 audiod_objs := $(addprefix $(object_dir)/, @audiod_objs@)
262 audioc_objs := $(addprefix $(object_dir)/, @audioc_objs@)
263 fade_objs := $(addprefix $(object_dir)/, @fade_objs@)
264 server_objs := $(addprefix $(object_dir)/, @server_objs@)
265 write_objs := $(addprefix $(object_dir)/, @write_objs@)
266 afh_objs := $(addprefix $(object_dir)/, @afh_objs@)
267 play_objs := $(addprefix $(object_dir)/, @play_objs@)
268
269 ifeq ($(findstring clean, $(MAKECMDGOALS)),)
270 -include $(deps)
271 -include $(m4_deps)
272 endif
273
274 para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags)
275 para_write para_play para_audiod: LDFLAGS += $(ao_ldflags)
276 para_client para_audioc para_play : LDFLAGS += $(readline_ldflags)
277 para_server: LDFLAGS += $(osl_ldflags)
278
279 para_server \
280 para_client \
281 para_audiod \
282 :LDFLAGS += \
283 $(openssl_ldflags) \
284 $(gcrypt_ldflags)
285
286 para_audiod \
287 para_filter \
288 para_play \
289 : LDFLAGS += \
290 $(mad_ldflags) \
291 $(samplerate_ldflags)
292
293 para_write \
294 para_play \
295 para_audiod \
296 para_fade \
297 : LDFLAGS += \
298 $(oss_ldflags) \
299 $(alsa_ldflags)
300
301 para_server \
302 para_filter \
303 para_audiod \
304 para_play \
305 para_afh \
306 para_recv \
307 : LDFLAGS += \
308 $(ogg_ldflags) \
309 $(vorbis_ldflags) \
310 $(speex_ldflags) \
311 $(opus_ldflags) \
312 $(faad_ldflags) \
313 $(flac_ldflags)
314
315 para_recv: $(recv_objs)
316 @[ -z "$(Q)" ] || echo 'LD $@'
317 $(Q) $(CC) $(recv_objs) -o $@ @recv_ldflags@ $(LDFLAGS)
318
319 para_filter: $(filter_objs)
320 @[ -z "$(Q)" ] || echo 'LD $@'
321 $(Q) $(CC) $(filter_objs) -o $@ @filter_ldflags@ $(LDFLAGS)
322
323 para_client: $(client_objs)
324 @[ -z "$(Q)" ] || echo 'LD $@'
325 $(Q) $(CC) -o $@ $(client_objs) @client_ldflags@ $(LDFLAGS)
326
327 para_gui: $(gui_objs)
328 @[ -z "$(Q)" ] || echo 'LD $@'
329 $(Q) $(CC) -o $@ $(gui_objs) @curses_ldflags@ $(LDFLAGS)
330
331 para_audiod: $(audiod_objs)
332 @[ -z "$(Q)" ] || echo 'LD $@'
333 $(Q) $(CC) -o $@ $(audiod_objs) @audiod_ldflags@ $(LDFLAGS)
334
335 para_audioc: $(audioc_objs)
336 @[ -z "$(Q)" ] || echo 'LD $@'
337 $(Q) $(CC) -o $@ $(audioc_objs) @audioc_ldflags@ $(LDFLAGS)
338
339 para_fade: $(fade_objs)
340 @[ -z "$(Q)" ] || echo 'LD $@'
341 $(Q) $(CC) -o $@ $(fade_objs) @fade_ldflags@ $(LDFLAGS)
342
343 para_server: $(server_objs)
344 @[ -z "$(Q)" ] || echo 'LD $@'
345 $(Q) $(CC) -o $@ $(server_objs) @server_ldflags@ $(LDFLAGS)
346
347 para_write: $(write_objs)
348 @[ -z "$(Q)" ] || echo 'LD $@'
349 $(Q) $(CC) -o $@ $(write_objs) @write_ldflags@ $(LDFLAGS)
350
351 para_afh: $(afh_objs)
352 @[ -z "$(Q)" ] || echo 'LD $@'
353 $(Q) $(CC) -o $@ $(afh_objs) @afh_ldflags@ $(LDFLAGS)
354
355 para_play: $(play_objs)
356 @[ -z "$(Q)" ] || echo 'LD $@'
357 $(Q) $(CC) -o $@ $(play_objs) @play_ldflags@ $(LDFLAGS)
358
359 clean:
360 @[ -z "$(Q)" ] || echo 'CLEAN'
361 $(Q) rm -f $(executables)
362 $(Q) rm -rf $(object_dir)
363
364 clean2: clean
365 @[ -z "$(Q)" ] || echo 'CLEAN2'
366 $(Q) rm -f *_command_list.* *_completion.h
367 $(Q) rm -rf $(build_dir)
368 distclean: clean2 test-clean
369 @[ -z "$(Q)" ] || echo 'DISTCLEAN'
370 $(Q) rm -f Makefile autoscan.log config.status config.log
371 $(Q) rm -rf autom4te.cache
372 $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
373
374 maintainer-clean: distclean
375 rm -f *.tar.bz2 config.h configure config.h.in
376 rm -rf web_sync
377
378 install: all man
379 $(MKDIR_P) $(BINDIR) $(MANDIR)
380 $(INSTALL) -s --strip-program $(STRIP) -m 755 $(executables) $(BINDIR)
381 $(INSTALL) -m 644 $(man_pages) $(MANDIR)
382 $(MKDIR_P) $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
383
384 $(tarball):
385 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
386 git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
387 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
388 $(MKDIR_P) $(tarball_pfx)
389 ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION
390 cp -r $(autocrap) $(tarball_pfx)
391 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
392 bzip2 -9 $(tarball_pfx).tar
393 ls -l $(tarball_pfx).tar.bz2
394 rm -rf $(tarball_pfx)
395 include $(test_dir)/makefile.test