Makefile.in: More 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 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 doc
76 web_misc := $(patsubst %,web/sync/%,$(web_misc))
77 autocrap := config.h.in configure
78 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
79 tarball_delete = web versions pics/screenshots pics/web .changelog_before_cvs \
80 .changelog_cvs
81 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
82 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
83
84 .PHONY: clean distclean maintainer-clean install html www tags doxygen gruta man
85 all: $(BINARIES)
86 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) tags doxygen doc
87 gruta: $(gen_html) $(gruta_html)
88 man: $(man_pages) $(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 V := (@PACKAGE_STRING@, $(codename))\n$(COPYRIGHT)\n$(DISCLAIMER)
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 --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="$V" < $<
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 opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
158 help2man $$opts ./para_server > $@
159
160 man/man1/para_audiod.1: para_audiod audiod_command_list.man
161 help2man -N -i audiod_command_list.man ./para_audiod > $@
162
163 man/man1/%.1: %
164 help2man -N $< > $@
165
166 man/html/%.html: man/man1/%.1
167 man2html $< > $@
168
169
170
171 ortp_recv.o: ortp_recv.c
172 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
173
174 ortp_send.o: ortp_send.c
175 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
176
177 oggdec.o: oggdec.c
178 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
179 ogg_afh.o: ogg_afh.c
180 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
181
182 mp3dec.o: mp3dec.c
183 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
184
185 aacdec.o: aacdec.c
186 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
187
188 aac_common.o: aac_common.c
189 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
190
191 aac_afh.o: aac_afh.c
192 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
193
194 para_recv: @recv_objs@
195 $(CC) @recv_objs@ -o $@ @recv_ldflags@
196
197 slider.o: slider.c
198 $(CC) -c -Wall -o $@ -g @GLIB_CFLAGS@ @GTK_CFLAGS@ $<
199
200 krell.o: krell.c
201 $(CC) -Wall -O -g -fPIC @GTK_CFLAGS@ -c -o $@ krell.c
202
203 mysql_selector.o: mysql_selector.c
204 $(CC) -Wall -O -g @mysql_cppflags@ -c -o $@ $<
205
206 %.cmdline.o: %.cmdline.c
207 $(CC) -c $(CPPFLAGS) $<
208 %.o: %.c
209 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
210
211 para_filter: @filter_objs@
212 $(CC) @filter_objs@ -o $@ @filter_ldflags@
213
214 para_slider: $(slider_objs)
215 $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
216
217 para_client: @client_objs@
218 $(CC) -o $@ @client_objs@ @client_ldflags@
219
220 para_gui: @gui_objs@
221 $(CC) -o $@ @gui_objs@ -lncurses
222
223 para_audiod: @audiod_objs@
224 $(CC) -o $@ @audiod_objs@ @audiod_ldflags@
225
226 para_audioc: @audioc_objs@
227 $(CC) -o $@ @audioc_objs@
228
229 para_dbadm: $(dbadm_objs)
230 $(CC) -o $@ $(dbadm_objs) -lncurses -lmenu
231
232 para_fade: $(fade_objs)
233 $(CC) -o $@ $(fade_objs)
234
235 para_server: @server_objs@
236 $(CC) -o $@ @server_objs@ @server_ldflags@
237
238 para_sdl_gui: $(sdl_gui_objs)
239 $(CC) -o $@ $(sdl_gui_objs) -lSDL_image
240
241 para_write: @write_objs@
242 $(CC) -o $@ @write_objs@ @write_ldflags@
243
244 para_krell.so: $(krell_objs)
245 $(CC) -Wall -fPIC @GTK_CFLAGS@ krell.o -o $@ @GTK_LIBS@ -shared
246
247 clean:
248 rm -f *.o $(BINARIES)
249 distclean: clean
250 rm -f Makefile autoscan.log config.status config.log && \
251 rm -rf web/sync/* autom4te.cache aclocal.m4
252 rm -f GPATH GRTAGS GSYMS GTAGS
253
254 maintainer-clean: distclean
255 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
256 $(grutatxt_html) config.h configure \
257 config.h.in skencil/*.pdf skencil/*.ps
258 rm -rf doc
259 rm -f *_command_list.* *.man man/man1/* man/html/*
260
261
262 install: all
263 umask 022 && \
264 mkdir -p $(BINDIR) && \
265 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR) && \
266 mkdir -p $(FONTDIR) && \
267 $(install_sh) -m 644 $(FONTS) $(FONTDIR) && \
268 mkdir -p $(PICDIR) && \
269 $(install_sh) -m 644 $(PICS) $(PICDIR) && \
270 mkdir -p $(MANDIR) && \
271 $(install_sh) -m 644 $(MANS) $(MANDIR) \
272 mkdir -p $(VARDIR) > /dev/null 2>&1 || exit 0
273
274 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) doc
275 rm -f $(tarball_pfx).tar.bz2
276 git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD | tar --delete $(tarball_delete) > $(tarball_pfx).tar
277 mkdir $(tarball_pfx)
278 cp -r $(tarball_add) $(tarball_pfx)
279 tar c doc/man | (cd $(tarball_pfx); tar x)
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 doc:
291 para_util doc
292 web/header2.html: web/header.html
293 sed -e 's|href="|href="\.\.\/\.\./|g' \
294 -e 's|SRC="|SRC="\.\.\/\.\./|g' $< > $@
295 doxygen: web/header2.html
296 mkdir -p web/sync/doxygen
297 doxygen
298 web/sync/doc: doc
299 cp -a $< $@
300 web/sync/doxygen:
301 mkdir -p $@
302 web/sync/%.html: web/%.in.html web/header.html web/footer.html web/sync
303 cat web/header.html $< web/footer.html > $@
304 web/sync/%.png: pics/web/%.png web/sync
305 cp $< $@
306 web/sync/%.ico: pics/web/%.ico web/sync
307 cp $< $@
308 web/sync/para.css: web/para.css web/sync
309 cp $< $@
310 web/sync/versions/paraslash-git.tar.bz2: paraslash-git.tar.bz2 web/sync
311 cp -a versions web/sync && cp $< $@
312 web/sync/overview.pdf: skencil/overview.pdf web/sync
313 cp $< $@
314 web/sync/%: %
315 cp -a $< $@
316 web/sync/%: pics/screenshots/%
317 cp $< $@
318 skencil/%.ps: skencil/%.sk
319 sk2ps $< > $@
320 %.pdf: %.ps
321 ps2pdf - - < $< > $@