2 exec_prefix := @exec_prefix@
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 cmdline_dir := @cmdline_dir@
13 build_date := $(shell date)
14 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
15 uname_rs := $(shell uname -rs)
16 cc_version := $(shell $(CC) --version | head -n 1)
17 codename := simultaneous independence
19 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
20 DEBUG_CPPFLAGS += -Wredundant-decls
21 # produces false positives
22 # DEBUG_CPPFLAGS += -Wunreachable-code
23 # DEBUG_CPPFLAGS += -Wwrite-strings
25 # invalid option for gcc-3.3.3
26 # DEBUG_CPPFLAGS += -Wextra
27 # DEBUG_CPPFLAGS += -Wold-style-definition
28 # DEBUG_CPPFLAGS += -Wdeclaration-after-statement
30 # many warnings about trivial stuff
31 # CPPFLAGS += -Wconversion
33 ifeq ($(uname_s),Linux)
34 CPPFLAGS += -fdata-sections -ffunction-sections
35 LDFLAGS += -Wl,--gc-sections
36 CPPFLAGS += -Wstrict-prototypes
41 CPPFLAGS += -Wuninitialized
42 CPPFLAGS += -Wchar-subscripts
43 CPPFLAGS += -Wformat-security
44 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
45 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
46 CPPFLAGS += -DUNAME_RS='"$(uname_rs)"'
47 CPPFLAGS += -DCODENAME='"$(codename)"'
48 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
49 CPPFLAGS += -Werror-implicit-function-declaration
50 CPPFLAGS += -Wmissing-format-attribute
51 CPPFLAGS += -Wmissing-noreturn
52 CPPFLAGS += -Wunused-macros
53 CPPFLAGS += -Wbad-function-cast
54 CPPFLAGS += -fno-strict-aliasing
55 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
56 CPPFLAGS += @SSL_CPPFLAGS@
57 CPPFLAGS += @ncurses_cppflags@
58 CPPFLAGS += @arch_cppflags@
59 CPPFLAGS += -I/usr/local/include
60 CPPFLAGS += -I$(cmdline_dir)
61 CPPFLAGS += @osl_cppflags@
62 CPPFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"'
64 BINARIES = para_server para_client para_audioc para_recv \
65 para_filter para_write para_afh @extra_binaries@
66 man_binaries := $(BINARIES)
67 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
68 man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
73 m4_ggos := afh audioc audiod client filter gui recv server write
74 all_ggos := $(m4_ggos) dccp_recv oggdec_filter alsa_write oss_write fade http_recv \
75 osx_write udp_recv amp_filter compress_filter file_write \
76 mp3dec_filter prebuffer_filter
77 ggo_generated := $(addsuffix .ggo, $(addprefix $(ggo_dir)/,$(m4_ggos)))
78 cmdline_generated := $(addprefix $(cmdline_dir)/,$(addsuffix .cmdline.c, $(all_ggos)) \
79 $(addsuffix .cmdline.h, $(all_ggos)))
81 autocrap := config.h.in configure
82 tarball_pfx := @PACKAGE_TARNAME@-$(PACKAGE_VERSION)
83 tarball_delete := $(addprefix $(tarball_pfx)/,\
84 web versions .changelog_before_cvs .changelog_cvs .gitignore\
86 tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2
88 .PHONY: all clean distclean maintainer-clean install man tarball\
89 .FORCE-GIT-VERSION-FILE
90 all: $(BINARIES) $(man_pages)
94 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
95 @./GIT-VERSION-GEN GIT-VERSION-FILE
96 -include GIT-VERSION-FILE
97 $(BINARIES): GIT-VERSION-FILE
99 -include $(ggo_dir)/makefile
101 %_command_list.c: %.cmd
102 ./command_util.sh c < $< >$@
103 %_command_list.h: %.cmd
104 ./command_util.sh h < $< >$@
105 %_command_list.man: %.cmd
106 ./command_util.sh man < $< > $@
108 server_command_lists_ch = server_command_list.c afs_command_list.c \
109 server_command_list.h afs_command_list.h
110 server_command_lists_man = server_command_list.man afs_command_list.man
111 man/man1/para_server.1: para_server $(server_command_lists_man)
113 opts="-h --detailed-help -N `for i in $(server_command_lists_man); do printf "%s\n" "-i $$i"; done`"; \
114 help2man $$opts ./para_server > $@
116 man/man1/para_audiod.1: para_audiod audiod_command_list.man
118 help2man -h --detailed-help -N -i audiod_command_list.man ./para_audiod > $@
122 help2man -h --detailed-help -N ./$< > $@
124 man/html/%.html: man/man1/%.1
128 web/%.man.in.html: man/man1/%.1
129 man2html $< | sed -e '/^<\/BODY>/,$$d' -e '1,/<\/HEAD><BODY>/d' > $@
134 $(object_dir)/oggdec_filter.o: oggdec_filter.c | $(object_dir)
135 $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
137 $(object_dir)/ogg_afh.o: ogg_afh.c | $(object_dir)
138 $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
140 $(object_dir)/mp3dec_filter.o: mp3dec_filter.c | $(object_dir)
141 $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
143 $(object_dir)/aacdec_filter.o: aacdec_filter.c | $(object_dir)
144 $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
146 $(object_dir)/aac_common.o: aac_common.c | $(object_dir)
147 $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
149 $(object_dir)/aac_afh.o: aac_afh.c | $(object_dir)
150 $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
152 $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h | $(object_dir)
153 $(CC) -c $(CPPFLAGS) -o $@ $<
155 $(object_dir)/%.o: %.c | $(object_dir)
156 $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
158 # We depend on the *.cmdline.[ch] files as these must be present for depend.sh
159 # to work. The first dependency is explititly given as it is used by $<.
160 $(object_dir)/%.cmdline.d: %.cmdline.c $(cmdline_generated) | $(object_dir)
161 ./depend.sh $(object_dir) $(CPPFLAGS) $< > $@
162 $(object_dir)/%.d: %.c $(cmdline_generated) | $(object_dir)
163 ./depend.sh $(object_dir) $(CPPFLAGS) $< > $@
165 recv_objs := $(addprefix $(object_dir)/, @recv_objs@)
166 filter_objs := $(addprefix $(object_dir)/, @filter_objs@)
167 client_objs := $(addprefix $(object_dir)/, @client_objs@)
168 gui_objs := $(addprefix $(object_dir)/, @gui_objs@)
169 audiod_objs := $(addprefix $(object_dir)/, @audiod_objs@)
170 audioc_objs := $(addprefix $(object_dir)/, @audioc_objs@)
171 fade_objs := $(addprefix $(object_dir)/, @fade_objs@)
172 server_objs := $(addprefix $(object_dir)/, @server_objs@)
173 write_objs := $(addprefix $(object_dir)/, @write_objs@)
174 afh_objs := $(addprefix $(object_dir)/, @afh_objs@)
176 all_objs := $(recv_objs) $(filter_objs) $(client_objs) $(gui_objs) \
177 $(audiod_objs ) $(audioc_objs) $(fade_objs) $(server_objs) \
178 $(write_objs) $(afh_objs)
179 -include $(all_objs:.o=.d)
181 para_recv: $(recv_objs)
182 $(CC) $(LDFLAGS) $(recv_objs) -o $@ @recv_ldflags@
184 para_filter: $(filter_objs)
185 $(CC) $(LDFLAGS) $(filter_objs) -o $@ @filter_ldflags@
187 para_client: $(client_objs)
188 $(CC) $(LDFLAGS) -o $@ $(client_objs) @client_ldflags@
190 para_gui: $(gui_objs)
191 $(CC) $(LDFLAGS) -o $@ $(gui_objs) -lncurses
193 para_audiod: audiod_command_list.c audiod_command_list.h $(audiod_objs)
194 $(CC) $(LDFLAGS) -o $@ $(audiod_objs) @audiod_ldflags@
196 para_audioc: $(audioc_objs)
197 $(CC) $(LDFLAGS) -o $@ $(audioc_objs) @audioc_ldflags@
199 para_fade: $(fade_objs)
200 $(CC) $(LDFLAGS) -o $@ $(fade_objs) @fade_ldflags@
202 para_server: $(server_command_lists_ch) $(server_objs)
203 $(CC) $(LDFLAGS) -o $@ $(server_objs) @server_ldflags@
205 para_write: $(write_objs)
206 $(CC) $(LDFLAGS) -o $@ $(write_objs) @write_ldflags@
208 para_afh: $(afh_objs)
209 $(CC) $(LDFLAGS) -o $@ $(afh_objs) @afh_ldflags@
212 rm -f $(BINARIES) $(object_dir)/*.o
215 rm -rf man $(object_dir)
216 rm -f *_command_list.*
219 rm -f Makefile autoscan.log config.status config.log && \
220 rm -rf autom4te.cache aclocal.m4
221 rm -f GPATH GRTAGS GSYMS GTAGS
223 maintainer-clean: distclean
224 rm -f $(ggo_generated) *.tar.bz2 \
226 config.h.in skencil/*.pdf skencil/*.ps
227 rm -rf web_sync $(cmdline_dir)
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
235 $(tarball): $(cmdline_generated)
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 -p $(tarball_pfx)/$(cmdline_dir)
240 echo $(GIT_VERSION) > $(tarball_pfx)/VERSION
241 cp -r $(autocrap) $(tarball_pfx)
242 cp -r $(cmdline_generated) $(tarball_pfx)/$(cmdline_dir)
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