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