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