-CPPFLAGS += -Wmissing-format-attribute
-CPPFLAGS += -Wunused-macros
-
-BINARIES = para_server para_client para_gui para_audiod para_audioc para_recv para_filter para_write $(extra_binaries)
-
-FONTS := $(wildcard fonts/*.png)
-PICS := $(wildcard pics/paraslash/*.jpg)
-MANS := $(wildcard doc/man/man1/*.1)
-gengetopts := $(wildcard *.ggo)
-gengetopts_c := $(gengetopts:.ggo=.cmdline.c)
-gengetopts_h := $(gengetopts:.ggo=.cmdline.h)
-all_c_files := $(wildcard *.c)
-c_sources := $(filter-out $(gengetopts_c), $(all_c_files))
-grutatxt := COPYING NEWS README.mysql CREDITS INSTALL README \
- FEATURES GPL
-grutatxt_html := $(grutatxt:=.html)
-html_in := $(wildcard web/*.in.html)
-gen_html := $(subst web/,web/sync/,$(html_in))
-gen_html := $(gen_html:.in.html=.html)
-gruta_in := $(grutatxt:=.in.html)
-gruta_in := $(patsubst %,web/%,$(gruta_in))
-gruta_html := $(grutatxt:=.html)
-gruta_html := $(patsubst %,web/sync/%,$(gruta_html))
-shots := gui-2005-11-12.png para_audiod-startup.txt
-shots += para_krell-2005-02.png para_server-startup.txt
-shots += para_slider-2004-12.png sdl_gui.jpg para_krell-2005-02.png
-shots := $(patsubst %,web/sync/%,$(shots))
-web_pics := web/sync/paraslash.png web/sync/paraslash.ico
-web_misc := demo-script overview.pdf versions/paraslash-git.tar.bz2 PUBLIC_KEY key.anonymous para.css doc
-web_misc := $(patsubst %,web/sync/%,$(web_misc))
-
-misc := bash_completion
-headers := para.h server.h SFont.h crypt.h list.h http.h send.h ortp.h rc4.h \
- close_on_fork.h afs.h db.h gcc-compat.h recv.h filter.h audiod.h \
- grab_client.h error.h net.h ringbuffer.h daemon.h string.h ipc.h dccp.h \
- fd.h write.h write_common.h
-scripts := install-sh configure
-autocrap := Makefile.in config.h.in configure.ac autogen.sh
-tarball := web/sync/doc pics fonts $(c_sources) $(headers) \
- $(misc) $(grutatxt) $(gengetopts) $(autocrap) $(gengetopts_c) $(gengetopts_h) \
- $(scripts)
-
-.PHONY: clean distclean maintainer-clean install html www tags ChangeLog doxygen
-all: $(BINARIES)
-www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) tags doxygen
-
-client_objs = client.cmdline.o client.o net.o string.o crypt.o
-sdl_gui_objs = sdl_gui.cmdline.o SFont.o sdl_gui.o gui_common.o exec.o \
- close_on_fork.o string.o stat.o fd.o
-dbadm_objs = dbadm.o exec.o close_on_fork.o string.o
-fade_objs = fade.cmdline.o fade.o exec.o close_on_fork.o string.o fd.o
-krell_objs = krell.o string.o
-slider_objs = slider.o string.o
-audioc_objs = audioc.cmdline.o audioc.o string.o net.o fd.o
-
-*.o: para.h config.h gcc-compat.h
-
-include Makefile.deps
-
-V := ($(TGZ_PREFIX)@PACKAGE_STRING@, $(codename))\n$(COPYRIGHT)\n$(DISCLAIMER)
-module_ggo_opts := --set-version="(@PACKAGE_STRING@, $(codename))"
-
-grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
- gengetopt $(module_ggo_opts) \
- --set-package=grab \
- --no-handle-help \
- --no-handle-error \
- --no-handle-version \
- --arg-struct-name=grab_client_args_info \
- --file-name=$(subst .ggo,,$<).cmdline \
- --func-name $(subst .ggo,,$<)_cmdline_parser < $<
-
-%_recv.cmdline.h %_recv.cmdline.c: %_recv.ggo
- gengetopt $(module_ggo_opts) \
- --set-package=$(subst .ggo,,$<) \
- --arg-struct-name=$(subst .ggo,,$<)_args_info \
- --file-name=$(subst .ggo,,$<).cmdline \
- --func-name $(subst .ggo,,$<)_cmdline_parser < $<
-
-%_filter.cmdline.h %_filter.cmdline.c: %_filter.ggo
- gengetopt $(module_ggo_opts) \
- --set-package=$(subst .ggo,,$<) \
- --arg-struct-name=$(subst .ggo,,$<)_args_info \
- --file-name=$(subst .ggo,,$<).cmdline \
- --func-name $(subst _filter.ggo,,$<)_cmdline_parser < $<
-
-%.cmdline.h %.cmdline.c: %.ggo
- case $< in client.ggo) O="--unamed-opts=command";; \
- audioc.ggo) O="--unamed-opts=command";; \
- esac; \
- gengetopt $$O --conf-parser --file-name=$(*F).cmdline --set-package="para_$(subst .cmdline,,$(*F))" --set-version="$V" < $<
-
-para_recv: @recv_objs@
- $(CC) @recv_objs@ -o $@ @recv_ldflags@
-
-slider.o: slider.c
- $(CC) -c -Wall -o $@ -g @GLIB_CFLAGS@ @GTK_CFLAGS@ $<
-
-krell.o: krell.c
- $(CC) -Wall -O -g -fPIC @GTK_CFLAGS@ -c -o $@ krell.c
-
-%.cmdline.o: %.cmdline.c
- $(CC) -c $(CPPFLAGS) $<
-%.o: %.c
- $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
-
-para_filter: @filter_objs@
- $(CC) @filter_objs@ -o $@ @filter_ldflags@
-
-para_slider: $(slider_objs)
- $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
+CPPFLAGS += -Wmissing-noreturn
+CPPFLAGS += -Wbad-function-cast
+CPPFLAGS += -fno-strict-aliasing
+CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
+CPPFLAGS += @arch_cppflags@
+CPPFLAGS += -I/usr/local/include
+CPPFLAGS += -I$(cmdline_dir)
+CPPFLAGS += @osl_cppflags@
+
+man_pages := $(patsubst %, man/man1/%.1, @executables@)
+
+autocrap := config.h.in configure
+tarball_pfx := @PACKAGE_TARNAME@-$(PACKAGE_VERSION)
+tarball_delete := $(addprefix $(tarball_pfx)/,\
+ web .changelog_before_cvs .changelog_cvs .gitignore\
+ skencil)
+tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2
+
+# To put more focus on warnings, be less verbose as default
+# Use 'make V=1' to see the full commands
+ifdef V
+ ifeq ("$(origin V)", "command line")
+ BUILD_VERBOSE = $(V)
+ endif
+endif
+ifndef BUILD_VERBOSE
+ BUILD_VERBOSE = 0
+endif
+ifeq ($(BUILD_VERBOSE),0)
+ Q = @
+else
+ Q =
+endif
+
+.PHONY: dep all clean distclean maintainer-clean install man tarball
+all: dep @executables@ $(man_pages)
+dep: $(deps)
+man: $(man_pages)
+tarball: $(tarball)
+
+-include $(ggo_dir)/makefile
+
+# When in doubt, use brute force (Ken Thompson)
+TOUPPER = \
+$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,\
+$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,\
+$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,\
+$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,\
+$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,\
+$(subst z,Z,$1))))))))))))))))))))))))))
+
+%_command_list.h: %.cmd %.c
+ @[ -z "$(Q)" ] || echo 'GEN $@'
+ $(Q) ./command_util.sh h < $< >$@
+%_command_list.man: %.cmd %.c
+ @[ -z "$(Q)" ] || echo 'GEN $@'
+ $(Q) ./command_util.sh man < $< > $@
+%_completion.h: %.cmd %.c
+ @[ -z "$(Q)" ] || echo 'GEN $@'
+ $(Q) ./command_util.sh compl $(strip $(call TOUPPER,$(*F)))_COMPLETERS \
+ $(strip $(call TOUPPER,$(*F)))_COMMANDS < $< > $@
+
+server_command_list.h server_command_list.man server_completion.h: command.c
+afs_command_list.h afs_command_list.man afs_completion.h: afs.c aft.c attribute.c
+audiod_command_list.h audiod_command_list.man audiod_completion.h: audiod_command.c
+
+server_command_lists_man = server_command_list.man afs_command_list.man
+man/man1/para_server.1: para_server $(server_command_lists_man) | $(man_dir)
+ @[ -z "$(Q)" ] || echo 'MAN $<'
+ $(Q) opts="-h --detailed-help -N `for i in $(server_command_lists_man); do printf "%s\n" "-i $$i"; done`"; \
+ $(HELP2MAN) $$opts ./para_server > $@
+
+man/man1/para_audiod.1: para_audiod audiod_command_list.man | $(man_dir)
+ @[ -z "$(Q)" ] || echo 'MAN $<'
+ $(Q) $(HELP2MAN) -h --detailed-help -N -i audiod_command_list.man ./para_audiod > $@
+
+man/man1/%.1: % | $(man_dir)
+ @[ -z "$(Q)" ] || echo 'MAN $<'
+ $(Q) $(HELP2MAN) -h --detailed-help -N ./$< > $@
+
+$(object_dir):
+ mkdir -p $@
+$(man_dir):
+ mkdir -p $@
+
+$(object_dir)/crypt.o: crypt.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @openssl_cppflags@ $<
+$(object_dir)/spx_common.o: spx_common.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
+
+$(object_dir)/spxdec_filter.o: spxdec_filter.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
+
+$(object_dir)/spx_afh.o: spx_afh.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
+
+$(object_dir)/oggdec_filter.o: oggdec_filter.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
+
+$(object_dir)/ogg_afh.o: ogg_afh.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
+
+$(object_dir)/ogg_afh_common.o: ogg_afh_common.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $<
+
+$(object_dir)/mp3dec_filter.o: mp3dec_filter.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
+
+$(object_dir)/aacdec_filter.o: aacdec_filter.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
+
+$(object_dir)/aac_common.o: aac_common.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
+
+$(object_dir)/aac_afh.o: aac_afh.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
+
+$(object_dir)/mp3_afh.o: mp3_afh.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @id3tag_cppflags@ $<
+
+$(object_dir)/gui%.o: gui%.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @curses_cppflags@ $<
+$(object_dir)/ao_write.o: ao_write.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ao_cppflags@ $<
+
+$(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c $(CPPFLAGS) -Wno-unused-function -o $@ $<
+
+$(object_dir)/%.o: %.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
+
+$(object_dir)/%.cmdline.d: $(cmdline_dir)/%.cmdline.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'DEP $<'
+ $(Q) ./depend.sh $(object_dir) $(cmdline_dir) $(CPPFLAGS) $< > $@
+
+$(object_dir)/%.d: %.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'DEP $<'
+ $(Q) ./depend.sh $(object_dir) $(cmdline_dir) $(CPPFLAGS) $< > $@
+
+
+recv_objs := $(addprefix $(object_dir)/, @recv_objs@)
+filter_objs := $(addprefix $(object_dir)/, @filter_objs@)
+client_objs := $(addprefix $(object_dir)/, @client_objs@)
+gui_objs := $(addprefix $(object_dir)/, @gui_objs@)
+audiod_objs := $(addprefix $(object_dir)/, @audiod_objs@)
+audioc_objs := $(addprefix $(object_dir)/, @audioc_objs@)
+fade_objs := $(addprefix $(object_dir)/, @fade_objs@)
+server_objs := $(addprefix $(object_dir)/, @server_objs@)
+write_objs := $(addprefix $(object_dir)/, @write_objs@)
+afh_objs := $(addprefix $(object_dir)/, @afh_objs@)
+
+all_objs := $(recv_objs) $(filter_objs) $(client_objs) $(gui_objs) \
+ $(audiod_objs) $(audioc_objs) $(fade_objs) $(server_objs) \
+ $(write_objs) $(afh_objs)
+
+deps := $(all_objs:.o=.d)
+
+ifeq ($(findstring clean, $(MAKECMDGOALS)),)
+-include $(deps)
+endif
+
+para_recv: $(recv_objs)
+ @[ -z "$(Q)" ] || echo 'LD $@'
+ $(Q) $(CC) $(LDFLAGS) $(recv_objs) -o $@ @recv_ldflags@
+
+para_filter: $(filter_objs)
+ @[ -z "$(Q)" ] || echo 'LD $@'
+ $(Q) $(CC) $(LDFLAGS) $(filter_objs) -o $@ @filter_ldflags@