mysql_selector.c: Fix mbox command
[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 = inductive resonance
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.5
24 # DEBUG_CPPFLAGS += -Wextra
25
26 CPPFLAGS += -Os
27 CPPFLAGS += -Wall
28 CPPFLAGS += -Wuninitialized
29 CPPFLAGS += -Wstrict-prototypes
30 CPPFLAGS += -Wchar-subscripts
31 CPPFLAGS += -Wformat-security
32 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
33 CPPFLAGS += -DFONTDIR='"$(PKGDATADIR)/fonts"'
34 CPPFLAGS += -DPICDIR='"$(PKGDATADIR)/pics"'
35 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
36 CPPFLAGS += -DSYSTEM='"$(system)"'
37 CPPFLAGS += -DCODENAME='"$(codename)"'
38 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
39 CPPFLAGS += -Werror-implicit-function-declaration
40 CPPFLAGS += -Wmissing-format-attribute
41 CPPFLAGS += -Wunused-macros
42 CPPFLAGS += -Wshadow
43
44 BINARIES = para_server para_client para_gui para_audioc para_recv \
45         para_filter para_write @extra_binaries@
46 man_binaries := para_server para_client para_gui para_audioc para_recv \
47         para_filter para_write  para_fade para_sdl_gui para_audiod
48 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
49 man_pages_html := $(patsubst %, man/html/%.html, $(man_binaries))
50 FONTS := $(wildcard fonts/*.png)
51 PICS := $(wildcard pics/paraslash/*.jpg)
52 gengetopts := $(wildcard *.ggo)
53 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
54 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
55 all_c_files := $(wildcard *.c)
56 c_sources := $(filter-out $(gengetopts_c), $(all_c_files))
57 grutatxt := COPYING NEWS README.mysql CREDITS INSTALL README FEATURES GPL
58 grutatxt_html := $(grutatxt:=.html)
59 html_in := $(wildcard web/*.in.html)
60 gen_html := $(subst web/,web/sync/,$(html_in))
61 gen_html := $(gen_html:.in.html=.html)
62 gruta_in := $(grutatxt:=.in.html)
63 gruta_in := $(patsubst %,web/%,$(gruta_in))
64 gruta_html := $(grutatxt:=.html)
65 gruta_html := $(patsubst %,web/sync/%,$(gruta_html))
66 shots := gui-2005-11-12.png para_audiod-startup.txt para_krell-2005-02.png \
67         para_server-startup.txt para_slider-2004-12.png sdl_gui.jpg \
68         para_krell-2005-02.png
69 shots := $(patsubst %,web/sync/%,$(shots))
70 web_pics := web/sync/paraslash.png web/sync/paraslash.ico
71 web_misc := overview.pdf versions/paraslash-git.tar.bz2 PUBLIC_KEY \
72         key.anonymous para.css
73 web_misc := $(patsubst %,web/sync/%,$(web_misc))
74 web_man := web/sync/man
75 autocrap := config.h.in configure
76 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
77 tarball_delete = web versions pics/screenshots pics/web .changelog_before_cvs \
78         .changelog_cvs
79 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
80 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
81
82 .PHONY: clean distclean maintainer-clean install html www tags doxygen gruta \
83         man html_man
84 all: $(BINARIES)
85 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) $(web_man) \
86         tags doxygen
87 gruta: $(gen_html) $(gruta_html)
88 man: $(man_pages)
89 html_man: $(man_pages_html)
90
91 sdl_gui_objs = sdl_gui.cmdline.o SFont.o sdl_gui.o gui_common.o exec.o \
92         close_on_fork.o string.o stat.o fd.o
93 dbadm_objs = dbadm.o exec.o close_on_fork.o string.o
94 fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
95 krell_objs = krell.o string.o
96 slider_objs = slider.o string.o
97
98 *.o: para.h config.h gcc-compat.h
99
100 include Makefile.deps
101
102 module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
103
104 grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
105         gengetopt $(module_ggo_opts) \
106                 -S \
107                 --set-package=grab \
108                 --no-handle-help \
109                 --no-handle-error \
110                 --no-handle-version \
111                 --arg-struct-name=grab_client_args_info \
112                 --file-name=$(subst .ggo,,$<).cmdline \
113                 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
114
115 %_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
116         gengetopt $(module_ggo_opts) \
117                 --set-package=$(subst .ggo,,$<) \
118                 --arg-struct-name=$(subst .ggo,,$<)_args_info \
119                 --file-name=$(subst .ggo,,$<).cmdline \
120                 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
121
122 %_filter.cmdline.h %_filter.cmdline.c: %_filter.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 _filter.ggo,,$<)_cmdline_parser < $<
128 %_write.cmdline.h %_write.cmdline.c: %_write.ggo
129         gengetopt -S $(module_ggo_opts) \
130                 --set-package=$(subst .ggo,,$<) \
131                 --arg-struct-name=$(subst .ggo,,$<)_args_info \
132                 --file-name=$(subst .ggo,,$<).cmdline \
133                 --func-name $(subst _write.ggo,,$<)_cmdline_parser < $<
134
135 %.cmdline.h %.cmdline.c: %.ggo
136         case $< in client.ggo) O="--unamed-opts=command";; \
137                 audioc.ggo) O="--unamed-opts=command";; \
138         esac; \
139         gengetopt $$O \
140                 --no-handle-version \
141                 --conf-parser \
142                 --file-name=$(*F).cmdline \
143                 --func-name $(*F)_cmdline_parser \
144                 --arg-struct-name=$(*F)_args_info \
145                 --set-package="para_$(subst .cmdline,,$(*F))" \
146                 --set-version="@PACKAGE_VERSION@"  < $<
147
148 %_command_list.c %_command_list.h: %.cmd
149         ./command_util.sh c < $< >$@
150         ./command_util.sh h < $< >$(@:%.c=%.h)
151
152 %_command_list.man: %.cmd
153         ./command_util.sh man < $< > $@
154
155 server_command_lists = server_command_list.man random_selector_command_list.man \
156         playlist_selector_command_list.man mysql_selector_command_list.man
157 man/man1/para_server.1: para_server $(server_command_lists)
158         mkdir -p man/man1
159         opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
160         help2man $$opts ./para_server > $@
161
162 man/man1/para_audiod.1: para_audiod audiod_command_list.man
163         mkdir -p man/man1
164         help2man -N -i audiod_command_list.man ./para_audiod > $@
165
166 man/man1/%.1: %
167         mkdir -p man/man1
168         help2man -N ./$< > $@
169
170 man/html/%.html: man/man1/%.1
171         mkdir -p man/html
172         man2html $< > $@
173
174
175
176 ortp_recv.o: ortp_recv.c
177         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
178
179 ortp_send.o: ortp_send.c
180         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
181
182 oggdec.o: oggdec.c
183         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
184 ogg_afh.o: ogg_afh.c
185         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
186
187 mp3dec.o: mp3dec.c
188         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
189
190 aacdec.o: aacdec.c
191         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
192
193 aac_common.o: aac_common.c
194         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
195
196 aac_afh.o: aac_afh.c
197         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
198
199 slider.o: slider.c
200         $(CC) -c -Wall -o $@ -g @GLIB_CFLAGS@  @GTK_CFLAGS@ $<
201
202 krell.o: krell.c
203         $(CC) -Wall -O -g -fPIC @GTK_CFLAGS@ -c -o $@ krell.c
204
205 mysql_selector.o: mysql_selector.c
206         $(CC) -c $(DEBUG_CPPFLAGS) -Wall -O -g @mysql_cppflags@ $<
207
208 %.cmdline.o: %.cmdline.c
209         $(CC) -c $(CPPFLAGS) $<
210 %.o: %.c
211         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
212
213 para_recv: @recv_objs@
214         $(CC) @recv_objs@ -o $@ @recv_ldflags@
215
216 para_filter: @filter_objs@
217         $(CC) @filter_objs@ -o $@ @filter_ldflags@
218
219 para_slider: $(slider_objs)
220         $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
221
222 para_client: @client_objs@
223         $(CC) -o $@ @client_objs@ @client_ldflags@
224
225 para_gui: @gui_objs@
226         $(CC) -o $@ @gui_objs@ -lncurses
227
228 para_audiod: @audiod_objs@
229         $(CC) -o $@ @audiod_objs@ @audiod_ldflags@
230
231 para_audioc: @audioc_objs@
232         $(CC) -o $@ @audioc_objs@
233
234 para_dbadm: $(dbadm_objs)
235         $(CC) -o $@ $(dbadm_objs) -lncurses -lmenu
236
237 para_fade: $(fade_objs)
238         $(CC) -o $@ $(fade_objs)
239
240 para_server: @server_objs@
241         $(CC) -o $@ @server_objs@  @server_ldflags@
242
243 para_sdl_gui: $(sdl_gui_objs)
244         $(CC) -o $@ $(sdl_gui_objs) -lSDL_image
245
246 para_write: @write_objs@
247         $(CC) -o $@ @write_objs@ @write_ldflags@
248
249 para_krell.so: $(krell_objs)
250         $(CC) -Wall -fPIC @GTK_CFLAGS@ krell.o -o $@ @GTK_LIBS@ -shared
251
252 clean:
253         rm -f *.o $(BINARIES)
254 distclean: clean
255         rm -f Makefile autoscan.log config.status config.log && \
256         rm -rf web/sync/* autom4te.cache aclocal.m4
257         rm -f GPATH GRTAGS GSYMS GTAGS
258
259 maintainer-clean: distclean
260         rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
261                 $(grutatxt_html) config.h configure \
262                 config.h.in skencil/*.pdf skencil/*.ps
263         rm -f *_command_list.* *.man man/man1/* man/html/*
264
265
266 install: all
267         mkdir -p $(BINDIR) $(FONTDIR) $(PICDIR) $(MANDIR) $(VARDIR)
268         $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
269         $(install_sh) -m 644 $(FONTS) $(FONTDIR)
270         $(install_sh) -m 644 $(PICS) $(PICDIR)
271         $(install_sh) -m 644 $(man_pages) $(MANDIR)
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/paraslash-git.tar.bz2: paraslash-git.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 - - < $< > $@