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