06fe7d9da77d1c95a64f250abd7df6a4b8591e78
[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 PICDIR = $(PKGDATADIR)/pics
8 MANDIR = @datarootdir@/man/man1
9
10 install_sh = @install_sh@
11
12 build_date = $(shell date)
13 system = $(shell uname -rs)
14 cc_version = $(shell $(CC) --version | head -n 1)
15 codename = isotropic threshold
16
17 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
18 DEBUG_CPPFLAGS += -Wredundant-decls
19 # produces false positives
20 # DEBUG_CPPFLAGS += -Wunreachable-code
21 # DEBUG_CPPFLAGS += -Wwrite-strings
22
23 # invalid option for gcc-3.3.3
24 # DEBUG_CPPFLAGS += -Wextra
25 # DEBUG_CPPFLAGS += -Wold-style-definition
26
27 # many warnings about trivial stuff
28 # CPPFLAGS += -Wconversion
29
30 LDFLAGS += -Wl,--gc-sections
31
32 CPPFLAGS += -Os
33 CPPFLAGS += -Wall
34 CPPFLAGS += -Wuninitialized
35 CPPFLAGS += -Wstrict-prototypes
36 CPPFLAGS += -Wchar-subscripts
37 CPPFLAGS += -Wformat-security
38 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
39 CPPFLAGS += -DPICDIR='"$(PKGDATADIR)/pics"'
40 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
41 CPPFLAGS += -DSYSTEM='"$(system)"'
42 CPPFLAGS += -DCODENAME='"$(codename)"'
43 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
44 CPPFLAGS += -Werror-implicit-function-declaration
45 CPPFLAGS += -Wmissing-format-attribute
46 CPPFLAGS += -Wunused-macros
47 CPPFLAGS += -Wshadow
48 CPPFLAGS += -Wbad-function-cast
49 CPPFLAGS += -fdata-sections -ffunction-sections
50 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
51 CPPFLAGS += @SSL_CPPFLAGS@
52 CPPFLAGS += @ncurses_cppflags@
53
54 BINARIES = para_server para_client para_audioc para_recv \
55         para_filter para_write para_fsck @extra_binaries@
56 man_binaries := $(BINARIES)
57 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
58 man_pages_html := $(patsubst %, man/html/%.html, $(man_binaries))
59 PICS := $(wildcard pics/paraslash/*.jpg)
60 gengetopts := $(wildcard *.ggo)
61 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
62 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
63 grutatxt := NEWS CREDITS INSTALL README FEATURES
64 grutatxt_html := $(grutatxt:=.html)
65 html_in := $(wildcard web/*.in.html)
66 gen_html := $(subst web/,web/sync/,$(html_in))
67 gen_html := $(gen_html:.in.html=.html)
68 gruta_in := $(grutatxt:=.in.html)
69 gruta_in := $(patsubst %,web/%,$(gruta_in))
70 gruta_html := $(grutatxt:=.html)
71 gruta_html := $(patsubst %,web/sync/%,$(gruta_html))
72 shots := gui-2005-11-12.png para_audiod-startup.txt para_server-startup.txt
73 shots := $(patsubst %,web/sync/%,$(shots))
74 web_pics := web/sync/paraslash.png web/sync/paraslash.ico
75 web_misc := overview.pdf versions/@PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2 PUBLIC_KEY \
76         key.anonymous para.css
77 web_misc := $(patsubst %,web/sync/%,$(web_misc))
78 web_man := web/sync/man
79 autocrap := config.h.in configure
80 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
81 tarball_delete = web versions pics/screenshots pics/web .changelog_before_cvs \
82         .changelog_cvs
83 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
84 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
85
86 .PHONY: clean distclean maintainer-clean install html www tags doxygen gruta \
87         man html_man
88 all: $(BINARIES)
89 www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) $(web_man) \
90         tags doxygen
91 gruta: $(gen_html) $(gruta_html)
92 man: $(man_pages)
93 html_man: $(man_pages_html)
94
95 fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
96 fsck_objs = osl.o rbtree.o fsck.o string.o sha1.o fsck.cmdline.o
97
98 *.o: para.h config.h gcc-compat.h
99
100 include Makefile.deps
101
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                 fsck.ggo) O="--unamed-opts=table";; \
139         esac; \
140         echo "$O"; if test $< != fsck.ggo; then O="$$O --conf-parser "; fi; \
141         gengetopt $$O \
142                 --no-handle-version \
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 afs_command_list.man
157 man/man1/para_server.1: para_server $(server_command_lists)
158         mkdir -p man/man1
159         opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
160         help2man $$opts ./para_server > $@
161
162 man/man1/para_audiod.1: para_audiod audiod_command_list.man
163         mkdir -p man/man1
164         help2man -N -i audiod_command_list.man ./para_audiod > $@
165
166 man/man1/%.1: %
167         mkdir -p man/man1
168         help2man -N ./$< > $@
169
170 man/html/%.html: man/man1/%.1
171         mkdir -p man/html
172         man2html $< > $@
173
174
175
176 ortp_recv.o: ortp_recv.c
177         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
178
179 ortp_send.o: ortp_send.c
180         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
181
182 oggdec.o: oggdec.c
183         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
184 ogg_afh.o: ogg_afh.c
185         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
186
187 mp3dec.o: mp3dec.c
188         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
189
190 aacdec.o: aacdec.c
191         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
192
193 aac_common.o: aac_common.c
194         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
195
196 aac_afh.o: aac_afh.c
197         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
198
199 %.cmdline.o: %.cmdline.c
200         $(CC) -c $(CPPFLAGS) $<
201
202 %.o: %.c
203         $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
204
205 para_recv: @recv_objs@
206         $(CC) $(LDFLAGS) @recv_objs@ -o $@ @recv_ldflags@
207
208 para_filter: @filter_objs@
209         $(CC) $(LDFLAGS) @filter_objs@ -o $@ @filter_ldflags@
210
211 para_client: @client_objs@
212         $(CC) $(LDFLAGS) -o $@ @client_objs@ @client_ldflags@
213
214 para_gui: @gui_objs@
215         $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses
216
217 para_audiod: @audiod_objs@
218         $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@
219
220 para_audioc: @audioc_objs@
221         $(CC) $(LDFLAGS) -o $@ @audioc_objs@ @audioc_ldflags@
222
223 para_fade: $(fade_objs)
224         $(CC) $(LDFLAGS) -o $@ $(fade_objs)
225
226 para_server: @server_objs@
227         $(CC) $(LDFLAGS) -o $@ @server_objs@  @server_ldflags@
228
229 para_fsck: @fsck_objs@
230         $(CC) $(LDFLAGS) -o $@ @fsck_objs@ @fsck_ldflags@
231
232 para_write: @write_objs@
233         $(CC) $(LDFLAGS) -o $@ @write_objs@ @write_ldflags@
234
235 clean:
236         rm -f *.o $(BINARIES)
237 distclean: clean
238         rm -f Makefile autoscan.log config.status config.log && \
239         rm -rf web/sync/* autom4te.cache aclocal.m4
240         rm -f GPATH GRTAGS GSYMS GTAGS
241
242 maintainer-clean: distclean
243         rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
244                 $(grutatxt_html) config.h configure \
245                 config.h.in skencil/*.pdf skencil/*.ps
246         rm -f *_command_list.* *.man man/man1/* man/html/*
247
248
249 install: all man
250         mkdir -p $(BINDIR) $(PICDIR) $(MANDIR)
251         $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
252         $(install_sh) -m 644 $(PICS) $(PICDIR)
253         $(install_sh) -m 644 $(man_pages) $(MANDIR)
254         mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
255
256 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) $(man_pages)
257         rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
258         git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
259                 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
260         mkdir $(tarball_pfx)
261         cp -r $(tarball_add) $(tarball_pfx)
262         mkdir -p $(tarball_pfx)/man/man1
263         cp -r $(man_pages) $(tarball_pfx)/man/man1
264         tar rf $(tarball_pfx).tar $(tarball_pfx)/*
265         rm -rf $(tarball_pfx)
266         bzip2 -9 $(tarball_pfx).tar
267         rm -f $(tarball_pfx).tar
268         ls -l $(tarball_pfx).tar.bz2
269
270 web/%.in.html: %
271         grutatxt -nb  < $< > $@
272 tags:
273         rm -rf web/sync/HTML && gtags && htags -nF && mv HTML web/sync
274 web/header2.html: web/header.html
275         sed -e 's|href="|href="\.\.\/\.\./|g' \
276                 -e 's|SRC="|SRC="\.\.\/\.\./|g' $< > $@
277 doxygen: web/header2.html
278         mkdir -p web/sync/doxygen
279         doxygen
280 web/sync/man: html_man
281         mkdir -p $@
282         cp -a $(man_pages_html) $@
283 web/sync/%.html: web/%.in.html web/header.html web/footer.html web/sync
284         cat web/header.html $< web/footer.html > $@
285 web/sync/%.png: pics/web/%.png web/sync
286         cp $< $@
287 web/sync/%.ico: pics/web/%.ico web/sync
288         cp $< $@
289 web/sync/para.css: web/para.css web/sync
290         cp $< $@
291 web/sync/versions/@PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2 web/sync
292         cp -a versions web/sync && cp $< $@
293 web/sync/overview.pdf: skencil/overview.pdf web/sync
294         cp $< $@
295 web/sync/%: %
296         cp -a $< $@
297 web/sync/%: pics/screenshots/%
298         cp $< $@
299 skencil/%.ps: skencil/%.sk
300         sk2ps $< > $@
301 %.pdf: %.ps
302         ps2pdf - - < $< > $@