Move gengetopt targets to own Makefile.
[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 PACKAGE_VERSION := @PACKAGE_VERSION@
9 PACKAGE_STRING := @PACKAGE_STRING@
10 install_sh := @install_sh@
11
12 build_date := $(shell date)
13 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
14 uname_rs := $(shell uname -rs)
15 cc_version := $(shell $(CC) --version | head -n 1)
16 codename := elliptic inheritance
17
18 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
19 DEBUG_CPPFLAGS += -Wredundant-decls
20 # produces false positives
21 # DEBUG_CPPFLAGS += -Wunreachable-code
22 # DEBUG_CPPFLAGS += -Wwrite-strings
23
24 # invalid option for gcc-3.3.3
25 # DEBUG_CPPFLAGS += -Wextra
26 # DEBUG_CPPFLAGS += -Wold-style-definition
27 # DEBUG_CPPFLAGS += -Wdeclaration-after-statement
28
29 # many warnings about trivial stuff
30 # CPPFLAGS += -Wconversion
31
32 ifeq ($(uname_s),Linux)
33 CPPFLAGS += -fdata-sections -ffunction-sections
34 LDFLAGS += -Wl,--gc-sections
35 CPPFLAGS += -Wstrict-prototypes
36 CPPFLAGS += -Wshadow
37 endif
38 CPPFLAGS += -Os
39 CPPFLAGS += -Wall
40 CPPFLAGS += -Wuninitialized
41 CPPFLAGS += -Wchar-subscripts
42 CPPFLAGS += -Wformat-security
43 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
44 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
45 CPPFLAGS += -DUNAME_RS='"$(uname_rs)"'
46 CPPFLAGS += -DCODENAME='"$(codename)"'
47 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
48 CPPFLAGS += -Werror-implicit-function-declaration
49 CPPFLAGS += -Wmissing-format-attribute
50 CPPFLAGS += -Wmissing-noreturn
51 CPPFLAGS += -Wunused-macros
52 CPPFLAGS += -Wbad-function-cast
53 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
54 CPPFLAGS += @SSL_CPPFLAGS@
55 CPPFLAGS += @ncurses_cppflags@
56 CPPFLAGS += @arch_cppflags@
57
58 BINARIES = para_server para_client para_audioc para_recv \
59 para_filter para_write para_fsck para_afh @extra_binaries@
60 man_binaries := $(BINARIES)
61 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
62 man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
63 ggo_dir := ggo
64 gengetopts := $(wildcard $(ggo_dir)/*.ggo)
65 gengetopts_c := $(patsubst %/,, $(gengetopts:.ggo=.cmdline.c))
66 gengetopts_h := $(patsubst %/,, $(gengetopts:.ggo=.cmdline.h))
67 autocrap := config.h.in configure
68 tarball_pfx := @PACKAGE_TARNAME@-$(PACKAGE_VERSION)
69 tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
70 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
71 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
72 tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2
73
74 .PHONY: clean distclean maintainer-clean install man tarball
75 all: $(BINARIES) $(man_pages)
76 man: $(man_pages)
77 tarball: $(tarball)
78
79 *.o: para.h config.h gcc-compat.h
80
81 include Makefile.deps
82 include $(ggo_dir)/Makefile.ggo
83
84 %_command_list.c %_command_list.h: %.cmd
85 ./command_util.sh c < $< >$@
86 ./command_util.sh h < $< >$(@:%.c=%.h)
87
88 %_command_list.man: %.cmd
89 ./command_util.sh man < $< > $@
90
91 server_command_lists = server_command_list.man afs_command_list.man
92 man/man1/para_server.1: para_server $(server_command_lists)
93 mkdir -p man/man1
94 opts="-h --detailed-help -N `for i in $(server_command_lists); do printf "%s\n" "-i $$i"; done`"; \
95 help2man $$opts ./para_server > $@
96
97 man/man1/para_audiod.1: para_audiod audiod_command_list.man
98 mkdir -p man/man1
99 help2man -h --detailed-help -N -i audiod_command_list.man ./para_audiod > $@
100
101 man/man1/para_filter.1: para_filter
102 mkdir -p man/man1
103 help2man -h --detailed-help -N ./$< > $@
104
105 man/man1/para_write.1: para_write
106 mkdir -p man/man1
107 help2man -h --detailed-help -N ./$< > $@
108
109 man/man1/para_recv.1: para_recv
110 mkdir -p man/man1
111 help2man -h --detailed-help -N ./$< > $@
112
113 man/man1/%.1: %
114 mkdir -p man/man1
115 help2man -N ./$< > $@
116
117 man/html/%.html: man/man1/%.1
118 mkdir -p man/html
119 man2html $< > $@
120
121 web/%.man.in.html: man/man1/%.1
122 man2html $< | sed -e '/^<\/BODY>/,$$d' -e '1,/<\/HEAD><BODY>/d' > $@
123
124
125 oggdec_filter.o: oggdec_filter.c
126 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
127 ogg_afh.o: ogg_afh.c
128 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
129
130 mp3dec_filter.o: mp3dec_filter.c
131 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
132
133 aacdec_filter.o: aacdec_filter.c
134 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
135
136 aac_common.o: aac_common.c
137 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
138
139 aac_afh.o: aac_afh.c
140 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
141
142 %.cmdline.o: %.cmdline.c
143 $(CC) -c $(CPPFLAGS) $<
144
145 %.o: %.c
146 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
147
148 para_recv: @recv_objs@
149 $(CC) $(LDFLAGS) @recv_objs@ -o $@ @recv_ldflags@
150
151 para_filter: @filter_objs@
152 $(CC) $(LDFLAGS) @filter_objs@ -o $@ @filter_ldflags@
153
154 para_client: @client_objs@
155 $(CC) $(LDFLAGS) -o $@ @client_objs@ @client_ldflags@
156
157 para_gui: @gui_objs@
158 $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses
159
160 para_audiod: @audiod_objs@
161 $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@
162
163 para_audioc: @audioc_objs@
164 $(CC) $(LDFLAGS) -o $@ @audioc_objs@ @audioc_ldflags@
165
166 para_fade: @fade_objs@
167 $(CC) $(LDFLAGS) -o $@ @fade_objs@
168
169 para_server: @server_objs@
170 $(CC) $(LDFLAGS) -o $@ @server_objs@ @server_ldflags@
171
172 para_fsck: @fsck_objs@
173 $(CC) $(LDFLAGS) -o $@ @fsck_objs@ @fsck_ldflags@
174
175 para_write: @write_objs@
176 $(CC) $(LDFLAGS) -o $@ @write_objs@ @write_ldflags@
177
178 para_afh: @afh_objs@
179 $(CC) $(LDFLAGS) -o $@ @afh_objs@ @afh_ldflags@
180
181 clean:
182 rm -f *.o $(BINARIES)
183 rm -rf man
184 distclean: clean
185 rm -f Makefile autoscan.log config.status config.log && \
186 rm -rf web/sync/* autom4te.cache aclocal.m4
187 rm -f GPATH GRTAGS GSYMS GTAGS
188
189 maintainer-clean: distclean
190 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
191 config.h configure \
192 config.h.in skencil/*.pdf skencil/*.ps
193 rm -f *_command_list.* *.man man/man1/*
194 rm -rf web_sync
195
196 install: all man
197 mkdir -p $(BINDIR) $(MANDIR)
198 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
199 $(install_sh) -m 644 $(man_pages) $(MANDIR)
200 mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
201
202 @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2: $(tarball_add)
203 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
204 git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
205 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
206 mkdir $(tarball_pfx)
207 cp -r $(tarball_add) $(tarball_pfx)
208 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
209 rm -rf $(tarball_pfx)
210 bzip2 -9 $(tarball_pfx).tar
211 rm -f $(tarball_pfx).tar
212 ls -l $(tarball_pfx).tar.bz2
213 %.ps: %.sk
214 sk2ps $< > $@
215 %.pdf: %.ps
216 ps2pdf - - < $< > $@
217