Makefile.in: trivial cleanups
[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 #CPPFLAGS += -Wwrite-strings
26 # invalid option for gcc-3.3.5
27 # 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 := $(filter-out para_dbadm para_slider para_krell.so, $(BINARIES))
50 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
51 man_pages_html := $(patsubst %, man/html/%.html, $(man_binaries))
52 FONTS := $(wildcard fonts/*.png)
53 PICS := $(wildcard pics/paraslash/*.jpg)
54 MANS := $(wildcard doc/man/man1/*.1)
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
70 shots += para_krell-2005-02.png para_server-startup.txt
71 shots += para_slider-2004-12.png sdl_gui.jpg 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 key.anonymous para.css doc
75 web_misc := $(patsubst %,web/sync/%,$(web_misc))
76 autocrap := config.h.in configure
77 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
78 tarball_delete = web versions pics/screenshots pics/web .changelog_before_cvs \
79 .changelog_cvs
80 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
81 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
82
83 .PHONY: clean distclean maintainer-clean install html www tags doxygen gruta man
84 all: $(BINARIES)
85 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) tags doxygen doc
86 gruta: $(gen_html) $(gruta_html)
87 man: $(man_pages) $(man_pages_html)
88
89 sdl_gui_objs = sdl_gui.cmdline.o SFont.o sdl_gui.o gui_common.o exec.o \
90 close_on_fork.o string.o stat.o fd.o
91 dbadm_objs = dbadm.o exec.o close_on_fork.o string.o
92 fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
93 krell_objs = krell.o string.o
94 slider_objs = slider.o string.o
95
96 *.o: para.h config.h gcc-compat.h
97
98 include Makefile.deps
99
100 V := ($(TGZ_PREFIX)@PACKAGE_STRING@, $(codename))\n$(COPYRIGHT)\n$(DISCLAIMER)
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 --conf-parser \
140 --file-name=$(*F).cmdline \
141 --func-name $(*F)_cmdline_parser \
142 --arg-struct-name=$(*F)_args_info \
143 --set-package="para_$(subst .cmdline,,$(*F))" \
144 --set-version="$V" < $<
145
146 %_command_list.c %_command_list.h: %.cmd
147 ./command_util.sh c < $< >$@
148 ./command_util.sh h < $< >$(@:%.c=%.h)
149
150 %_command_list.man: %.cmd
151 ./command_util.sh man < $< > $@
152
153 server_command_lists = server_command_list.man random_selector_command_list.man \
154 playlist_selector_command_list.man mysql_selector_command_list.man
155 man/man1/para_server.1: para_server $(server_command_lists)
156 opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
157 help2man $$opts ./para_server > $@
158
159 man/man1/para_audiod.1: para_audiod audiod_command_list.man
160 help2man -N -i audiod_command_list.man ./para_audiod > $@
161
162 man/man1/%.1: %
163 help2man -N $< > $@
164
165 man/html/%.html: man/man1/%.1
166 man2html $< > $@
167
168
169
170 ortp_recv.o: ortp_recv.c
171 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
172
173 ortp_send.o: ortp_send.c
174 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
175
176 oggdec.o: oggdec.c
177 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
178 ogg_afh.o: ogg_afh.c
179 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
180
181 mp3dec.o: mp3dec.c
182 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
183
184 aacdec.o: aacdec.c
185 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
186
187 aac_common.o: aac_common.c
188 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
189
190 aac_afh.o: aac_afh.c
191 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
192
193 para_recv: @recv_objs@
194 $(CC) @recv_objs@ -o $@ @recv_ldflags@
195
196 slider.o: slider.c
197 $(CC) -c -Wall -o $@ -g @GLIB_CFLAGS@ @GTK_CFLAGS@ $<
198
199 krell.o: krell.c
200 $(CC) -Wall -O -g -fPIC @GTK_CFLAGS@ -c -o $@ krell.c
201
202 mysql_selector.o: mysql_selector.c
203 $(CC) -Wall -O -g @mysql_cppflags@ -c -o $@ $<
204
205 %.cmdline.o: %.cmdline.c
206 $(CC) -c $(CPPFLAGS) $<
207 %.o: %.c
208 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
209
210 para_filter: @filter_objs@
211 $(CC) @filter_objs@ -o $@ @filter_ldflags@
212
213 para_slider: $(slider_objs)
214 $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
215
216 para_client: @client_objs@
217 $(CC) -o $@ @client_objs@ @client_ldflags@
218
219 para_gui: @gui_objs@
220 $(CC) -o $@ @gui_objs@ -lncurses
221
222 para_audiod: @audiod_objs@
223 $(CC) -o $@ @audiod_objs@ @audiod_ldflags@
224
225 para_audioc: @audioc_objs@
226 $(CC) -o $@ @audioc_objs@
227
228 para_dbadm: $(dbadm_objs)
229 $(CC) -o $@ $(dbadm_objs) -lncurses -lmenu
230
231 para_fade: $(fade_objs)
232 $(CC) -o $@ $(fade_objs)
233
234 para_server: @server_objs@
235 $(CC) -o $@ @server_objs@ @server_ldflags@
236
237 para_sdl_gui: $(sdl_gui_objs)
238 $(CC) -o $@ $(sdl_gui_objs) -lSDL_image
239
240 para_write: @write_objs@
241 $(CC) -o $@ @write_objs@ @write_ldflags@
242
243 para_krell.so: $(krell_objs)
244 $(CC) -Wall -fPIC @GTK_CFLAGS@ krell.o -o $@ @GTK_LIBS@ -shared
245
246 clean:
247 rm -f *.o $(BINARIES)
248 distclean: clean
249 rm -f Makefile autoscan.log config.status config.log && \
250 rm -rf web/sync/* autom4te.cache aclocal.m4
251 rm -f GPATH GRTAGS GSYMS GTAGS
252
253 maintainer-clean: distclean
254 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
255 $(grutatxt_html) config.h configure \
256 config.h.in skencil/*.pdf skencil/*.ps
257 rm -rf doc
258 rm -f *_command_list.* *.man man/man1/* man/html/*
259
260
261 install: all
262 umask 022 && \
263 mkdir -p $(BINDIR) && \
264 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR) && \
265 mkdir -p $(FONTDIR) && \
266 $(install_sh) -m 644 $(FONTS) $(FONTDIR) && \
267 mkdir -p $(PICDIR) && \
268 $(install_sh) -m 644 $(PICS) $(PICDIR) && \
269 mkdir -p $(MANDIR) && \
270 $(install_sh) -m 644 $(MANS) $(MANDIR) \
271 mkdir -p $(VARDIR) > /dev/null 2>&1 || exit 0
272
273 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) doc
274 rm -f $(tarball_pfx).tar.bz2
275 git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD | tar --delete $(tarball_delete) > $(tarball_pfx).tar
276 mkdir $(tarball_pfx)
277 cp -r $(tarball_add) $(tarball_pfx)
278 tar c doc/man | (cd $(tarball_pfx); tar x)
279 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
280 rm -rf $(tarball_pfx)
281 bzip2 -9 $(tarball_pfx).tar
282 rm -f $(tarball_pfx).tar
283 ls -l $(tarball_pfx).tar.bz2
284
285 web/%.in.html: %
286 grutatxt -nb < $< > $@
287 tags:
288 rm -rf web/sync/HTML && gtags && htags -nF && mv HTML web/sync
289 doc:
290 para_util doc
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/doc: doc
298 cp -a $< $@
299 web/sync/doxygen:
300 mkdir -p $@
301 web/sync/%.html: web/%.in.html web/header.html web/footer.html web/sync
302 cat web/header.html $< web/footer.html > $@
303 web/sync/%.png: pics/web/%.png web/sync
304 cp $< $@
305 web/sync/%.ico: pics/web/%.ico web/sync
306 cp $< $@
307 web/sync/para.css: web/para.css web/sync
308 cp $< $@
309 web/sync/versions/paraslash-git.tar.bz2: paraslash-git.tar.bz2 web/sync
310 cp -a versions web/sync && cp $< $@
311 web/sync/overview.pdf: skencil/overview.pdf web/sync
312 cp $< $@
313 web/sync/%: %
314 cp -a $< $@
315 web/sync/%: pics/screenshots/%
316 cp $< $@
317 skencil/%.ps: skencil/%.sk
318 sk2ps $< > $@
319 %.pdf: %.ps
320 ps2pdf - - < $< > $@