Store gengetopt commandline files in a separate dir.
[paraslash.git] / Makefile.in
index 6ea868b0ddaac1ee685e12447552da7c750717eb..ddf3be449d50744e394eb93395254a910c5eb4e3 100644 (file)
@@ -8,12 +8,13 @@ MANDIR := @datarootdir@/man/man1
 PACKAGE_VERSION := @PACKAGE_VERSION@
 PACKAGE_STRING := @PACKAGE_STRING@
 install_sh := @install_sh@
+cmdline_dir := @cmdline_dir@
 
 build_date := $(shell date)
 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
 uname_rs := $(shell uname -rs)
 cc_version := $(shell $(CC) --version | head -n 1)
-codename := symplectic separability
+codename := simultaneous independence
 
 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
 DEBUG_CPPFLAGS += -Wredundant-decls
@@ -50,11 +51,14 @@ CPPFLAGS += -Wmissing-format-attribute
 CPPFLAGS += -Wmissing-noreturn
 CPPFLAGS += -Wunused-macros
 CPPFLAGS += -Wbad-function-cast
+CPPFLAGS += -fno-strict-aliasing
 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
 CPPFLAGS += @SSL_CPPFLAGS@
 CPPFLAGS += @ncurses_cppflags@
 CPPFLAGS += @arch_cppflags@
 CPPFLAGS += -I/usr/local/include
+CPPFLAGS += -I$(cmdline_dir)
+CPPFLAGS += @osl_cppflags@
 
 BINARIES = para_server para_client para_audioc para_recv \
        para_filter para_write para_afh @extra_binaries@
@@ -67,15 +71,16 @@ ggo_dir := ggo
 m4_ggos := afh audioc audiod client filter gui recv server write
 all_ggos := $(m4_ggos) dccp_recv oggdec_filter alsa_write oss_write fade http_recv \
        osx_write udp_recv amp_filter compress_filter file_write \
-       grab_client mp3dec_filter
-ggo_generated := $(addsuffix .cmdline.c, $(all_ggos)) $(addsuffix .cmdline.h, $(all_ggos)) \
-       $(addsuffix .ggo, $(addprefix $(ggo_dir)/,$(m4_ggos)))
+       mp3dec_filter prebuffer_filter
+ggo_generated := $(addsuffix .ggo, $(addprefix $(ggo_dir)/,$(m4_ggos)))
+cmdline_generated := $(addprefix $(cmdline_dir)/,$(addsuffix .cmdline.c, $(all_ggos)) \
+       $(addsuffix .cmdline.h, $(all_ggos)))
 
 autocrap := config.h.in configure
 tarball_pfx := @PACKAGE_TARNAME@-$(PACKAGE_VERSION)
-tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
-tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
-tarball_add := $(ggo_generated) $(autocrap)
+tarball_delete := $(addprefix $(tarball_pfx)/,\
+       web versions .changelog_before_cvs .changelog_cvs .gitignore\
+       $(ggo_dir) skencil)
 tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2
 
 .PHONY: clean distclean maintainer-clean install man tarball
@@ -85,20 +90,24 @@ tarball: $(tarball)
 
 *.o: para.h config.h gcc-compat.h
 
-include Makefile.deps
-include $(ggo_dir)/makefile
+Makefile.deps: $(wildcard *.c *.h) $(cmdline_generated)
+       gcc -MM -MG -I$(cmdline_dir) @faad_cppflags@ @mad_cppflags@ @oggvorbis_cppflags@ *.c > $@
+-include Makefile.deps
+-include $(ggo_dir)/makefile
 
-%_command_list.c %_command_list.h: %.cmd
+%_command_list.c: %.cmd
        ./command_util.sh c < $< >$@
-       ./command_util.sh h < $< >$(@:%.c=%.h)
-
+%_command_list.h: %.cmd
+       ./command_util.sh h < $< >$@
 %_command_list.man: %.cmd
        ./command_util.sh man < $< > $@
 
-server_command_lists = server_command_list.man afs_command_list.man
-man/man1/para_server.1: para_server $(server_command_lists)
+server_command_lists_ch = server_command_list.c afs_command_list.c \
+       server_command_list.h afs_command_list.h
+server_command_lists_man = server_command_list.man afs_command_list.man
+man/man1/para_server.1: para_server $(server_command_lists_man)
        mkdir -p man/man1
-       opts="-h --detailed-help -N `for i in $(server_command_lists); do printf "%s\n" "-i $$i"; done`"; \
+       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
@@ -134,8 +143,9 @@ aac_common.o: aac_common.c
 aac_afh.o: aac_afh.c
        $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
 
-%.cmdline.o: %.cmdline.c
-       $(CC) -c $(CPPFLAGS) $<
+$(cmdline_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c
+       @mkdir -p $(cmdline_dir)
+       $(CC) -c $(CPPFLAGS) -o $@ $<
 
 %.o: %.c
        $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
@@ -152,7 +162,7 @@ para_client: @client_objs@
 para_gui: @gui_objs@
        $(CC) $(LDFLAGS) -o $@ @gui_objs@ -lncurses
 
-para_audiod: @audiod_objs@
+para_audiod: @audiod_objs@ audiod_command_list.c audiod_command_list.h
        $(CC) $(LDFLAGS) -o $@ @audiod_objs@ @audiod_ldflags@
 
 para_audioc: @audioc_objs@
@@ -161,7 +171,7 @@ para_audioc: @audioc_objs@
 para_fade: @fade_objs@
        $(CC) $(LDFLAGS) -o $@ @fade_objs@ @fade_ldflags@
 
-para_server: @server_objs@
+para_server: @server_objs@ $(server_command_lists_ch)
        $(CC) $(LDFLAGS) -o $@ @server_objs@  @server_ldflags@
 
 para_write: @write_objs@
@@ -172,6 +182,7 @@ para_afh: @afh_objs@
 
 clean:
        rm -f *.o $(BINARIES)
+       rm -f *_command_list.*
        rm -rf man
 distclean: clean
        rm -f Makefile autoscan.log config.status config.log && \
@@ -182,7 +193,6 @@ maintainer-clean: distclean
        rm -f $(ggo_generated) *.tar.bz2 \
                config.h configure \
                config.h.in skencil/*.pdf skencil/*.ps
-       rm -f *_command_list.* *.man man/man1/*
        rm -rf web_sync
 
 install: all man
@@ -191,12 +201,13 @@ install: all man
        $(install_sh) -m 644 $(man_pages) $(MANDIR)
        mkdir -p $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
 
-@PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2: $(tarball_add)
+$(tarball): $(cmdline_generated)
        rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
        git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
                | tar --delete $(tarball_delete) > $(tarball_pfx).tar
-       mkdir $(tarball_pfx)
-       cp -r $(tarball_add) $(tarball_pfx)
+       mkdir -p $(tarball_pfx)/$(cmdline_dir)
+       cp -r $(autocrap) $(tarball_pfx)
+       cp -r $(cmdline_generated) $(tarball_pfx)/$(cmdline_dir)
        tar rf $(tarball_pfx).tar $(tarball_pfx)/*
        rm -rf $(tarball_pfx)
        bzip2 -9 $(tarball_pfx).tar