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