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