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