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