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@
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 := cubic continuity
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
24 # invalid option for gcc-3.3.3
25 # DEBUG_CPPFLAGS += -Wextra
26 # DEBUG_CPPFLAGS += -Wold-style-definition
27 # DEBUG_CPPFLAGS += -Wdeclaration-after-statement
29 # many warnings about trivial stuff
30 # CPPFLAGS += -Wconversion
32 ifeq ($(uname_s),Linux)
33 CPPFLAGS += -fdata-sections -ffunction-sections
34 LDFLAGS += -Wl,--gc-sections
35 CPPFLAGS += -Wstrict-prototypes
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 += -fno-strict-aliasing
54 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
55 CPPFLAGS += @SSL_CPPFLAGS@
56 CPPFLAGS += @ncurses_cppflags@
57 CPPFLAGS += @arch_cppflags@
59 BINARIES = para_server para_client para_audioc para_recv \
60 para_filter para_write para_fsck para_afh @extra_binaries@
61 man_binaries := $(BINARIES)
62 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
63 man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
67 m4_ggos := afh audioc audiod client filter fsck gui recv server write
68 all_ggos := $(m4_ggos) dccp_recv oggdec_filter alsa_write oss_write fade http_recv \
69 osx_write udp_recv amp_filter compress_filter file_write \
70 grab_client mp3dec_filter
71 ggo_generated := $(addsuffix .cmdline.c, $(all_ggos)) $(addsuffix .cmdline.h, $(all_ggos)) \
72 $(addsuffix .ggo, $(addprefix $(ggo_dir)/,$(m4_ggos)))
74 autocrap := config.h.in configure
75 tarball_pfx := @PACKAGE_TARNAME@-$(PACKAGE_VERSION)
76 tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
77 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
78 tarball_add := $(ggo_generated) $(autocrap)
79 tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2
81 .PHONY: clean distclean maintainer-clean install man tarball
82 all: $(BINARIES) $(man_pages)
86 *.o: para.h config.h gcc-compat.h
89 include $(ggo_dir)/makefile
91 %_command_list.c %_command_list.h: %.cmd
92 ./command_util.sh c < $< >$@
93 ./command_util.sh h < $< >$(@:%.c=%.h)
95 %_command_list.man: %.cmd
96 ./command_util.sh man < $< > $@
98 server_command_lists = server_command_list.man afs_command_list.man
99 man/man1/para_server.1: para_server $(server_command_lists)
101 opts="-h --detailed-help -N `for i in $(server_command_lists); do printf "%s\n" "-i $$i"; done`"; \
102 help2man $$opts ./para_server > $@
104 man/man1/para_audiod.1: para_audiod audiod_command_list.man
106 help2man -h --detailed-help -N -i audiod_command_list.man ./para_audiod > $@
110 help2man -h --detailed-help -N ./$< > $@
112 man/html/%.html: man/man1/%.1
116 web/%.man.in.html: man/man1/%.1
117 man2html $< | sed -e '/^<\/BODY>/,$$d' -e '1,/<\/HEAD><BODY>/d' > $@
120 oggdec_filter.o: oggdec_filter.c
121 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
123 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
125 mp3dec_filter.o: mp3dec_filter.c
126 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
128 aacdec_filter.o: aacdec_filter.c
129 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
131 aac_common.o: aac_common.c
132 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
135 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
137 %.cmdline.o: %.cmdline.c
138 $(CC) -c $(CPPFLAGS) $<
141 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
143 para_recv: @recv_objs@
144 $(CC) $(LDFLAGS) @recv_objs@ -o $@ @recv_ldflags@
146 para_filter: @filter_objs@
147 $(CC) $(LDFLAGS) @filter_objs@ -o $@ @filter_ldflags@
149 para_client: @client_objs@
150 $(CC) $(LDFLAGS) -o $@ @client_objs@ @client_ldflags@
153 $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses
155 para_audiod: @audiod_objs@
156 $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@
158 para_audioc: @audioc_objs@
159 $(CC) $(LDFLAGS) -o $@ @audioc_objs@ @audioc_ldflags@
161 para_fade: @fade_objs@
162 $(CC) $(LDFLAGS) -o $@ @fade_objs@ @fade_ldflags@
164 para_server: @server_objs@
165 $(CC) $(LDFLAGS) -o $@ @server_objs@ @server_ldflags@
167 para_fsck: @fsck_objs@
168 $(CC) $(LDFLAGS) -o $@ @fsck_objs@ @fsck_ldflags@
170 para_write: @write_objs@
171 $(CC) $(LDFLAGS) -o $@ @write_objs@ @write_ldflags@
174 $(CC) $(LDFLAGS) -o $@ @afh_objs@ @afh_ldflags@
177 rm -f *.o $(BINARIES)
180 rm -f Makefile autoscan.log config.status config.log && \
181 rm -rf web/sync/* autom4te.cache aclocal.m4
182 rm -f GPATH GRTAGS GSYMS GTAGS
184 maintainer-clean: distclean
185 rm -f $(ggo_generated) *.tar.bz2 \
187 config.h.in skencil/*.pdf skencil/*.ps
188 rm -f *_command_list.* *.man man/man1/*
192 mkdir -p $(BINDIR) $(MANDIR)
193 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
194 $(install_sh) -m 644 $(man_pages) $(MANDIR)
195 mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
197 @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2: $(tarball_add)
198 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
199 git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
200 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
202 cp -r $(tarball_add) $(tarball_pfx)
203 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
204 rm -rf $(tarball_pfx)
205 bzip2 -9 $(tarball_pfx).tar
206 rm -f $(tarball_pfx).tar
207 ls -l $(tarball_pfx).tar.bz2