Merge branch 'master' into my-osx
[paraslash.git] / Makefile.in
1 COPYRIGHT = Copyright (c) 1997-2006 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 = @datadir@/@PACKAGE_NAME@
10 FONTDIR = $(PKGDATADIR)/fonts
11 PICDIR = $(PKGDATADIR)/pics
12 MANDIR = @prefix@/share/man/man1
13
14 install_sh = @install_sh@
15 SSL_LIBS = @SSL_LIBS@
16 SSL_LDFLAGS = @SSL_LDFLAGS@
17
18 extra_binaries = @extra_binaries@
19 build_date = $(shell date)
20 system = $(shell uname -rs)
21 cc_version = $(shell $(CC) --version | head -n 1)
22 version = @PACKAGE_VERSION@
23 codename = oriented abstraction
24
25 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
26
27 DEBUG_CPPFLAGS += -Wredundant-decls
28
29 # produces false positives
30 # DEBUG_CPPFLAGS += -Wunreachable-code
31
32 #CPPFLAGS += -Wwrite-strings
33
34 # invalid option for gcc-3.3.5
35 # CPPFLAGS += -Wextra
36
37 CPPFLAGS += -Os
38 CPPFLAGS += -Wall
39 CPPFLAGS += -Wuninitialized
40 CPPFLAGS += -Wstrict-prototypes
41 CPPFLAGS += -Wchar-subscripts
42 CPPFLAGS += -Wformat-security
43 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
44 CPPFLAGS += -DFONTDIR='"$(PKGDATADIR)/fonts"'
45 CPPFLAGS += -DPICDIR='"$(PKGDATADIR)/pics"'
46 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
47 CPPFLAGS += -DSYSTEM='"$(system)"'
48 CPPFLAGS += -DVERSION='"$(version)"'
49 CPPFLAGS += -DCODENAME='"$(codename)"'
50 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
51 CPPFLAGS += -Werror-implicit-function-declaration
52 CPPFLAGS += -Wmissing-format-attribute
53 CPPFLAGS += -Wunused-macros
54 CPPFLAGS += -Wshadow
55
56 BINARIES = para_server para_client para_gui para_audiod para_audioc para_recv para_filter para_write $(extra_binaries)
57
58 FONTS := $(wildcard fonts/*.png)
59 PICS := $(wildcard pics/paraslash/*.jpg)
60 MANS := $(wildcard doc/man/man1/*.1)
61 gengetopts := $(wildcard *.ggo)
62 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
63 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
64 all_c_files := $(wildcard *.c)
65 c_sources := $(filter-out $(gengetopts_c), $(all_c_files))
66 grutatxt := COPYING NEWS README.mysql CREDITS INSTALL README \
67 FEATURES GPL
68 grutatxt_html := $(grutatxt:=.html)
69 html_in := $(wildcard web/*.in.html)
70 gen_html := $(subst web/,web/sync/,$(html_in))
71 gen_html := $(gen_html:.in.html=.html)
72 gruta_in := $(grutatxt:=.in.html)
73 gruta_in := $(patsubst %,web/%,$(gruta_in))
74 gruta_html := $(grutatxt:=.html)
75 gruta_html := $(patsubst %,web/sync/%,$(gruta_html))
76 shots := gui-2005-11-12.png para_audiod-startup.txt
77 shots += para_krell-2005-02.png para_server-startup.txt
78 shots += para_slider-2004-12.png sdl_gui.jpg para_krell-2005-02.png
79 shots := $(patsubst %,web/sync/%,$(shots))
80 web_pics := web/sync/paraslash.png web/sync/paraslash.ico
81 web_misc := demo-script overview.pdf versions/paraslash-git.tar.bz2 PUBLIC_KEY key.anonymous para.css doc
82 web_misc := $(patsubst %,web/sync/%,$(web_misc))
83
84 autocrap := config.h.in configure
85
86 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
87
88 tarball_delete = web versions pics/screenshots pics/web .changelog_before_cvs \
89 .changelog_cvs
90 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
91 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
92
93 .PHONY: clean distclean maintainer-clean install html www tags ChangeLog doxygen gruta
94 all: $(BINARIES)
95 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) tags doxygen doc
96 gruta: $(gen_html) $(gruta_html)
97
98
99 sdl_gui_objs = sdl_gui.cmdline.o SFont.o sdl_gui.o gui_common.o exec.o \
100 close_on_fork.o string.o stat.o fd.o
101 dbadm_objs = dbadm.o exec.o close_on_fork.o string.o
102 fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
103 krell_objs = krell.o string.o
104 slider_objs = slider.o string.o
105
106 *.o: para.h config.h gcc-compat.h
107
108 include Makefile.deps
109
110 V := ($(TGZ_PREFIX)@PACKAGE_STRING@, $(codename))\n$(COPYRIGHT)\n$(DISCLAIMER)
111 module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
112
113 grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
114 gengetopt $(module_ggo_opts) \
115 -S \
116 --set-package=grab \
117 --no-handle-help \
118 --no-handle-error \
119 --no-handle-version \
120 --arg-struct-name=grab_client_args_info \
121 --file-name=$(subst .ggo,,$<).cmdline \
122 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
123
124 %_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
125 gengetopt $(module_ggo_opts) \
126 --set-package=$(subst .ggo,,$<) \
127 --arg-struct-name=$(subst .ggo,,$<)_args_info \
128 --file-name=$(subst .ggo,,$<).cmdline \
129 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
130
131 %_filter.cmdline.h %_filter.cmdline.c: %_filter.ggo
132 gengetopt $(module_ggo_opts) \
133 --set-package=$(subst .ggo,,$<) \
134 --arg-struct-name=$(subst .ggo,,$<)_args_info \
135 --file-name=$(subst .ggo,,$<).cmdline \
136 --func-name $(subst _filter.ggo,,$<)_cmdline_parser < $<
137 %_write.cmdline.h %_write.cmdline.c: %_write.ggo
138 gengetopt -S $(module_ggo_opts) \
139 --set-package=$(subst .ggo,,$<) \
140 --arg-struct-name=$(subst .ggo,,$<)_args_info \
141 --file-name=$(subst .ggo,,$<).cmdline \
142 --func-name $(subst _write.ggo,,$<)_cmdline_parser < $<
143
144 %.cmdline.h %.cmdline.c: %.ggo
145 case $< in client.ggo) O="--unamed-opts=command";; \
146 audioc.ggo) O="--unamed-opts=command";; \
147 esac; \
148 gengetopt $$O \
149 --conf-parser \
150 --file-name=$(*F).cmdline \
151 --func-name $(*F)_cmdline_parser \
152 --arg-struct-name=$(*F)_args_info \
153 --set-package="para_$(subst .cmdline,,$(*F))" \
154 --set-version="$V" < $<
155
156 aacdec.o: aacdec.c
157 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
158
159 aac_common.o: aac_common.c
160 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
161
162 aac_afh.o: aac_afh.c
163 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
164
165 para_recv: @recv_objs@
166 $(CC) @recv_objs@ -o $@ @recv_ldflags@
167
168 slider.o: slider.c
169 $(CC) -c -Wall -o $@ -g @GLIB_CFLAGS@ @GTK_CFLAGS@ $<
170
171 krell.o: krell.c
172 $(CC) -Wall -O -g -fPIC @GTK_CFLAGS@ -c -o $@ krell.c
173
174 mysql_selector.o: mysql_selector.c
175 $(CC) -Wall -O -g @mysql_cppflags@ -c -o $@ $<
176
177 %.cmdline.o: %.cmdline.c
178 $(CC) -c $(CPPFLAGS) $<
179 %.o: %.c
180 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
181
182 para_filter: @filter_objs@
183 $(CC) @filter_objs@ -o $@ @filter_ldflags@
184
185 para_slider: $(slider_objs)
186 $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
187
188 para_client: @client_objs@
189 $(CC) -o $@ @client_objs@ @client_ldflags@
190
191 para_gui: @gui_objs@
192 $(CC) -o $@ @gui_objs@ -lncurses
193
194 para_audiod: @audiod_objs@
195 $(CC) -o $@ @audiod_objs@ @audiod_ldflags@
196
197 para_audioc: @audioc_objs@
198 $(CC) -o $@ @audioc_objs@
199
200 para_dbadm: $(dbadm_objs)
201 $(CC) -o $@ $(dbadm_objs) -lncurses -lmenu
202
203 para_fade: $(fade_objs)
204 $(CC) -o $@ $(fade_objs)
205
206 para_server: @server_objs@
207 $(CC) -o $@ @server_objs@ @server_ldflags@
208
209 para_sdl_gui: $(sdl_gui_objs)
210 $(CC) -o $@ $(sdl_gui_objs) -lSDL_image
211
212 para_write: @write_objs@
213 $(CC) -o $@ @write_objs@ @write_ldflags@
214
215 para_krell.so: $(krell_objs)
216 $(CC) -Wall -fPIC @GTK_CFLAGS@ krell.o -o $@ @GTK_LIBS@ -shared
217
218 clean:
219 rm -f *.o $(BINARIES)
220
221 distclean: clean
222 rm -f Makefile autoscan.log config.status config.log && \
223 rm -rf web/sync/* autom4te.cache aclocal.m4
224 rm -f GPATH GRTAGS GSYMS GTAGS
225
226 maintainer-clean: distclean
227 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
228 $(grutatxt_html) ChangeLog* config.h configure \
229 config.h.in skencil/*.pdf skencil/*.ps
230 rm -rf doc
231
232 install: all
233 umask 022 && \
234 mkdir -p $(BINDIR) $(VARDIR) && \
235 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR) && \
236 mkdir -p $(FONTDIR) && \
237 $(install_sh) -m 644 $(FONTS) $(FONTDIR) && \
238 mkdir -p $(PICDIR) && \
239 $(install_sh) -m 644 $(PICS) $(PICDIR) && \
240 mkdir -p $(MANDIR) && \
241 $(install_sh) -m 644 $(MANS) $(MANDIR)
242
243 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) doc
244 rm -f $(tarball_pfx).tar.bz2
245 git-tar-tree HEAD $(tarball_pfx) | tar --delete $(tarball_delete) > $(tarball_pfx).tar
246 mkdir $(tarball_pfx)
247 cp -r $(tarball_add) $(tarball_pfx)
248 tar c doc/man | (cd $(tarball_pfx); tar x)
249 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
250 rm -rf $(tarball_pfx)
251 bzip2 -9 $(tarball_pfx).tar
252 rm -f $(tarball_pfx).tar
253 ls -l $(tarball_pfx).tar.bz2
254
255 ChangeLog:
256 para_util changelog > $@
257 web/%.in.html: %
258 grutatxt -nb < $< > $@
259 tags:
260 rm -rf web/sync/HTML && gtags && htags -nF && mv HTML web/sync
261 doc:
262 para_util doc
263 web/header2.html: web/header.html
264 sed -e 's|href="|href="\.\.\/\.\./|g' \
265 -e 's|SRC="|SRC="\.\.\/\.\./|g' $< > $@
266 doxygen: web/header2.html
267 mkdir -p web/sync/doxygen
268 doxygen
269 web/sync/doc: doc
270 cp -a $< $@
271 web/sync/doxygen:
272 mkdir -p $@
273 web/sync/%.html: web/%.in.html web/header.html web/footer.html web/sync
274 cat web/header.html $< web/footer.html > $@
275 web/sync/%.png: pics/web/%.png web/sync
276 cp $< $@
277 web/sync/%.ico: pics/web/%.ico web/sync
278 cp $< $@
279 web/sync/demo-script: scripts/demo-script web/sync
280 cp $< $@
281 web/sync/para.css: web/para.css web/sync
282 cp $< $@
283 web/sync/versions/paraslash-git.tar.bz2: paraslash-git.tar.bz2 web/sync
284 cp -a versions web/sync && cp $< $@
285 web/sync/overview.pdf: skencil/overview.pdf web/sync
286 cp $< $@
287 web/sync/%: %
288 cp -a $< $@
289 web/sync/%: pics/screenshots/%
290 cp $< $@
291 skencil/%.ps: skencil/%.sk
292 sk2ps $< > $@
293 %.pdf: %.ps
294 ps2pdf - - < $< > $@