Makefile.in: Add target man
[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
23 DEBUG_CPPFLAGS += -Wredundant-decls
24
25 # produces false positives
26 # DEBUG_CPPFLAGS += -Wunreachable-code
27
28 #CPPFLAGS += -Wwrite-strings
29
30 # invalid option for gcc-3.3.5
31 # CPPFLAGS += -Wextra
32
33 CPPFLAGS += -Os
34 CPPFLAGS += -Wall
35 CPPFLAGS += -Wuninitialized
36 CPPFLAGS += -Wstrict-prototypes
37 CPPFLAGS += -Wchar-subscripts
38 CPPFLAGS += -Wformat-security
39 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
40 CPPFLAGS += -DFONTDIR='"$(PKGDATADIR)/fonts"'
41 CPPFLAGS += -DPICDIR='"$(PKGDATADIR)/pics"'
42 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
43 CPPFLAGS += -DSYSTEM='"$(system)"'
44 CPPFLAGS += -DCODENAME='"$(codename)"'
45 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
46 CPPFLAGS += -Werror-implicit-function-declaration
47 CPPFLAGS += -Wmissing-format-attribute
48 CPPFLAGS += -Wunused-macros
49 CPPFLAGS += -Wshadow
50
51 BINARIES = para_server para_client para_gui para_audioc para_recv para_filter para_write @extra_binaries@
52 man_binaries := $(filter-out para_dbadm para_slider para_krell.so, $(BINARIES))
53 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
54 man_pages_html := $(patsubst %, man/html/%.html, $(man_binaries))
55
56 FONTS := $(wildcard fonts/*.png)
57 PICS := $(wildcard pics/paraslash/*.jpg)
58 MANS := $(wildcard doc/man/man1/*.1)
59 gengetopts := $(wildcard *.ggo)
60 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
61 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
62 all_c_files := $(wildcard *.c)
63 c_sources := $(filter-out $(gengetopts_c), $(all_c_files))
64 grutatxt := COPYING NEWS README.mysql CREDITS INSTALL README \
65 FEATURES GPL
66 grutatxt_html := $(grutatxt:=.html)
67 html_in := $(wildcard web/*.in.html)
68 gen_html := $(subst web/,web/sync/,$(html_in))
69 gen_html := $(gen_html:.in.html=.html)
70 gruta_in := $(grutatxt:=.in.html)
71 gruta_in := $(patsubst %,web/%,$(gruta_in))
72 gruta_html := $(grutatxt:=.html)
73 gruta_html := $(patsubst %,web/sync/%,$(gruta_html))
74 shots := gui-2005-11-12.png para_audiod-startup.txt
75 shots += para_krell-2005-02.png para_server-startup.txt
76 shots += para_slider-2004-12.png sdl_gui.jpg para_krell-2005-02.png
77 shots := $(patsubst %,web/sync/%,$(shots))
78 web_pics := web/sync/paraslash.png web/sync/paraslash.ico
79 web_misc := overview.pdf versions/paraslash-git.tar.bz2 PUBLIC_KEY key.anonymous para.css doc
80 web_misc := $(patsubst %,web/sync/%,$(web_misc))
81
82 autocrap := config.h.in configure
83
84 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
85
86 tarball_delete = web versions pics/screenshots pics/web .changelog_before_cvs \
87 .changelog_cvs
88 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
89 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
90
91 .PHONY: clean distclean maintainer-clean install html www tags doxygen gruta man
92 all: $(BINARIES)
93 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) tags doxygen doc
94 gruta: $(gen_html) $(gruta_html)
95 man: $(man_pages) $(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
104 *.o: para.h config.h gcc-compat.h
105
106 include Makefile.deps
107
108 V := ($(TGZ_PREFIX)@PACKAGE_STRING@, $(codename))\n$(COPYRIGHT)\n$(DISCLAIMER)
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 esac; \
146 gengetopt $$O \
147 --conf-parser \
148 --file-name=$(*F).cmdline \
149 --func-name $(*F)_cmdline_parser \
150 --arg-struct-name=$(*F)_args_info \
151 --set-package="para_$(subst .cmdline,,$(*F))" \
152 --set-version="$V" < $<
153
154 %_command_list.c %_command_list.h: %.cmd
155 ./command_util.sh c < $< >$@
156 ./command_util.sh h < $< >$(@:%.c=%.h)
157
158 %_command_list.man: %.cmd
159 ./command_util.sh man < $< > $@
160
161 server_command_lists = server_command_list.man random_selector_command_list.man \
162 playlist_selector_command_list.man mysql_selector_command_list.man
163 man/man1/para_server.1: para_server $(server_command_lists)
164 opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
165 help2man $$opts ./para_server > $@
166
167 man/man1/para_audiod.1: para_audiod audiod_command_list.man
168 help2man -N -i audiod_command_list.man ./para_audiod > $@
169
170 man/man1/%.1: %
171 help2man -N $< > $@
172
173 man/html/%.html: man/man1/%.1
174 man2html $< > $@
175
176
177
178 ortp_recv.o: ortp_recv.c
179 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
180
181 ortp_send.o: ortp_send.c
182 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
183
184 oggdec.o: oggdec.c
185 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
186 ogg_afh.o: ogg_afh.c
187 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
188
189 mp3dec.o: mp3dec.c
190 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
191
192 aacdec.o: aacdec.c
193 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
194
195 aac_common.o: aac_common.c
196 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
197
198 aac_afh.o: aac_afh.c
199 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
200
201 para_recv: @recv_objs@
202 $(CC) @recv_objs@ -o $@ @recv_ldflags@
203
204 slider.o: slider.c
205 $(CC) -c -Wall -o $@ -g @GLIB_CFLAGS@ @GTK_CFLAGS@ $<
206
207 krell.o: krell.c
208 $(CC) -Wall -O -g -fPIC @GTK_CFLAGS@ -c -o $@ krell.c
209
210 mysql_selector.o: mysql_selector.c
211 $(CC) -Wall -O -g @mysql_cppflags@ -c -o $@ $<
212
213 %.cmdline.o: %.cmdline.c
214 $(CC) -c $(CPPFLAGS) $<
215 %.o: %.c
216 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
217
218 para_filter: @filter_objs@
219 $(CC) @filter_objs@ -o $@ @filter_ldflags@
220
221 para_slider: $(slider_objs)
222 $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
223
224 para_client: @client_objs@
225 $(CC) -o $@ @client_objs@ @client_ldflags@
226
227 para_gui: @gui_objs@
228 $(CC) -o $@ @gui_objs@ -lncurses
229
230 para_audiod: @audiod_objs@
231 $(CC) -o $@ @audiod_objs@ @audiod_ldflags@
232
233 para_audioc: @audioc_objs@
234 $(CC) -o $@ @audioc_objs@
235
236 para_dbadm: $(dbadm_objs)
237 $(CC) -o $@ $(dbadm_objs) -lncurses -lmenu
238
239 para_fade: $(fade_objs)
240 $(CC) -o $@ $(fade_objs)
241
242 para_server: @server_objs@
243 $(CC) -o $@ @server_objs@ @server_ldflags@
244
245 para_sdl_gui: $(sdl_gui_objs)
246 $(CC) -o $@ $(sdl_gui_objs) -lSDL_image
247
248 para_write: @write_objs@
249 $(CC) -o $@ @write_objs@ @write_ldflags@
250
251 para_krell.so: $(krell_objs)
252 $(CC) -Wall -fPIC @GTK_CFLAGS@ krell.o -o $@ @GTK_LIBS@ -shared
253
254 clean:
255 rm -f *.o $(BINARIES)
256 distclean: clean
257 rm -f Makefile autoscan.log config.status config.log && \
258 rm -rf web/sync/* autom4te.cache aclocal.m4
259 rm -f GPATH GRTAGS GSYMS GTAGS
260
261 maintainer-clean: distclean
262 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
263 $(grutatxt_html) config.h configure \
264 config.h.in skencil/*.pdf skencil/*.ps
265 rm -rf doc
266 rm -f *_command_list.* *.man man/man1/* man/html/*
267
268
269 install: all
270 umask 022 && \
271 mkdir -p $(BINDIR) && \
272 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR) && \
273 mkdir -p $(FONTDIR) && \
274 $(install_sh) -m 644 $(FONTS) $(FONTDIR) && \
275 mkdir -p $(PICDIR) && \
276 $(install_sh) -m 644 $(PICS) $(PICDIR) && \
277 mkdir -p $(MANDIR) && \
278 $(install_sh) -m 644 $(MANS) $(MANDIR) \
279 mkdir -p $(VARDIR) > /dev/null 2>&1 || exit 0
280
281 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) doc
282 rm -f $(tarball_pfx).tar.bz2
283 git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD | tar --delete $(tarball_delete) > $(tarball_pfx).tar
284 mkdir $(tarball_pfx)
285 cp -r $(tarball_add) $(tarball_pfx)
286 tar c doc/man | (cd $(tarball_pfx); tar x)
287 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
288 rm -rf $(tarball_pfx)
289 bzip2 -9 $(tarball_pfx).tar
290 rm -f $(tarball_pfx).tar
291 ls -l $(tarball_pfx).tar.bz2
292
293 web/%.in.html: %
294 grutatxt -nb < $< > $@
295 tags:
296 rm -rf web/sync/HTML && gtags && htags -nF && mv HTML web/sync
297 doc:
298 para_util doc
299 web/header2.html: web/header.html
300 sed -e 's|href="|href="\.\.\/\.\./|g' \
301 -e 's|SRC="|SRC="\.\.\/\.\./|g' $< > $@
302 doxygen: web/header2.html
303 mkdir -p web/sync/doxygen
304 doxygen
305 web/sync/doc: doc
306 cp -a $< $@
307 web/sync/doxygen:
308 mkdir -p $@
309 web/sync/%.html: web/%.in.html web/header.html web/footer.html web/sync
310 cat web/header.html $< web/footer.html > $@
311 web/sync/%.png: pics/web/%.png web/sync
312 cp $< $@
313 web/sync/%.ico: pics/web/%.ico web/sync
314 cp $< $@
315 web/sync/para.css: web/para.css web/sync
316 cp $< $@
317 web/sync/versions/paraslash-git.tar.bz2: paraslash-git.tar.bz2 web/sync
318 cp -a versions web/sync && cp $< $@
319 web/sync/overview.pdf: skencil/overview.pdf web/sync
320 cp $< $@
321 web/sync/%: %
322 cp -a $< $@
323 web/sync/%: pics/screenshots/%
324 cp $< $@
325 skencil/%.ps: skencil/%.sk
326 sk2ps $< > $@
327 %.pdf: %.ps
328 ps2pdf - - < $< > $@