]> git.tue.mpg.de Git - paraslash.git/commitdiff
Store gengetopt commandline files in a separate dir.
authorAndre Noll <maan@systemlinux.org>
Wed, 30 Sep 2009 13:47:14 +0000 (15:47 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 30 Sep 2009 13:47:14 +0000 (15:47 +0200)
Quite a bit of churn but it's hopefully worth the trouble.

Makefile.in
configure.ac
error.h
ggo/makefile

index 5a30b06218ae3b0ed1cd25d3295f4cb99015429f..ddf3be449d50744e394eb93395254a910c5eb4e3 100644 (file)
@@ -8,6 +8,7 @@ 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")
@@ -56,6 +57,7 @@ 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 \
@@ -69,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 \
-       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 .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
@@ -87,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
@@ -136,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) $<
@@ -154,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@
@@ -163,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@
@@ -193,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
index a1cba833e9041437958c17725dc1aff1db59355c..4cb283d26092ca87923162e86a9655d4f0993be5 100644 (file)
@@ -78,17 +78,24 @@ AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
        strncasecmp strrchr strspn alarm mkdir rmdir], [],
        [AC_MSG_ERROR([function not found, cannot live without it])])
 
+cmdline_dir="cmdline"
+AC_SUBST(cmdline_dir)
+AC_DEFUN([add_cmdline],[$(for i in $@; do printf "${cmdline_dir}/${i}.cmdline "; done)])
+
+
 all_errlist_objs="server mp3_afh afh_common vss command net string signal time
 daemon stat crypt http_send close_on_fork ipc acl afh fade amp_filter
 dccp_send fd user_list chunk_queue afs aft mood score attribute blob ringbuffer
 playlist sha1 sched audiod grab_client filter_common wav_filter compress_filter
 http_recv dccp_recv recv_common write_common file_write audiod_command
 client_common recv stdout filter stdin audioc write client exec send_common ggo
-udp_recv udp_send color fec fecdec_filter prebuffer_filter mm"
+udp_recv udp_send color fec fecdec_filter prebuffer_filter mm
+server_command_list afs_command_list audiod_command_list"
 
 all_executables="server recv filter audioc write client afh"
 
-recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline udp_recv.cmdline"
+recv_cmdline_objs="add_cmdline(recv http_recv dccp_recv udp_recv)"
+
 recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
        fd sched stdout ggo udp_recv fec"
 recv_ldflags=""
@@ -96,58 +103,55 @@ recv_ldflags=""
 receivers=" http dccp udp"
 senders=" http dccp udp"
 
-filter_cmdline_objs="filter.cmdline compress_filter.cmdline amp_filter.cmdline
-       prebuffer_filter.cmdline"
+filter_cmdline_objs="add_cmdline(filter compress_filter amp_filter prebuffer_filter)"
 filter_errlist_objs="filter_common wav_filter compress_filter filter string
        stdin stdout sched fd amp_filter ggo fecdec_filter fec
        prebuffer_filter time"
 filter_ldflags=""
 filters=" compress wav amp fecdec prebuffer"
 
-audioc_cmdline_objs="audioc.cmdline"
+audioc_cmdline_objs="add_cmdline(audioc)"
 audioc_errlist_objs="audioc string net fd"
 audioc_ldflags=""
 
-audiod_cmdline_objs="audiod.cmdline compress_filter.cmdline
-       http_recv.cmdline dccp_recv.cmdline file_write.cmdline client.cmdline
-       audiod_command_list amp_filter.cmdline udp_recv.cmdline
-       prebuffer_filter.cmdline sha1"
+audiod_cmdline_objs="add_cmdline(audiod compress_filter http_recv dccp_recv file_write client amp_filter udp_recv prebuffer_filter)"
 audiod_errlist_objs="audiod signal string daemon stat net
        time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv
        recv_common fd sched write_common file_write audiod_command crypt fecdec_filter
-       client_common ggo udp_recv color fec prebuffer_filter"
+       client_common ggo udp_recv color fec prebuffer_filter sha1 audiod_command_list"
 audiod_ldflags=""
 audiod_audio_formats=""
 
-afh_cmdline_objs="afh.cmdline"
+afh_cmdline_objs="add_cmdline(afh)"
 afh_errlist_objs="afh string fd mp3_afh afh_common time"
 afh_ldflags=""
 
-server_cmdline_objs="server.cmdline server_command_list afs_command_list"
+server_cmdline_objs="add_cmdline(server)"
 server_errlist_objs="server afh_common mp3_afh vss command net string signal
        time daemon crypt http_send close_on_fork mm
        ipc dccp_send fd user_list chunk_queue afs aft mood score attribute
-       blob playlist sha1 sched acl send_common udp_send color fec"
+       blob playlist sha1 sched acl send_common udp_send color fec
+       server_command_list afs_command_list"
 server_ldflags="-losl"
 server_audio_formats=" mp3"
 
-write_cmdline_objs="write.cmdline file_write.cmdline"
+write_cmdline_objs="add_cmdline(write file_write)"
 write_errlist_objs="write write_common file_write time fd string sched stdin ggo"
 write_ldflags=""
 writers=" file"
 default_writer="FILE_WRITE"
 
-client_cmdline_objs="client.cmdline"
+client_cmdline_objs="add_cmdline(client)"
 client_errlist_objs="client net string crypt fd sched stdin stdout
        client_common sha1"
 client_ldflags=""
 
-gui_cmdline_objs="gui.cmdline"
+gui_cmdline_objs="add_cmdline(gui)"
 gui_errlist_objs="exec signal string stat ringbuffer fd"
 gui_other_objs="gui gui_theme"
 gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
 
-fade_cmdline_objs="fade.cmdline"
+fade_cmdline_objs="add_cmdline(fade)"
 fade_errlist_objs="fade exec string fd"
 
 
@@ -375,8 +379,8 @@ if test "$have_ogg" = "yes"; then
        audiod_ldflags="$audiod_ldflags $oggvorbis_libs -lvorbis -lvorbisfile"
        afh_ldflags="$afh_ldflags $oggvorbis_libs -logg -lvorbis -lvorbisfile"
 
-       filter_cmdline_objs="$filter_cmdline_objs oggdec_filter.cmdline"
-       audiod_cmdline_objs="$audiod_cmdline_objs oggdec_filter.cmdline"
+       filter_cmdline_objs="$filter_cmdline_objs add_cmdline(oggdec_filter)"
+       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oggdec_filter)"
 
        server_errlist_objs="$server_errlist_objs ogg_afh"
        filter_errlist_objs="$filter_errlist_objs oggdec_filter"
@@ -460,8 +464,8 @@ AC_CHECK_LIB([mad], [mad_stream_init], [], [
 ])
 if test "$have_mad" = "yes"; then
        AC_DEFINE(HAVE_MAD, 1, define to 1 if you want to build the mp3dec filter)
-       filter_cmdline_objs="$filter_cmdline_objs mp3dec_filter.cmdline"
-       audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter.cmdline"
+       filter_cmdline_objs="$filter_cmdline_objs add_cmdline(mp3dec_filter)"
+       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(mp3dec_filter)"
        all_errlist_objs="$all_errlist_objs mp3dec_filter"
        filter_errlist_objs="$filter_errlist_objs mp3dec_filter"
        audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter"
@@ -511,10 +515,10 @@ AC_CHECK_HEADER(sys/soundcard.h, [
        all_executables="$all_executables fade"
        all_errlist_objs="$all_errlist_objs oss_write"
        audiod_errlist_objs="$audiod_errlist_objs oss_write"
-       audiod_cmdline_objs="$audiod_cmdline_objs oss_write.cmdline"
+       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
 
        write_errlist_objs="$write_errlist_objs oss_write"
-       write_cmdline_objs="$write_cmdline_objs oss_write.cmdline"
+       write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
        writers="$writers oss"
        default_writer="OSS_WRITE"
        AC_CHECK_LIB(ossaudio, _oss_ioctl, [
@@ -561,11 +565,11 @@ fi
 if test "$have_alsa" = "yes"; then
        all_errlist_objs="$all_errlist_objs alsa_write"
        audiod_errlist_objs="$audiod_errlist_objs alsa_write"
-       audiod_cmdline_objs="$audiod_cmdline_objs alsa_write.cmdline"
+       audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(alsa_write)"
        audiod_ldflags="$audiod_ldflags -lasound"
 
        write_errlist_objs="$write_errlist_objs alsa_write"
-       write_cmdline_objs="$write_cmdline_objs alsa_write.cmdline"
+       write_cmdline_objs="$write_cmdline_objs add_cmdline(alsa_write)"
        write_ldflags="$write_ldflags -lasound"
        writers="$writers alsa"
        default_writer="ALSA_WRITE"
@@ -758,8 +762,6 @@ names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
 AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
 
 AC_OUTPUT
-AC_MSG_NOTICE([creating Makefile.deps])
-gcc -MM -MG $faad_cppflags $mad_cppflags $oggvorbis_cppflags *.c > Makefile.deps
 AC_MSG_NOTICE([
 paraslash configuration:
 ~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/error.h b/error.h
index 512dcc9f787561384f2c700181e25bdfd068af03..6881e692415ff5eb7a8641aef27bbb2baf14360e 100644 (file)
--- a/error.h
+++ b/error.h
@@ -31,6 +31,9 @@ DEFINE_ERRLIST_OBJECT_ENUM;
 #define COLOR_ERRORS
 #define SIGNAL_ERRORS
 #define FADE_ERRORS
+#define SERVER_COMMAND_LIST_ERRORS
+#define AFS_COMMAND_LIST_ERRORS
+#define AUDIOD_COMMAND_LIST_ERRORS
 
 extern const char **para_errlist[];
 
index 936b23eb29876cb35fb27cb009793fc14d0cc0bf..c3cae89f85380cf36e7ab05db2889c75cb335ffa 100644 (file)
@@ -1,20 +1,26 @@
 module_ggo_opts := --set-version="($(PACKAGE_STRING), $(codename))"
 
-%_recv.cmdline.h %_recv.cmdline.c: $(ggo_dir)/%_recv.ggo
+$(cmdline_dir)/%_recv.cmdline.h $(cmdline_dir)/%_recv.cmdline.c: $(ggo_dir)/%_recv.ggo
+       @mkdir -p $(cmdline_dir)
        gengetopt $(module_ggo_opts) \
+               --output-dir=$(cmdline_dir) \
                --set-package=$(subst .ggo,,$(<F)) \
                --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
                --file-name=$(subst .ggo,,$(<F)).cmdline \
                --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
 
-%_filter.cmdline.h %_filter.cmdline.c: $(ggo_dir)/%_filter.ggo
+$(cmdline_dir)/%_filter.cmdline.h $(cmdline_dir)/%_filter.cmdline.c: $(ggo_dir)/%_filter.ggo
+       @mkdir -p $(cmdline_dir)
        gengetopt $(module_ggo_opts) \
+               --output-dir=$(cmdline_dir) \
                --set-package=$(subst .ggo,,$(<F)) \
                --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
                --file-name=$(subst .ggo,,$(<F)).cmdline \
-               --func-name $(subst _filter.ggo,,$(<F))_cmdline_parser < $<
-%_write.cmdline.h %_write.cmdline.c: $(ggo_dir)/%_write.ggo
+               --func-name=$(subst _filter.ggo,,$(<F))_cmdline_parser < $<
+$(cmdline_dir)/%_write.cmdline.h $(cmdline_dir)/%_write.cmdline.c: $(ggo_dir)/%_write.ggo
+       @mkdir -p $(cmdline_dir)
        gengetopt -S $(module_ggo_opts) \
+               --output-dir=$(cmdline_dir) \
                --set-package=$(subst .ggo,,$(<F)) \
                --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
                --file-name=$(subst .ggo,,$(<F)).cmdline \
@@ -25,15 +31,17 @@ $(if $(filter recv filter write audiod,$(*F)), --no-handle-help) \
 $(if $(filter afh,$(*F)), --unamed-opts=audio_file) \
 $(if $(filter client audioc,$(*F)), --unamed-opts=command) \
 $(if $(filter fsck,$(*F)), --unamed-opts=table, --conf-parser)\
+--output-dir=$(cmdline_dir) \
 --no-handle-version \
 --file-name=$(*F).cmdline \
---func-name $(*F)_cmdline_parser \
+--func-name=$(*F)_cmdline_parser \
 --arg-struct-name=$(*F)_args_info \
 --set-package="para_$(*F)" \
 --set-version="$(PACKAGE_VERSION)"
 endef
 
-%.cmdline.h %.cmdline.c: $(ggo_dir)/%.ggo
+$(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo
+       @mkdir -p $(cmdline_dir)
        gengetopt $(ggo-opts) < $<
 
 $(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \