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