2 exec_prefix = @exec_prefix@
5 VARDIR = /var/paraslash
6 PKGDATADIR = @datarootdir@/@PACKAGE_NAME@
7 MANDIR = @datarootdir@/man/man1
9 install_sh = @install_sh@
11 build_date = $(shell date)
12 system = $(shell uname -rs)
13 cc_version = $(shell $(CC) --version | head -n 1)
14 codename = solar saturation
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
22 # invalid option for gcc-3.3.3
23 # DEBUG_CPPFLAGS += -Wextra
24 # DEBUG_CPPFLAGS += -Wold-style-definition
26 # many warnings about trivial stuff
27 # CPPFLAGS += -Wconversion
29 LDFLAGS += -Wl,--gc-sections
33 CPPFLAGS += -Wuninitialized
34 CPPFLAGS += -Wstrict-prototypes
35 CPPFLAGS += -Wchar-subscripts
36 CPPFLAGS += -Wformat-security
37 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
38 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
39 CPPFLAGS += -DSYSTEM='"$(system)"'
40 CPPFLAGS += -DCODENAME='"$(codename)"'
41 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
42 CPPFLAGS += -Werror-implicit-function-declaration
43 CPPFLAGS += -Wmissing-format-attribute
44 CPPFLAGS += -Wunused-macros
46 CPPFLAGS += -Wbad-function-cast
47 CPPFLAGS += -fdata-sections -ffunction-sections
48 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
49 CPPFLAGS += @SSL_CPPFLAGS@
50 CPPFLAGS += @ncurses_cppflags@
52 BINARIES = para_server para_client para_audioc para_recv \
53 para_filter para_write para_fsck @extra_binaries@
54 man_binaries := $(BINARIES)
55 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
56 man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
57 gengetopts := $(wildcard *.ggo)
58 gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
59 gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
60 autocrap := config.h.in configure
61 tarball_pfx := @PACKAGE_TARNAME@-@PACKAGE_VERSION@
62 tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
63 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
64 tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
65 tarball := @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2
67 .PHONY: clean distclean maintainer-clean install man tarball
72 fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
73 fsck_objs = osl.o rbtree.o fsck.o string.o sha1.o fsck.cmdline.o
75 *.o: para.h config.h gcc-compat.h
79 module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
81 grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
82 gengetopt $(module_ggo_opts) \
88 --arg-struct-name=grab_client_args_info \
89 --file-name=$(subst .ggo,,$<).cmdline \
90 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
92 %_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
93 gengetopt $(module_ggo_opts) \
94 --set-package=$(subst .ggo,,$<) \
95 --arg-struct-name=$(subst .ggo,,$<)_args_info \
96 --file-name=$(subst .ggo,,$<).cmdline \
97 --func-name $(subst .ggo,,$<)_cmdline_parser < $<
99 %_filter.cmdline.h %_filter.cmdline.c: %_filter.ggo
100 gengetopt $(module_ggo_opts) \
101 --set-package=$(subst .ggo,,$<) \
102 --arg-struct-name=$(subst .ggo,,$<)_args_info \
103 --file-name=$(subst .ggo,,$<).cmdline \
104 --func-name $(subst _filter.ggo,,$<)_cmdline_parser < $<
105 %_write.cmdline.h %_write.cmdline.c: %_write.ggo
106 gengetopt -S $(module_ggo_opts) \
107 --set-package=$(subst .ggo,,$<) \
108 --arg-struct-name=$(subst .ggo,,$<)_args_info \
109 --file-name=$(subst .ggo,,$<).cmdline \
110 --func-name $(subst _write.ggo,,$<)_cmdline_parser < $<
112 %.cmdline.h %.cmdline.c: %.ggo
113 case $< in client.ggo) O="--unamed-opts=command";; \
114 audioc.ggo) O="--unamed-opts=command";; \
115 fsck.ggo) O="--unamed-opts=table";; \
117 if test $< != fsck.ggo; then O="$$O --conf-parser "; fi; \
119 --no-handle-version \
120 --file-name=$(*F).cmdline \
121 --func-name $(*F)_cmdline_parser \
122 --arg-struct-name=$(*F)_args_info \
123 --set-package="para_$(subst .cmdline,,$(*F))" \
124 --set-version="@PACKAGE_VERSION@" < $<
126 %_command_list.c %_command_list.h: %.cmd
127 ./command_util.sh c < $< >$@
128 ./command_util.sh h < $< >$(@:%.c=%.h)
130 %_command_list.man: %.cmd
131 ./command_util.sh man < $< > $@
133 server_command_lists = server_command_list.man afs_command_list.man
134 man/man1/para_server.1: para_server $(server_command_lists)
136 opts="-N `for i in $(server_command_lists); do echo "-i $$i"; done`"; \
137 help2man $$opts ./para_server > $@
139 man/man1/para_audiod.1: para_audiod audiod_command_list.man
141 help2man -N -i audiod_command_list.man ./para_audiod > $@
145 help2man -N ./$< > $@
147 man/html/%.html: man/man1/%.1
151 web/%.man.in.html: man/man1/%.1
152 man2html $< | sed -e '/^<\/BODY>/,$$d' -e '1,/<\/HEAD><BODY>/d' > $@
155 ortp_recv.o: ortp_recv.c
156 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
158 ortp_send.o: ortp_send.c
159 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
162 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
164 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @oggvorbis_cppflags@ $<
167 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
170 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
172 aac_common.o: aac_common.c
173 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
176 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
178 %.cmdline.o: %.cmdline.c
179 $(CC) -c $(CPPFLAGS) $<
182 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
184 para_recv: @recv_objs@
185 $(CC) $(LDFLAGS) @recv_objs@ -o $@ @recv_ldflags@
187 para_filter: @filter_objs@
188 $(CC) $(LDFLAGS) @filter_objs@ -o $@ @filter_ldflags@
190 para_client: @client_objs@
191 $(CC) $(LDFLAGS) -o $@ @client_objs@ @client_ldflags@
194 $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses
196 para_audiod: @audiod_objs@
197 $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@
199 para_audioc: @audioc_objs@
200 $(CC) $(LDFLAGS) -o $@ @audioc_objs@ @audioc_ldflags@
202 para_fade: $(fade_objs)
203 $(CC) $(LDFLAGS) -o $@ $(fade_objs)
205 para_server: @server_objs@
206 $(CC) $(LDFLAGS) -o $@ @server_objs@ @server_ldflags@
208 para_fsck: @fsck_objs@
209 $(CC) $(LDFLAGS) -o $@ @fsck_objs@ @fsck_ldflags@
211 para_write: @write_objs@
212 $(CC) $(LDFLAGS) -o $@ @write_objs@ @write_ldflags@
215 rm -f *.o $(BINARIES)
217 rm -f Makefile autoscan.log config.status config.log && \
218 rm -rf web/sync/* autom4te.cache aclocal.m4
219 rm -f GPATH GRTAGS GSYMS GTAGS
221 maintainer-clean: distclean
222 rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
224 config.h.in skencil/*.pdf skencil/*.ps
225 rm -f *_command_list.* *.man man/man1/*
229 mkdir -p $(BINDIR) $(MANDIR)
230 $(install_sh) -s -m 755 $(BINARIES) $(BINDIR)
231 $(install_sh) -m 644 $(man_pages) $(MANDIR)
232 mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
234 @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.bz2: $(tarball_add) $(man_pages)
235 rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
236 git-archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
237 | tar --delete $(tarball_delete) > $(tarball_pfx).tar
239 cp -r $(tarball_add) $(tarball_pfx)
240 mkdir -p $(tarball_pfx)/man/man1
241 cp -r $(man_pages) $(tarball_pfx)/man/man1
242 tar rf $(tarball_pfx).tar $(tarball_pfx)/*
243 rm -rf $(tarball_pfx)
244 bzip2 -9 $(tarball_pfx).tar
245 rm -f $(tarball_pfx).tar
246 ls -l $(tarball_pfx).tar.bz2