simplify dccp_set_socket() (Gerrit Renker)
[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 = neural discharge
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 all_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_binaries := $(filter-out para_dbadm para_slider para_krell.so, $(BINARIES))
49 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
50 man_pages_html := $(patsubst %, man/html/%.html, $(man_binaries))
51 FONTS := $(wildcard fonts/*.png)
52 PICS := $(wildcard pics/paraslash/*.jpg)
53 gengetopts := $(wildcard *.ggo)
54 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
55 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
56 all_c_files := $(wildcard *.c)
57 c_sources := $(filter-out $(gengetopts_c), $(all_c_files))
58 grutatxt := COPYING NEWS README.mysql CREDITS INSTALL README FEATURES GPL
59 grutatxt_html := $(grutatxt:=.html)
60 html_in := $(wildcard web/*.in.html)
61 gen_html := $(subst web/,web/sync/,$(html_in))
62 gen_html := $(gen_html:.in.html=.html)
63 gruta_in := $(grutatxt:=.in.html)
64 gruta_in := $(patsubst %,web/%,$(gruta_in))
65 gruta_html := $(grutatxt:=.html)
66 gruta_html := $(patsubst %,web/sync/%,$(gruta_html))
67 shots := gui-2005-11-12.png para_audiod-startup.txt para_krell-2005-02.png \
68         para_server-startup.txt para_slider-2004-12.png sdl_gui.jpg \
69         para_krell-2005-02.png
70 shots := $(patsubst %,web/sync/%,$(shots))
71 web_pics := web/sync/paraslash.png web/sync/paraslash.ico
72 web_misc := overview.pdf versions/@PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2 PUBLIC_KEY \
73         key.anonymous para.css
74 web_misc := $(patsubst %,web/sync/%,$(web_misc))
75 web_man := web/sync/man
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 \
84         man html_man
85 all: $(BINARIES)
86 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) $(web_man) \
87         tags doxygen
88 gruta: $(gen_html) $(gruta_html)
89 man: $(man_pages)
90 html_man: $(man_pages_html)
91
92 sdl_gui_objs = sdl_gui.cmdline.o SFont.o sdl_gui.o gui_common.o exec.o \
93         close_on_fork.o string.o stat.o fd.o
94 dbadm_objs = dbadm.o exec.o close_on_fork.o string.o
95 fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
96 krell_objs = krell.o string.o
97 slider_objs = slider.o string.o
98
99 *.o: para.h config.h gcc-compat.h
100
101 include Makefile.deps
102
103 module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
104
105 grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
106         gengetopt $(module_ggo_opts) \
107                 -S \
108                 --set-package=grab \
109                 --no-handle-help \
110                 --no-handle-error \
111                 --no-handle-version \
112                 --arg-struct-name=grab_client_args_info \
113                 --file-name=$(subst .ggo,,$<).cmdline \
114                 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
115
116 %_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
117         gengetopt $(module_ggo_opts) \
118                 --set-package=$(subst .ggo,,$<) \
119                 --arg-struct-name=$(subst .ggo,,$<)_args_info \
120                 --file-name=$(subst .ggo,,$<).cmdline \
121                 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
122
123 %_filter.cmdline.h %_filter.cmdline.c: %_filter.ggo
124         gengetopt $(module_ggo_opts) \
125                 --set-package=$(subst .ggo,,$<) \
126                 --arg-struct-name=$(subst .ggo,,$<)_args_info \
127                 --file-name=$(subst .ggo,,$<).cmdline \
128                 --func-name $(subst _filter.ggo,,$<)_cmdline_parser < $<
129 %_write.cmdline.h %_write.cmdline.c: %_write.ggo
130         gengetopt -S $(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 _write.ggo,,$<)_cmdline_parser < $<
135
136 %.cmdline.h %.cmdline.c: %.ggo
137         case $< in client.ggo) O="--unamed-opts=command";; \
138                 audioc.ggo) O="--unamed-opts=command";; \
139         esac; \
140         gengetopt $$O \
141                 --no-handle-version \
142                 --conf-parser \
143                 --file-name=$(*F).cmdline \
144                 --func-name $(*F)_cmdline_parser \
145                 --arg-struct-name=$(*F)_args_info \
146                 --set-package="para_$(subst .cmdline,,$(*F))" \
147                 --set-version="@PACKAGE_VERSION@"  < $<
148
149 %_command_list.c %_command_list.h: %.cmd
150         ./command_util.sh c < $< >$@
151         ./command_util.sh h < $< >$(@:%.c=%.h)
152
153 %_command_list.man: %.cmd
154         ./command_util.sh man < $< > $@
155
156 server_command_lists = server_command_list.man random_selector_command_list.man \
157         playlist_selector_command_list.man mysql_selector_command_list.man
158 man/man1/para_server.1: para_server $(server_command_lists)
159         mkdir -p man/man1
160         opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
161         help2man $$opts ./para_server > $@
162
163 man/man1/para_audiod.1: para_audiod audiod_command_list.man
164         mkdir -p man/man1
165         help2man -N -i audiod_command_list.man ./para_audiod > $@
166
167 man/man1/%.1: %
168         mkdir -p man/man1
169         help2man -N ./$< > $@
170
171 man/html/%.html: man/man1/%.1
172         mkdir -p man/html
173         man2html $< > $@
174
175
176
177 ortp_recv.o: ortp_recv.c
178         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
179
180 ortp_send.o: ortp_send.c
181         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
182
183 oggdec.o: oggdec.c
184         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
185 ogg_afh.o: ogg_afh.c
186         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
187
188 mp3dec.o: mp3dec.c
189         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
190
191 aacdec.o: aacdec.c
192         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
193
194 aac_common.o: aac_common.c
195         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
196
197 aac_afh.o: aac_afh.c
198         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
199
200 slider.o: slider.c
201         $(CC) -c -Wall -o $@ -g @GLIB_CFLAGS@  @GTK_CFLAGS@ $<
202
203 krell.o: krell.c
204         $(CC) -Wall -O -g -fPIC @GTK_CFLAGS@ -c -o $@ krell.c
205
206 mysql_selector.o: mysql_selector.c
207         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mysql_cppflags@ $<
208
209 %.cmdline.o: %.cmdline.c
210         $(CC) -c $(CPPFLAGS) $<
211 %.o: %.c
212         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
213
214 para_recv: @recv_objs@
215         $(CC) @recv_objs@ -o $@ @recv_ldflags@
216
217 para_filter: @filter_objs@
218         $(CC) @filter_objs@ -o $@ @filter_ldflags@
219
220 para_slider: $(slider_objs)
221         $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
222
223 para_client: @client_objs@
224         $(CC) -o $@ @client_objs@ @client_ldflags@
225
226 para_gui: @gui_objs@
227         $(CC) -o $@ @gui_objs@ -lncurses
228
229 para_audiod: @audiod_objs@
230         $(CC) -o $@ @audiod_objs@ @audiod_ldflags@
231
232 para_audioc: @audioc_objs@
233         $(CC) -o $@ @audioc_objs@
234
235 para_dbadm: $(dbadm_objs)
236         $(CC) -o $@ $(dbadm_objs) -lncurses -lmenu
237
238 para_fade: $(fade_objs)
239         $(CC) -o $@ $(fade_objs)
240
241 para_server: @server_objs@
242         $(CC) -o $@ @server_objs@  @server_ldflags@
243
244 para_sdl_gui: $(sdl_gui_objs)
245         $(CC) -o $@ $(sdl_gui_objs) -lSDL_image
246
247 para_write: @write_objs@
248         $(CC) -o $@ @write_objs@ @write_ldflags@
249
250 para_krell.so: $(krell_objs)
251         $(CC) -Wall -fPIC @GTK_CFLAGS@ krell.o -o $@ @GTK_LIBS@ -shared
252
253 clean:
254         rm -f *.o $(BINARIES)
255 distclean: clean
256         rm -f Makefile autoscan.log config.status config.log && \
257         rm -rf web/sync/* autom4te.cache aclocal.m4
258         rm -f GPATH GRTAGS GSYMS GTAGS
259
260 maintainer-clean: distclean
261         rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
262                 $(grutatxt_html) config.h configure \
263                 config.h.in skencil/*.pdf skencil/*.ps
264         rm -f *_command_list.* *.man man/man1/* man/html/*
265
266
267 install: all
268         mkdir -p $(BINDIR) $(FONTDIR) $(PICDIR) $(MANDIR)
269         $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
270         $(install_sh) -m 644 $(FONTS) $(FONTDIR)
271         $(install_sh) -m 644 $(PICS) $(PICDIR)
272         $(install_sh) -m 644 $(man_pages) $(MANDIR)
273         mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
274
275 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) $(man_pages)
276         rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
277         git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
278                 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
279         mkdir $(tarball_pfx)
280         cp -r $(tarball_add) $(tarball_pfx)
281         mkdir -p $(tarball_pfx)/man/man1
282         cp -r $(man_pages) $(tarball_pfx)/man/man1
283         tar rf $(tarball_pfx).tar $(tarball_pfx)/*
284         rm -rf $(tarball_pfx)
285         bzip2 -9 $(tarball_pfx).tar
286         rm -f $(tarball_pfx).tar
287         ls -l $(tarball_pfx).tar.bz2
288
289 web/%.in.html: %
290         grutatxt -nb  < $< > $@
291 tags:
292         rm -rf web/sync/HTML && gtags && htags -nF && mv HTML web/sync
293 web/header2.html: web/header.html
294         sed -e 's|href="|href="\.\.\/\.\./|g' \
295                 -e 's|SRC="|SRC="\.\.\/\.\./|g' $< > $@
296 doxygen: web/header2.html
297         mkdir -p web/sync/doxygen
298         doxygen
299 web/sync/man: html_man
300         mkdir -p $@
301         cp -a $(man_pages_html) $@
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/@PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: @PACKAGE_TARNAME@-@PACKAGE_VERSION@.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 - - < $< > $@