Merge commit 'remotes/meins/master'
[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 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
13 uname_rs := $(shell uname -rs)
14 cc_version := $(shell $(CC) --version | head -n 1)
15 codename := probabilistic parity
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 ifeq ($(uname_s),Linux)
31 CPPFLAGS += -fdata-sections -ffunction-sections
32 LDFLAGS += -Wl,--gc-sections
33 CPPFLAGS += -Wstrict-prototypes
34 CPPFLAGS += -Wshadow
35 endif
36 CPPFLAGS += -Os
37 CPPFLAGS += -Wall
38 CPPFLAGS += -Wuninitialized
39 CPPFLAGS += -Wchar-subscripts
40 CPPFLAGS += -Wformat-security
41 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
42 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
43 CPPFLAGS += -DUNAME_RS='"$(uname_rs)"'
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 += -Wbad-function-cast
50 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
51 CPPFLAGS += @SSL_CPPFLAGS@
52 CPPFLAGS += @ncurses_cppflags@
53 CPPFLAGS += @arch_cppflags@
54
55 BINARIES = para_server para_client para_audioc para_recv \
56 para_filter para_write para_fsck para_afh @extra_binaries@
57 man_binaries := $(BINARIES)
58 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
59 man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
60 gengetopts := $(wildcard *.ggo)
61 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
62 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
63 autocrap := config.h.in configure
64 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
65 tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
66 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
67 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
68 tarball := @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2
69
70 .PHONY: clean distclean maintainer-clean install man tarball
71 all: $(BINARIES) $(man_pages)
72 man: $(man_pages)
73 tarball: $(tarball)
74
75 fade_objs := fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
76 fsck_objs := osl.o rbtree.o fsck.o string.o sha1.o fsck.cmdline.o
77
78 *.o: para.h config.h gcc-compat.h
79
80 include Makefile.deps
81
82 module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
83
84 grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
85 gengetopt $(module_ggo_opts) \
86 -S \
87 --set-package=grab \
88 --no-handle-help \
89 --no-handle-error \
90 --no-handle-version \
91 --arg-struct-name=grab_client_args_info \
92 --file-name=$(subst .ggo,,$<).cmdline \
93 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
94
95 %_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
96 gengetopt $(module_ggo_opts) \
97 --set-package=$(subst .ggo,,$<) \
98 --arg-struct-name=$(subst .ggo,,$<)_args_info \
99 --file-name=$(subst .ggo,,$<).cmdline \
100 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
101
102 %_filter.cmdline.h %_filter.cmdline.c: %_filter.ggo
103 gengetopt $(module_ggo_opts) \
104 --set-package=$(subst .ggo,,$<) \
105 --arg-struct-name=$(subst .ggo,,$<)_args_info \
106 --file-name=$(subst .ggo,,$<).cmdline \
107 --func-name $(subst _filter.ggo,,$<)_cmdline_parser < $<
108 %_write.cmdline.h %_write.cmdline.c: %_write.ggo
109 gengetopt -S $(module_ggo_opts) \
110 --set-package=$(subst .ggo,,$<) \
111 --arg-struct-name=$(subst .ggo,,$<)_args_info \
112 --file-name=$(subst .ggo,,$<).cmdline \
113 --func-name $(subst _write.ggo,,$<)_cmdline_parser < $<
114
115 %.cmdline.h %.cmdline.c: %.ggo
116 case $< in client.ggo) O="--unamed-opts=command";; \
117 audioc.ggo) O="--unamed-opts=command";; \
118 fsck.ggo) O="--unamed-opts=table";; \
119 afh.ggo) O="--unamed-opts=audio_file";; \
120 esac; \
121 if test $< != fsck.ggo; then O="$$O --conf-parser "; fi; \
122 gengetopt $$O \
123 --no-handle-version \
124 --file-name=$(*F).cmdline \
125 --func-name $(*F)_cmdline_parser \
126 --arg-struct-name=$(*F)_args_info \
127 --set-package="para_$(subst .cmdline,,$(*F))" \
128 --set-version="@PACKAGE_VERSION@" < $<
129
130 %_command_list.c %_command_list.h: %.cmd
131 ./command_util.sh c < $< >$@
132 ./command_util.sh h < $< >$(@:%.c=%.h)
133
134 %_command_list.man: %.cmd
135 ./command_util.sh man < $< > $@
136
137 server_command_lists = server_command_list.man afs_command_list.man
138 man/man1/para_server.1: para_server $(server_command_lists)
139 mkdir -p man/man1
140 opts="-h --detailed-help -N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
141 help2man $$opts ./para_server > $@
142
143 man/man1/para_audiod.1: para_audiod audiod_command_list.man
144 mkdir -p man/man1
145 help2man -N -i audiod_command_list.man ./para_audiod > $@
146
147 man/man1/%.1: %
148 mkdir -p man/man1
149 help2man -N ./$< > $@
150
151 man/html/%.html: man/man1/%.1
152 mkdir -p man/html
153 man2html $< > $@
154
155 web/%.man.in.html: man/man1/%.1
156 man2html $< | sed -e '/^<\/BODY>/,$$d' -e '1,/<\/HEAD><BODY>/d' > $@
157
158
159 ortp_recv.o: ortp_recv.c
160 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
161
162 ortp_send.o: ortp_send.c
163 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
164
165 oggdec.o: oggdec.c
166 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
167 ogg_afh.o: ogg_afh.c
168 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
169
170 mp3dec.o: mp3dec.c
171 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
172
173 aacdec.o: aacdec.c
174 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
175
176 aac_common.o: aac_common.c
177 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
178
179 aac_afh.o: aac_afh.c
180 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
181
182 %.cmdline.o: %.cmdline.c
183 $(CC) -c $(CPPFLAGS) $<
184
185 %.o: %.c
186 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
187
188 para_recv: @recv_objs@
189 $(CC) $(LDFLAGS) @recv_objs@ -o $@ @recv_ldflags@
190
191 para_filter: @filter_objs@
192 $(CC) $(LDFLAGS) @filter_objs@ -o $@ @filter_ldflags@
193
194 para_client: @client_objs@
195 $(CC) $(LDFLAGS) -o $@ @client_objs@ @client_ldflags@
196
197 para_gui: @gui_objs@
198 $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses
199
200 para_audiod: @audiod_objs@
201 $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@
202
203 para_audioc: @audioc_objs@
204 $(CC) $(LDFLAGS) -o $@ @audioc_objs@ @audioc_ldflags@
205
206 para_fade: $(fade_objs)
207 $(CC) $(LDFLAGS) -o $@ $(fade_objs)
208
209 para_server: @server_objs@
210 $(CC) $(LDFLAGS) -o $@ @server_objs@ @server_ldflags@
211
212 para_fsck: @fsck_objs@
213 $(CC) $(LDFLAGS) -o $@ @fsck_objs@ @fsck_ldflags@
214
215 para_write: @write_objs@
216 $(CC) $(LDFLAGS) -o $@ @write_objs@ @write_ldflags@
217
218 para_afh: @afh_objs@
219 $(CC) $(LDFLAGS) -o $@ @afh_objs@ @afh_ldflags@
220
221 clean:
222 rm -f *.o $(BINARIES)
223 rm -rf man
224 distclean: clean
225 rm -f Makefile autoscan.log config.status config.log && \
226 rm -rf web/sync/* autom4te.cache aclocal.m4
227 rm -f GPATH GRTAGS GSYMS GTAGS
228
229 maintainer-clean: distclean
230 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
231 config.h configure \
232 config.h.in skencil/*.pdf skencil/*.ps
233 rm -f *_command_list.* *.man man/man1/*
234 rm -rf web_sync
235
236 install: all man
237 mkdir -p $(BINDIR) $(MANDIR)
238 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
239 $(install_sh) -m 644 $(man_pages) $(MANDIR)
240 mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
241
242 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add)
243 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
244 git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
245 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
246 mkdir $(tarball_pfx)
247 cp -r $(tarball_add) $(tarball_pfx)
248 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
249 rm -rf $(tarball_pfx)
250 bzip2 -9 $(tarball_pfx).tar
251 rm -f $(tarball_pfx).tar
252 ls -l $(tarball_pfx).tar.bz2
253 %.ps: %.sk
254 sk2ps $< > $@
255 %.pdf: %.ps
256 ps2pdf - - < $< > $@
257