Move ggo files to a separate directory.
[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 := elliptic inheritance
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 # DEBUG_CPPFLAGS += -Wdeclaration-after-statement
27
28 # many warnings about trivial stuff
29 # CPPFLAGS += -Wconversion
30
31 ifeq ($(uname_s),Linux)
32 CPPFLAGS += -fdata-sections -ffunction-sections
33 LDFLAGS += -Wl,--gc-sections
34 CPPFLAGS += -Wstrict-prototypes
35 CPPFLAGS += -Wshadow
36 endif
37 CPPFLAGS += -Os
38 CPPFLAGS += -Wall
39 CPPFLAGS += -Wuninitialized
40 CPPFLAGS += -Wchar-subscripts
41 CPPFLAGS += -Wformat-security
42 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
43 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
44 CPPFLAGS += -DUNAME_RS='"$(uname_rs)"'
45 CPPFLAGS += -DCODENAME='"$(codename)"'
46 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
47 CPPFLAGS += -Werror-implicit-function-declaration
48 CPPFLAGS += -Wmissing-format-attribute
49 CPPFLAGS += -Wmissing-noreturn
50 CPPFLAGS += -Wunused-macros
51 CPPFLAGS += -Wbad-function-cast
52 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
53 CPPFLAGS += @SSL_CPPFLAGS@
54 CPPFLAGS += @ncurses_cppflags@
55 CPPFLAGS += @arch_cppflags@
56
57 BINARIES = para_server para_client para_audioc para_recv \
58 para_filter para_write para_fsck para_afh @extra_binaries@
59 man_binaries := $(BINARIES)
60 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
61 man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
62 ggo_dir := ggo
63 gengetopts := $(wildcard $(ggo_dir)/*.ggo)
64 gengetopts_c := $(patsubst %/,, $(gengetopts:.ggo=.cmdline.c))
65 gengetopts_h := $(patsubst %/,, $(gengetopts:.ggo=.cmdline.h))
66 autocrap := config.h.in configure
67 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
68 tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
69 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
70 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
71 tarball := @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2
72
73 .PHONY: clean distclean maintainer-clean install man tarball
74 all: $(BINARIES) $(man_pages)
75 man: $(man_pages)
76 tarball: $(tarball)
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: $(ggo_dir)/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,,$(<F)).cmdline \
93 --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
94
95 %_recv.cmdline.h %_recv.cmdline.c: $(ggo_dir)/%_recv.ggo
96 gengetopt $(module_ggo_opts) \
97 --set-package=$(subst .ggo,,$(<F)) \
98 --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
99 --file-name=$(subst .ggo,,$(<F)).cmdline \
100 --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
101
102 %_filter.cmdline.h %_filter.cmdline.c: $(ggo_dir)/%_filter.ggo
103 gengetopt $(module_ggo_opts) \
104 --set-package=$(subst .ggo,,$(<F)) \
105 --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
106 --file-name=$(subst .ggo,,$(<F)).cmdline \
107 --func-name $(subst _filter.ggo,,$(<F))_cmdline_parser < $<
108 %_write.cmdline.h %_write.cmdline.c: $(ggo_dir)/%_write.ggo
109 gengetopt -S $(module_ggo_opts) \
110 --set-package=$(subst .ggo,,$(<F)) \
111 --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
112 --file-name=$(subst .ggo,,$(<F)).cmdline \
113 --func-name $(subst _write.ggo,,$(<F))_cmdline_parser < $<
114
115 %.cmdline.h %.cmdline.c: $(ggo_dir)/%.ggo
116 case $(<F) 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 recv.ggo) O="--no-handle-help";; \
121 filter.ggo) O="--no-handle-help";; \
122 write.ggo) O="--no-handle-help";; \
123 audiod.ggo) O="--no-handle-help";; \
124 esac; \
125 if test $(<F) != fsck.ggo; then O="$$O --conf-parser "; fi; \
126 gengetopt $$O \
127 --no-handle-version \
128 --file-name=$(*F).cmdline \
129 --func-name $(*F)_cmdline_parser \
130 --arg-struct-name=$(*F)_args_info \
131 --set-package="para_$(subst .cmdline,,$(*F))" \
132 --set-version="@PACKAGE_VERSION@" < $<
133
134 %_command_list.c %_command_list.h: %.cmd
135 ./command_util.sh c < $< >$@
136 ./command_util.sh h < $< >$(@:%.c=%.h)
137
138 %_command_list.man: %.cmd
139 ./command_util.sh man < $< > $@
140
141 server_command_lists = server_command_list.man afs_command_list.man
142 man/man1/para_server.1: para_server $(server_command_lists)
143 mkdir -p man/man1
144 opts="-h --detailed-help -N `for i in $(server_command_lists); do printf "%s\n" "-i $$i"; done`"; \
145 help2man $$opts ./para_server > $@
146
147 man/man1/para_audiod.1: para_audiod audiod_command_list.man
148 mkdir -p man/man1
149 help2man -h --detailed-help -N -i audiod_command_list.man ./para_audiod > $@
150
151 man/man1/para_filter.1: para_filter
152 mkdir -p man/man1
153 help2man -h --detailed-help -N ./$< > $@
154
155 man/man1/para_write.1: para_write
156 mkdir -p man/man1
157 help2man -h --detailed-help -N ./$< > $@
158
159 man/man1/para_recv.1: para_recv
160 mkdir -p man/man1
161 help2man -h --detailed-help -N ./$< > $@
162
163 man/man1/%.1: %
164 mkdir -p man/man1
165 help2man -N ./$< > $@
166
167 man/html/%.html: man/man1/%.1
168 mkdir -p man/html
169 man2html $< > $@
170
171 web/%.man.in.html: man/man1/%.1
172 man2html $< | sed -e '/^<\/BODY>/,$$d' -e '1,/<\/HEAD><BODY>/d' > $@
173
174
175 oggdec_filter.o: oggdec_filter.c
176 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
177 ogg_afh.o: ogg_afh.c
178 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
179
180 mp3dec_filter.o: mp3dec_filter.c
181 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
182
183 aacdec_filter.o: aacdec_filter.c
184 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
185
186 aac_common.o: aac_common.c
187 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
188
189 aac_afh.o: aac_afh.c
190 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
191
192 %.cmdline.o: %.cmdline.c
193 $(CC) -c $(CPPFLAGS) $<
194
195 %.o: %.c
196 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
197
198 para_recv: @recv_objs@
199 $(CC) $(LDFLAGS) @recv_objs@ -o $@ @recv_ldflags@
200
201 para_filter: @filter_objs@
202 $(CC) $(LDFLAGS) @filter_objs@ -o $@ @filter_ldflags@
203
204 para_client: @client_objs@
205 $(CC) $(LDFLAGS) -o $@ @client_objs@ @client_ldflags@
206
207 para_gui: @gui_objs@
208 $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses
209
210 para_audiod: @audiod_objs@
211 $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@
212
213 para_audioc: @audioc_objs@
214 $(CC) $(LDFLAGS) -o $@ @audioc_objs@ @audioc_ldflags@
215
216 para_fade: @fade_objs@
217 $(CC) $(LDFLAGS) -o $@ @fade_objs@
218
219 para_server: @server_objs@
220 $(CC) $(LDFLAGS) -o $@ @server_objs@ @server_ldflags@
221
222 para_fsck: @fsck_objs@
223 $(CC) $(LDFLAGS) -o $@ @fsck_objs@ @fsck_ldflags@
224
225 para_write: @write_objs@
226 $(CC) $(LDFLAGS) -o $@ @write_objs@ @write_ldflags@
227
228 para_afh: @afh_objs@
229 $(CC) $(LDFLAGS) -o $@ @afh_objs@ @afh_ldflags@
230
231 clean:
232 rm -f *.o $(BINARIES)
233 rm -rf man
234 distclean: clean
235 rm -f Makefile autoscan.log config.status config.log && \
236 rm -rf web/sync/* autom4te.cache aclocal.m4
237 rm -f GPATH GRTAGS GSYMS GTAGS
238
239 maintainer-clean: distclean
240 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
241 config.h configure \
242 config.h.in skencil/*.pdf skencil/*.ps
243 rm -f *_command_list.* *.man man/man1/*
244 rm -rf web_sync
245
246 install: all man
247 mkdir -p $(BINDIR) $(MANDIR)
248 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
249 $(install_sh) -m 644 $(man_pages) $(MANDIR)
250 mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
251
252 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add)
253 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
254 git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
255 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
256 mkdir $(tarball_pfx)
257 cp -r $(tarball_add) $(tarball_pfx)
258 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
259 rm -rf $(tarball_pfx)
260 bzip2 -9 $(tarball_pfx).tar
261 rm -f $(tarball_pfx).tar
262 ls -l $(tarball_pfx).tar.bz2
263 %.ps: %.sk
264 sk2ps $< > $@
265 %.pdf: %.ps
266 ps2pdf - - < $< > $@
267