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