Merge ../paraslash.fml/paraslash
[paraslash.git] / Makefile.in
1 COPYRIGHT = Copyright (c) 1997-2007 by Andre Noll
2 DISCLAIMER = This is free software with ABSOLUTELY NO WARRANTY. See COPYING for details.
3
4 prefix = @prefix@
5 exec_prefix = @exec_prefix@
6
7 BINDIR = @bindir@
8 VARDIR = /var/paraslash
9 PKGDATADIR = @datarootdir@/@PACKAGE_NAME@
10 FONTDIR = $(PKGDATADIR)/fonts
11 PICDIR = $(PKGDATADIR)/pics
12 MANDIR = @datarootdir@/man/man1
13
14 install_sh = @install_sh@
15
16 build_date = $(shell date)
17 system = $(shell uname -rs)
18 cc_version = $(shell $(CC) --version | head -n 1)
19 codename = inductive resonance
20
21 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
22 DEBUG_CPPFLAGS += -Wredundant-decls
23 # produces false positives
24 # DEBUG_CPPFLAGS += -Wunreachable-code
25 # DEBUG_CPPFLAGS += -Wwrite-strings
26 # invalid option for gcc-3.3.5
27 # DEBUG_CPPFLAGS += -Wextra
28
29 CPPFLAGS += -Os
30 CPPFLAGS += -Wall
31 CPPFLAGS += -Wuninitialized
32 CPPFLAGS += -Wstrict-prototypes
33 CPPFLAGS += -Wchar-subscripts
34 CPPFLAGS += -Wformat-security
35 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
36 CPPFLAGS += -DFONTDIR='"$(PKGDATADIR)/fonts"'
37 CPPFLAGS += -DPICDIR='"$(PKGDATADIR)/pics"'
38 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
39 CPPFLAGS += -DSYSTEM='"$(system)"'
40 CPPFLAGS += -DCODENAME='"$(codename)"'
41 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
42 CPPFLAGS += -Werror-implicit-function-declaration
43 CPPFLAGS += -Wmissing-format-attribute
44 CPPFLAGS += -Wunused-macros
45 CPPFLAGS += -Wshadow
46
47 BINARIES = para_server para_client para_gui para_audioc para_recv \
48 para_filter para_write @extra_binaries@
49 man_binaries := para_server para_client para_gui para_audioc para_recv \
50 para_filter para_write para_fade para_sdl_gui para_audiod
51 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
52 man_pages_html := $(patsubst %, man/html/%.html, $(man_binaries))
53 FONTS := $(wildcard fonts/*.png)
54 PICS := $(wildcard pics/paraslash/*.jpg)
55 gengetopts := $(wildcard *.ggo)
56 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
57 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
58 all_c_files := $(wildcard *.c)
59 c_sources := $(filter-out $(gengetopts_c), $(all_c_files))
60 grutatxt := COPYING NEWS README.mysql CREDITS INSTALL README FEATURES GPL
61 grutatxt_html := $(grutatxt:=.html)
62 html_in := $(wildcard web/*.in.html)
63 gen_html := $(subst web/,web/sync/,$(html_in))
64 gen_html := $(gen_html:.in.html=.html)
65 gruta_in := $(grutatxt:=.in.html)
66 gruta_in := $(patsubst %,web/%,$(gruta_in))
67 gruta_html := $(grutatxt:=.html)
68 gruta_html := $(patsubst %,web/sync/%,$(gruta_html))
69 shots := gui-2005-11-12.png para_audiod-startup.txt para_krell-2005-02.png \
70 para_server-startup.txt para_slider-2004-12.png sdl_gui.jpg \
71 para_krell-2005-02.png
72 shots := $(patsubst %,web/sync/%,$(shots))
73 web_pics := web/sync/paraslash.png web/sync/paraslash.ico
74 web_misc := overview.pdf versions/paraslash-git.tar.bz2 PUBLIC_KEY \
75 key.anonymous para.css
76 web_misc := $(patsubst %,web/sync/%,$(web_misc))
77 web_man := web/sync/man
78 autocrap := config.h.in configure
79 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
80 tarball_delete = web versions pics/screenshots pics/web .changelog_before_cvs \
81 .changelog_cvs
82 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
83 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
84
85 .PHONY: clean distclean maintainer-clean install html www tags doxygen gruta \
86 man html_man
87 all: $(BINARIES)
88 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) $(web_man) \
89 tags doxygen
90 gruta: $(gen_html) $(gruta_html)
91 man: $(man_pages)
92 html_man: $(man_pages_html)
93
94 sdl_gui_objs = sdl_gui.cmdline.o SFont.o sdl_gui.o gui_common.o exec.o \
95 close_on_fork.o string.o stat.o fd.o
96 dbadm_objs = dbadm.o exec.o close_on_fork.o string.o
97 fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
98 krell_objs = krell.o string.o
99 slider_objs = slider.o string.o
100
101 *.o: para.h config.h gcc-compat.h
102
103 include Makefile.deps
104
105 V := (@PACKAGE_STRING@, $(codename))\n$(COPYRIGHT)\n$(DISCLAIMER)
106 module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
107
108 grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
109 gengetopt $(module_ggo_opts) \
110 -S \
111 --set-package=grab \
112 --no-handle-help \
113 --no-handle-error \
114 --no-handle-version \
115 --arg-struct-name=grab_client_args_info \
116 --file-name=$(subst .ggo,,$<).cmdline \
117 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
118
119 %_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
120 gengetopt $(module_ggo_opts) \
121 --set-package=$(subst .ggo,,$<) \
122 --arg-struct-name=$(subst .ggo,,$<)_args_info \
123 --file-name=$(subst .ggo,,$<).cmdline \
124 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
125
126 %_filter.cmdline.h %_filter.cmdline.c: %_filter.ggo
127 gengetopt $(module_ggo_opts) \
128 --set-package=$(subst .ggo,,$<) \
129 --arg-struct-name=$(subst .ggo,,$<)_args_info \
130 --file-name=$(subst .ggo,,$<).cmdline \
131 --func-name $(subst _filter.ggo,,$<)_cmdline_parser < $<
132 %_write.cmdline.h %_write.cmdline.c: %_write.ggo
133 gengetopt -S $(module_ggo_opts) \
134 --set-package=$(subst .ggo,,$<) \
135 --arg-struct-name=$(subst .ggo,,$<)_args_info \
136 --file-name=$(subst .ggo,,$<).cmdline \
137 --func-name $(subst _write.ggo,,$<)_cmdline_parser < $<
138
139 %.cmdline.h %.cmdline.c: %.ggo
140 case $< in client.ggo) O="--unamed-opts=command";; \
141 audioc.ggo) O="--unamed-opts=command";; \
142 esac; \
143 gengetopt $$O \
144 --conf-parser \
145 --file-name=$(*F).cmdline \
146 --func-name $(*F)_cmdline_parser \
147 --arg-struct-name=$(*F)_args_info \
148 --set-package="para_$(subst .cmdline,,$(*F))" \
149 --set-version="$V" < $<
150
151 %_command_list.c %_command_list.h: %.cmd
152 ./command_util.sh c < $< >$@
153 ./command_util.sh h < $< >$(@:%.c=%.h)
154
155 %_command_list.man: %.cmd
156 ./command_util.sh man < $< > $@
157
158 server_command_lists = server_command_list.man random_selector_command_list.man \
159 playlist_selector_command_list.man mysql_selector_command_list.man
160 man/man1/para_server.1: para_server $(server_command_lists)
161 opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
162 help2man $$opts ./para_server > $@
163
164 man/man1/para_audiod.1: para_audiod audiod_command_list.man
165 help2man -N -i audiod_command_list.man ./para_audiod > $@
166
167 man/man1/%.1: %
168 help2man -N $< > $@
169
170 man/html/%.html: man/man1/%.1
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 $(DEBUG_CPPFLAGS) -Wall -O -g @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
266 mkdir -p $(BINDIR) $(FONTDIR) $(PICDIR) $(MANDIR) $(VARDIR)
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
272 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) $(man_pages)
273 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
274 git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
275 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
276 mkdir $(tarball_pfx)
277 cp -r $(tarball_add) $(tarball_pfx)
278 mkdir -p $(tarball_pfx)/man/man1
279 cp -r $(man_pages) $(tarball_pfx)/man/man1
280 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
281 rm -rf $(tarball_pfx)
282 bzip2 -9 $(tarball_pfx).tar
283 rm -f $(tarball_pfx).tar
284 ls -l $(tarball_pfx).tar.bz2
285
286 web/%.in.html: %
287 grutatxt -nb < $< > $@
288 tags:
289 rm -rf web/sync/HTML && gtags && htags -nF && mv HTML web/sync
290 web/header2.html: web/header.html
291 sed -e 's|href="|href="\.\.\/\.\./|g' \
292 -e 's|SRC="|SRC="\.\.\/\.\./|g' $< > $@
293 doxygen: web/header2.html
294 mkdir -p web/sync/doxygen
295 doxygen
296 web/sync/man: html_man
297 mkdir -p $@
298 cp -a $(man_pages_html) $@
299 web/sync/%.html: web/%.in.html web/header.html web/footer.html web/sync
300 cat web/header.html $< web/footer.html > $@
301 web/sync/%.png: pics/web/%.png web/sync
302 cp $< $@
303 web/sync/%.ico: pics/web/%.ico web/sync
304 cp $< $@
305 web/sync/para.css: web/para.css web/sync
306 cp $< $@
307 web/sync/versions/paraslash-git.tar.bz2: paraslash-git.tar.bz2 web/sync
308 cp -a versions web/sync && cp $< $@
309 web/sync/overview.pdf: skencil/overview.pdf web/sync
310 cp $< $@
311 web/sync/%: %
312 cp -a $< $@
313 web/sync/%: pics/screenshots/%
314 cp $< $@
315 skencil/%.ps: skencil/%.sk
316 sk2ps $< > $@
317 %.pdf: %.ps
318 ps2pdf - - < $< > $@