Quite a bit of churn but it's hopefully worth the trouble.
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")
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 \
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
*.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
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) $<
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@
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@
$(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
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=""
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"
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"
])
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"
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, [
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"
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:
~~~~~~~~~~~~~~~~~~~~~~~~
#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[];
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 \
$(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: \