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