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