add -Wbad-function-cast to +CPPFLAGS and fix two compiler warnings
[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 FONTDIR = $(PKGDATADIR)/fonts
8 PICDIR = $(PKGDATADIR)/pics
9 MANDIR = @datarootdir@/man/man1
10
11 install_sh = @install_sh@
12
13 build_date = $(shell date)
14 system = $(shell uname -rs)
15 cc_version = $(shell $(CC) --version | head -n 1)
16 codename = isotropic threshold
17
18 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
19 DEBUG_CPPFLAGS += -Wredundant-decls
20 # produces false positives
21 # DEBUG_CPPFLAGS += -Wunreachable-code
22 # DEBUG_CPPFLAGS += -Wwrite-strings
23 # invalid option for gcc-3.3.3
24 # DEBUG_CPPFLAGS += -Wextra
25 # DEBUG_CPPFLAGS += -Wold-style-definition
26
27 CPPFLAGS += -Os
28 CPPFLAGS += -Wall
29 CPPFLAGS += -Wuninitialized
30 CPPFLAGS += -Wstrict-prototypes
31 CPPFLAGS += -Wchar-subscripts
32 CPPFLAGS += -Wformat-security
33 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
34 CPPFLAGS += -DFONTDIR='"$(PKGDATADIR)/fonts"'
35 CPPFLAGS += -DPICDIR='"$(PKGDATADIR)/pics"'
36 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
37 CPPFLAGS += -DSYSTEM='"$(system)"'
38 CPPFLAGS += -DCODENAME='"$(codename)"'
39 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
40 CPPFLAGS += -Werror-implicit-function-declaration
41 CPPFLAGS += -Wmissing-format-attribute
42 CPPFLAGS += -Wunused-macros
43 CPPFLAGS += -Wshadow
44 CPPFLAGS += -Wbad-function-cast
45
46 BINARIES = para_server para_client para_gui para_audioc para_recv \
47 para_filter para_write @extra_binaries@
48 man_binaries := $(filter-out para_dbadm para_slider para_krell.so, $(BINARIES))
49 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
50 man_pages_html := $(patsubst %, man/html/%.html, $(man_binaries))
51 FONTS := $(wildcard fonts/*.png)
52 PICS := $(wildcard pics/paraslash/*.jpg)
53 gengetopts := $(wildcard *.ggo)
54 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
55 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
56 grutatxt := COPYING NEWS README.mysql CREDITS INSTALL README FEATURES GPL
57 grutatxt_html := $(grutatxt:=.html)
58 html_in := $(wildcard web/*.in.html)
59 gen_html := $(subst web/,web/sync/,$(html_in))
60 gen_html := $(gen_html:.in.html=.html)
61 gruta_in := $(grutatxt:=.in.html)
62 gruta_in := $(patsubst %,web/%,$(gruta_in))
63 gruta_html := $(grutatxt:=.html)
64 gruta_html := $(patsubst %,web/sync/%,$(gruta_html))
65 shots := gui-2005-11-12.png para_audiod-startup.txt para_krell-2005-02.png \
66 para_server-startup.txt para_slider-2004-12.png sdl_gui.jpg \
67 para_krell-2005-02.png
68 shots := $(patsubst %,web/sync/%,$(shots))
69 web_pics := web/sync/paraslash.png web/sync/paraslash.ico
70 web_misc := overview.pdf versions/@PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2 PUBLIC_KEY \
71 key.anonymous para.css
72 web_misc := $(patsubst %,web/sync/%,$(web_misc))
73 web_man := web/sync/man
74 autocrap := config.h.in configure
75 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
76 tarball_delete = web versions pics/screenshots pics/web .changelog_before_cvs \
77 .changelog_cvs
78 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
79 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
80
81 .PHONY: clean distclean maintainer-clean install html www tags doxygen gruta \
82 man html_man
83 all: $(BINARIES)
84 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) $(web_man) \
85 tags doxygen
86 gruta: $(gen_html) $(gruta_html)
87 man: $(man_pages)
88 html_man: $(man_pages_html)
89
90 sdl_gui_objs = sdl_gui.cmdline.o SFont.o sdl_gui.o gui_common.o exec.o \
91 close_on_fork.o string.o stat.o fd.o
92 dbadm_objs = dbadm.o exec.o close_on_fork.o string.o
93 fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
94 krell_objs = krell.o string.o
95 slider_objs = slider.o string.o
96
97 *.o: para.h config.h gcc-compat.h
98
99 include Makefile.deps
100
101 module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
102
103 grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
104 gengetopt $(module_ggo_opts) \
105 -S \
106 --set-package=grab \
107 --no-handle-help \
108 --no-handle-error \
109 --no-handle-version \
110 --arg-struct-name=grab_client_args_info \
111 --file-name=$(subst .ggo,,$<).cmdline \
112 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
113
114 %_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
115 gengetopt $(module_ggo_opts) \
116 --set-package=$(subst .ggo,,$<) \
117 --arg-struct-name=$(subst .ggo,,$<)_args_info \
118 --file-name=$(subst .ggo,,$<).cmdline \
119 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
120
121 %_filter.cmdline.h %_filter.cmdline.c: %_filter.ggo
122 gengetopt $(module_ggo_opts) \
123 --set-package=$(subst .ggo,,$<) \
124 --arg-struct-name=$(subst .ggo,,$<)_args_info \
125 --file-name=$(subst .ggo,,$<).cmdline \
126 --func-name $(subst _filter.ggo,,$<)_cmdline_parser < $<
127 %_write.cmdline.h %_write.cmdline.c: %_write.ggo
128 gengetopt -S $(module_ggo_opts) \
129 --set-package=$(subst .ggo,,$<) \
130 --arg-struct-name=$(subst .ggo,,$<)_args_info \
131 --file-name=$(subst .ggo,,$<).cmdline \
132 --func-name $(subst _write.ggo,,$<)_cmdline_parser < $<
133
134 %.cmdline.h %.cmdline.c: %.ggo
135 case $< in client.ggo) O="--unamed-opts=command";; \
136 audioc.ggo) O="--unamed-opts=command";; \
137 esac; \
138 gengetopt $$O \
139 --no-handle-version \
140 --conf-parser \
141 --file-name=$(*F).cmdline \
142 --func-name $(*F)_cmdline_parser \
143 --arg-struct-name=$(*F)_args_info \
144 --set-package="para_$(subst .cmdline,,$(*F))" \
145 --set-version="@PACKAGE_VERSION@" < $<
146
147 %_command_list.c %_command_list.h: %.cmd
148 ./command_util.sh c < $< >$@
149 ./command_util.sh h < $< >$(@:%.c=%.h)
150
151 %_command_list.man: %.cmd
152 ./command_util.sh man < $< > $@
153
154 server_command_lists = server_command_list.man random_selector_command_list.man \
155 playlist_selector_command_list.man mysql_selector_command_list.man
156 man/man1/para_server.1: para_server $(server_command_lists)
157 mkdir -p man/man1
158 opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
159 help2man $$opts ./para_server > $@
160
161 man/man1/para_audiod.1: para_audiod audiod_command_list.man
162 mkdir -p man/man1
163 help2man -N -i audiod_command_list.man ./para_audiod > $@
164
165 man/man1/%.1: %
166 mkdir -p man/man1
167 help2man -N ./$< > $@
168
169 man/html/%.html: man/man1/%.1
170 mkdir -p man/html
171 man2html $< > $@
172
173
174
175 ortp_recv.o: ortp_recv.c
176 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
177
178 ortp_send.o: ortp_send.c
179 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
180
181 oggdec.o: oggdec.c
182 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
183 ogg_afh.o: ogg_afh.c
184 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
185
186 mp3dec.o: mp3dec.c
187 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
188
189 aacdec.o: aacdec.c
190 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
191
192 aac_common.o: aac_common.c
193 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
194
195 aac_afh.o: aac_afh.c
196 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
197
198 slider.o: slider.c
199 $(CC) -c -Wall -o $@ -g @GLIB_CFLAGS@ @GTK_CFLAGS@ $<
200
201 krell.o: krell.c
202 $(CC) -Wall -O -g -fPIC @GTK_CFLAGS@ -c -o $@ krell.c
203
204 mysql_selector.o: mysql_selector.c
205 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mysql_cppflags@ $<
206
207 %.cmdline.o: %.cmdline.c
208 $(CC) -c $(CPPFLAGS) $<
209 %.o: %.c
210 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
211
212 para_recv: @recv_objs@
213 $(CC) @recv_objs@ -o $@ @recv_ldflags@
214
215 para_filter: @filter_objs@
216 $(CC) @filter_objs@ -o $@ @filter_ldflags@
217
218 para_slider: $(slider_objs)
219 $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
220
221 para_client: @client_objs@
222 $(CC) -o $@ @client_objs@ @client_ldflags@
223
224 para_gui: @gui_objs@
225 $(CC) -o $@ @gui_objs@ -lncurses
226
227 para_audiod: @audiod_objs@
228 $(CC) -o $@ @audiod_objs@ @audiod_ldflags@
229
230 para_audioc: @audioc_objs@
231 $(CC) -o $@ @audioc_objs@
232
233 para_dbadm: $(dbadm_objs)
234 $(CC) -o $@ $(dbadm_objs) -lncurses -lmenu
235
236 para_fade: $(fade_objs)
237 $(CC) -o $@ $(fade_objs)
238
239 para_server: @server_objs@
240 $(CC) -o $@ @server_objs@ @server_ldflags@
241
242 para_sdl_gui: $(sdl_gui_objs)
243 $(CC) -o $@ $(sdl_gui_objs) -lSDL_image
244
245 para_write: @write_objs@
246 $(CC) -o $@ @write_objs@ @write_ldflags@
247
248 para_krell.so: $(krell_objs)
249 $(CC) -Wall -fPIC @GTK_CFLAGS@ krell.o -o $@ @GTK_LIBS@ -shared
250
251 clean:
252 rm -f *.o $(BINARIES)
253 distclean: clean
254 rm -f Makefile autoscan.log config.status config.log && \
255 rm -rf web/sync/* autom4te.cache aclocal.m4
256 rm -f GPATH GRTAGS GSYMS GTAGS
257
258 maintainer-clean: distclean
259 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
260 $(grutatxt_html) config.h configure \
261 config.h.in skencil/*.pdf skencil/*.ps
262 rm -f *_command_list.* *.man man/man1/* man/html/*
263
264
265 install: all man
266 mkdir -p $(BINDIR) $(FONTDIR) $(PICDIR) $(MANDIR)
267 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
268 $(install_sh) -m 644 $(FONTS) $(FONTDIR)
269 $(install_sh) -m 644 $(PICS) $(PICDIR)
270 $(install_sh) -m 644 $(man_pages) $(MANDIR)
271 mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
272
273 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) $(man_pages)
274 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
275 git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
276 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
277 mkdir $(tarball_pfx)
278 cp -r $(tarball_add) $(tarball_pfx)
279 mkdir -p $(tarball_pfx)/man/man1
280 cp -r $(man_pages) $(tarball_pfx)/man/man1
281 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
282 rm -rf $(tarball_pfx)
283 bzip2 -9 $(tarball_pfx).tar
284 rm -f $(tarball_pfx).tar
285 ls -l $(tarball_pfx).tar.bz2
286
287 web/%.in.html: %
288 grutatxt -nb < $< > $@
289 tags:
290 rm -rf web/sync/HTML && gtags && htags -nF && mv HTML web/sync
291 web/header2.html: web/header.html
292 sed -e 's|href="|href="\.\.\/\.\./|g' \
293 -e 's|SRC="|SRC="\.\.\/\.\./|g' $< > $@
294 doxygen: web/header2.html
295 mkdir -p web/sync/doxygen
296 doxygen
297 web/sync/man: html_man
298 mkdir -p $@
299 cp -a $(man_pages_html) $@
300 web/sync/%.html: web/%.in.html web/header.html web/footer.html web/sync
301 cat web/header.html $< web/footer.html > $@
302 web/sync/%.png: pics/web/%.png web/sync
303 cp $< $@
304 web/sync/%.ico: pics/web/%.ico web/sync
305 cp $< $@
306 web/sync/para.css: web/para.css web/sync
307 cp $< $@
308 web/sync/versions/@PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2 web/sync
309 cp -a versions web/sync && cp $< $@
310 web/sync/overview.pdf: skencil/overview.pdf web/sync
311 cp $< $@
312 web/sync/%: %
313 cp -a $< $@
314 web/sync/%: pics/screenshots/%
315 cp $< $@
316 skencil/%.ps: skencil/%.sk
317 sk2ps $< > $@
318 %.pdf: %.ps
319 ps2pdf - - < $< > $@