Merge commit 'meins/master'
[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
9 install_sh := @install_sh@
10
11 build_date := $(shell date)
12 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
13 uname_rs := $(shell uname -rs)
14 cc_version := $(shell $(CC) --version | head -n 1)
15 codename := elliptic inheritance
16
17 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
18 DEBUG_CPPFLAGS += -Wredundant-decls
19 # produces false positives
20 # DEBUG_CPPFLAGS += -Wunreachable-code
21 # DEBUG_CPPFLAGS += -Wwrite-strings
22
23 # invalid option for gcc-3.3.3
24 # DEBUG_CPPFLAGS += -Wextra
25 # DEBUG_CPPFLAGS += -Wold-style-definition
26 # DEBUG_CPPFLAGS += -Wdeclaration-after-statement
27
28 # many warnings about trivial stuff
29 # CPPFLAGS += -Wconversion
30
31 ifeq ($(uname_s),Linux)
32 CPPFLAGS += -fdata-sections -ffunction-sections
33 LDFLAGS += -Wl,--gc-sections
34 CPPFLAGS += -Wstrict-prototypes
35 CPPFLAGS += -Wshadow
36 endif
37 CPPFLAGS += -Os
38 CPPFLAGS += -Wall
39 CPPFLAGS += -Wuninitialized
40 CPPFLAGS += -Wchar-subscripts
41 CPPFLAGS += -Wformat-security
42 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
43 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
44 CPPFLAGS += -DUNAME_RS='"$(uname_rs)"'
45 CPPFLAGS += -DCODENAME='"$(codename)"'
46 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
47 CPPFLAGS += -Werror-implicit-function-declaration
48 CPPFLAGS += -Wmissing-format-attribute
49 CPPFLAGS += -Wmissing-noreturn
50 CPPFLAGS += -Wunused-macros
51 CPPFLAGS += -Wbad-function-cast
52 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
53 CPPFLAGS += @SSL_CPPFLAGS@
54 CPPFLAGS += @ncurses_cppflags@
55 CPPFLAGS += @arch_cppflags@
56
57 BINARIES = para_server para_client para_audioc para_recv \
58 para_filter para_write para_fsck para_afh @extra_binaries@
59 man_binaries := $(BINARIES)
60 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
61 man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
62 gengetopts := $(wildcard *.ggo)
63 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
64 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
65 autocrap := config.h.in configure
66 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
67 tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
68 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
69 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
70 tarball := @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2
71
72 .PHONY: clean distclean maintainer-clean install man tarball
73 all: $(BINARIES) $(man_pages)
74 man: $(man_pages)
75 tarball: $(tarball)
76
77 *.o: para.h config.h gcc-compat.h
78
79 include Makefile.deps
80
81 module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
82
83 grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
84 gengetopt $(module_ggo_opts) \
85 -S \
86 --set-package=grab \
87 --no-handle-help \
88 --no-handle-error \
89 --no-handle-version \
90 --arg-struct-name=grab_client_args_info \
91 --file-name=$(subst .ggo,,$<).cmdline \
92 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
93
94 %_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
95 gengetopt $(module_ggo_opts) \
96 --set-package=$(subst .ggo,,$<) \
97 --arg-struct-name=$(subst .ggo,,$<)_args_info \
98 --file-name=$(subst .ggo,,$<).cmdline \
99 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
100
101 %_filter.cmdline.h %_filter.cmdline.c: %_filter.ggo
102 gengetopt $(module_ggo_opts) \
103 --set-package=$(subst .ggo,,$<) \
104 --arg-struct-name=$(subst .ggo,,$<)_args_info \
105 --file-name=$(subst .ggo,,$<).cmdline \
106 --func-name $(subst _filter.ggo,,$<)_cmdline_parser < $<
107 %_write.cmdline.h %_write.cmdline.c: %_write.ggo
108 gengetopt -S $(module_ggo_opts) \
109 --set-package=$(subst .ggo,,$<) \
110 --arg-struct-name=$(subst .ggo,,$<)_args_info \
111 --file-name=$(subst .ggo,,$<).cmdline \
112 --func-name $(subst _write.ggo,,$<)_cmdline_parser < $<
113
114 %.cmdline.h %.cmdline.c: %.ggo
115 case $< in client.ggo) O="--unamed-opts=command";; \
116 audioc.ggo) O="--unamed-opts=command";; \
117 fsck.ggo) O="--unamed-opts=table";; \
118 afh.ggo) O="--unamed-opts=audio_file";; \
119 recv.ggo) O="--no-handle-help";; \
120 filter.ggo) O="--no-handle-help";; \
121 write.ggo) O="--no-handle-help";; \
122 audiod.ggo) O="--no-handle-help";; \
123 esac; \
124 if test $< != fsck.ggo; then O="$$O --conf-parser "; fi; \
125 gengetopt $$O \
126 --no-handle-version \
127 --file-name=$(*F).cmdline \
128 --func-name $(*F)_cmdline_parser \
129 --arg-struct-name=$(*F)_args_info \
130 --set-package="para_$(subst .cmdline,,$(*F))" \
131 --set-version="@PACKAGE_VERSION@" < $<
132
133 %_command_list.c %_command_list.h: %.cmd
134 ./command_util.sh c < $< >$@
135 ./command_util.sh h < $< >$(@:%.c=%.h)
136
137 %_command_list.man: %.cmd
138 ./command_util.sh man < $< > $@
139
140 server_command_lists = server_command_list.man afs_command_list.man
141 man/man1/para_server.1: para_server $(server_command_lists)
142 mkdir -p man/man1
143 opts="-h --detailed-help -N `for i in $(server_command_lists); do printf "%s\n" "-i $$i"; done`"; \
144 help2man $$opts ./para_server > $@
145
146 man/man1/para_audiod.1: para_audiod audiod_command_list.man
147 mkdir -p man/man1
148 help2man -h --detailed-help -N -i audiod_command_list.man ./para_audiod > $@
149
150 man/man1/para_filter.1: para_filter
151 mkdir -p man/man1
152 help2man -h --detailed-help -N ./$< > $@
153
154 man/man1/para_write.1: para_write
155 mkdir -p man/man1
156 help2man -h --detailed-help -N ./$< > $@
157
158 man/man1/para_recv.1: para_recv
159 mkdir -p man/man1
160 help2man -h --detailed-help -N ./$< > $@
161
162 man/man1/%.1: %
163 mkdir -p man/man1
164 help2man -N ./$< > $@
165
166 man/html/%.html: man/man1/%.1
167 mkdir -p man/html
168 man2html $< > $@
169
170 web/%.man.in.html: man/man1/%.1
171 man2html $< | sed -e '/^<\/BODY>/,$$d' -e '1,/<\/HEAD><BODY>/d' > $@
172
173
174 ortp_recv.o: ortp_recv.c
175 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
176
177 ortp_send.o: ortp_send.c
178 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
179
180 oggdec_filter.o: oggdec_filter.c
181 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
182 ogg_afh.o: ogg_afh.c
183 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
184
185 mp3dec_filter.o: mp3dec_filter.c
186 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
187
188 aacdec_filter.o: aacdec_filter.c
189 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
190
191 aac_common.o: aac_common.c
192 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
193
194 aac_afh.o: aac_afh.c
195 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
196
197 %.cmdline.o: %.cmdline.c
198 $(CC) -c $(CPPFLAGS) $<
199
200 %.o: %.c
201 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
202
203 para_recv: @recv_objs@
204 $(CC) $(LDFLAGS) @recv_objs@ -o $@ @recv_ldflags@
205
206 para_filter: @filter_objs@
207 $(CC) $(LDFLAGS) @filter_objs@ -o $@ @filter_ldflags@
208
209 para_client: @client_objs@
210 $(CC) $(LDFLAGS) -o $@ @client_objs@ @client_ldflags@
211
212 para_gui: @gui_objs@
213 $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses
214
215 para_audiod: @audiod_objs@
216 $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@
217
218 para_audioc: @audioc_objs@
219 $(CC) $(LDFLAGS) -o $@ @audioc_objs@ @audioc_ldflags@
220
221 para_fade: @fade_objs@
222 $(CC) $(LDFLAGS) -o $@ @fade_objs@
223
224 para_server: @server_objs@
225 $(CC) $(LDFLAGS) -o $@ @server_objs@ @server_ldflags@
226
227 para_fsck: @fsck_objs@
228 $(CC) $(LDFLAGS) -o $@ @fsck_objs@ @fsck_ldflags@
229
230 para_write: @write_objs@
231 $(CC) $(LDFLAGS) -o $@ @write_objs@ @write_ldflags@
232
233 para_afh: @afh_objs@
234 $(CC) $(LDFLAGS) -o $@ @afh_objs@ @afh_ldflags@
235
236 clean:
237 rm -f *.o $(BINARIES)
238 rm -rf man
239 distclean: clean
240 rm -f Makefile autoscan.log config.status config.log && \
241 rm -rf web/sync/* autom4te.cache aclocal.m4
242 rm -f GPATH GRTAGS GSYMS GTAGS
243
244 maintainer-clean: distclean
245 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
246 config.h configure \
247 config.h.in skencil/*.pdf skencil/*.ps
248 rm -f *_command_list.* *.man man/man1/*
249 rm -rf web_sync
250
251 install: all man
252 mkdir -p $(BINDIR) $(MANDIR)
253 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
254 $(install_sh) -m 644 $(man_pages) $(MANDIR)
255 mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
256
257 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add)
258 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
259 git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
260 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
261 mkdir $(tarball_pfx)
262 cp -r $(tarball_add) $(tarball_pfx)
263 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
264 rm -rf $(tarball_pfx)
265 bzip2 -9 $(tarball_pfx).tar
266 rm -f $(tarball_pfx).tar
267 ls -l $(tarball_pfx).tar.bz2
268 %.ps: %.sk
269 sk2ps $< > $@
270 %.pdf: %.ps
271 ps2pdf - - < $< > $@
272