]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
build: Introduce cmdlist_dir.
authorAndre Noll <maan@systemlinux.org>
Sun, 20 Apr 2014 02:03:09 +0000 (02:03 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Oct 2014 12:15:54 +0000 (13:15 +0100)
This puts all files generated by command_util.bash into a new
subdirectory inside the build directory. This way we don't need
to special-case these files any more in .gitignore, Doxyfile, make
clean. The compiler and depend.sh need to know this directory, so
we add -I$(cmdlist_dir) to CPPFLAGS and introduce a new parameter
for depend.sh.

To prevent cpp from including stale versions of the *command_list.h
files in the top level directory (left over from a previous build)
this commit renames the generated files slightly. For example,
audiod_completion.h becomes audiod.completion.h.

.gitignore
Doxyfile
Makefile.real
audioc.c
audiod_command.c
client.c
command.c
depend.sh
play.c

index d340f2075c05f99ad6b8a3ccb85dd4f293fbcc19..b9190f286953b5f6e9b28d205d0d3c5f85ffb822 100644 (file)
@@ -14,8 +14,6 @@ config.log
 config.status
 Makefile
 TODO
-*_command_list.h
-*_command_list.man
 paraslash-git.tar.bz2
 web/dia/overview.pdf
 *.swp
@@ -25,4 +23,3 @@ confdefs.h
 conftest
 conftest.c
 git-version.h
-*_completion.h
index 239cd2622ddb2a2db238749b4e815fae72a1e3cf..4f9743c74fdd5e136874cf7e80167ff086761497 100644 (file)
--- a/Doxyfile
+++ b/Doxyfile
@@ -621,8 +621,8 @@ EXCLUDE_SYMLINKS       = NO
 EXCLUDE_PATTERNS       = *.cmdline.* \
                          gcc-compat.h \
                          fade.c \
-                       *_command_list.h \
-                       *_completion.h
+                       *.command_list.h \
+                       *.completion.h
 
 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
 # (namespaces, classes, functions, etc.) that should be excluded from the
index 58761a7bf24e1121894920d65e18b2bcca65fd88..f391d26eb7ceee753c446557edff379adff08410 100644 (file)
@@ -21,6 +21,7 @@ object_dir := $(build_dir)/objects
 dep_dir := $(build_dir)/deps
 man_dir := $(build_dir)/man/man1
 cmdline_dir := $(build_dir)/cmdline
+cmdlist_dir := $(build_dir)/cmdlist
 m4depdir := $(build_dir)/m4deps
 help2man_dir := $(build_dir)/help2man
 hostbin_dir := $(build_dir)/host/bin
@@ -68,7 +69,7 @@ ifeq ($(findstring clean, $(MAKECMDGOALS)),)
 endif
 
 $(object_dir) $(man_dir) $(ggo_dir) $(cmdline_dir) $(dep_dir) $(m4depdir) \
-               $(help2man_dir) $(hostbin_dir):
+               $(help2man_dir) $(hostbin_dir) $(cmdlist_dir):
        $(Q) $(MKDIR_P) $@
 
 # When in doubt, use brute force (Ken Thompson)
@@ -88,6 +89,7 @@ CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
 CPPFLAGS += $(arch_cppflags)
 CPPFLAGS += -I/usr/local/include
 CPPFLAGS += -I$(cmdline_dir)
+CPPFLAGS += -I$(cmdlist_dir)
 
 CFLAGS += -Os
 CFLAGS += -Wuninitialized
@@ -123,24 +125,36 @@ else
        Q := @
 endif
 
-%_command_list.h: %.cmd %.c
+$(cmdlist_dir)/%.command_list.h: %.cmd %.c | $(cmdlist_dir)
        @[ -z "$(Q)" ] || echo 'GEN $@'
        $(Q) ./command_util.bash h < $< >$@
-%_command_list.man: %.cmd %.c
+$(cmdlist_dir)/%.command_list.man: %.cmd %.c | $(cmdlist_dir)
        @[ -z "$(Q)" ] || echo 'GEN $@'
        $(Q) ./command_util.bash man < $< > $@
-%_completion.h: %.cmd %.c
+$(cmdlist_dir)/%.completion.h: %.cmd %.c | $(cmdlist_dir)
        @[ -z "$(Q)" ] || echo 'GEN $@'
        $(Q) ./command_util.bash 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
+$(cmdlist_dir)/server.command_list.h \
+$(cmdlist_dir)/server.command_list.man \
+$(cmdlist_dir)/server.completion.h \
+: command.c
 
-server_command_lists := server_command_list.man afs_command_list.man
-audiod_command_lists := audiod_command_list.man
-play_command_lists := play_command_list.man
+$(cmdlist_dir)/afs.command_list.h \
+$(cmdlist_dir)/afs.command_list.man \
+$(cmdlist_dir)/afs.completion.h \
+: afs.c aft.c attribute.c
+
+$(cmdlist_dir)/audiod,command_list.h \
+$(cmdlist_dir)/audiod,command_list.man \
+$(cmdlist_dir)/audiod,completion.h \
+: audiod_command.c
+
+server_command_lists := $(cmdlist_dir)/server.command_list.man \
+       $(cmdlist_dir)/afs.command_list.man
+audiod_command_lists := $(cmdlist_dir)/audiod.command_list.man
+play_command_lists := $(cmdlist_dir)/play.command_list.man
 
 $(man_dir)/para_server.1: $(server_command_lists)
 $(man_dir)/para_audiod.1: $(audiod_command_lists)
@@ -230,15 +244,15 @@ $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h
        @[ -z "$(Q)" ] || echo 'CC $<'
        $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
 
-$(dep_dir)/%.cmdline.d: $(cmdline_dir)/%.cmdline.c error2.h | $(dep_dir)
+$(dep_dir)/%.cmdline.d: $(cmdline_dir)/%.cmdline.c error2.h | $(dep_dir) $(cmdlist_dir)
        @[ -z "$(Q)" ] || echo 'DEP $<'
        $(Q) ./depend.sh $(dep_dir) $(object_dir) $(cmdline_dir) \
-               $(CPPFLAGS) $< > $@
+               $(cmdlist_dir) $(CPPFLAGS) $< > $@
 
-$(dep_dir)/%.d: %.c error2.h | $(dep_dir)
+$(dep_dir)/%.d: %.c error2.h | $(dep_dir) $(cmdlist_dir)
        @[ -z "$(Q)" ] || echo 'DEP $<'
        $(Q) ./depend.sh $(dep_dir) $(object_dir) $(cmdline_dir) \
-               $(CPPFLAGS) $< > $@
+               $(cmdlist_dir) $(CPPFLAGS) $< > $@
 
 para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags)
 para_write para_play para_audiod: LDFLAGS += $(ao_ldflags) $(core_audio_ldflags)
@@ -302,7 +316,6 @@ clean:
 
 clean2: clean
        @[ -z "$(Q)" ] || echo 'CLEAN2'
-       $(Q) rm -f *_command_list.* *_completion.h
        $(Q) rm -rf $(build_dir)
 distclean: clean2 test-clean
        @[ -z "$(Q)" ] || echo 'DISTCLEAN'
index 001619d5eb07f6a0da0368c2055a263be7f381e1..a2bfeb1995abc458daf953b036a0d2edcdd3aed1 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -72,7 +72,7 @@ fail:
 #include "sched.h"
 #include "buffer_tree.h"
 #include "interactive.h"
-#include "audiod_completion.h"
+#include "audiod.completion.h"
 
 static struct sched sched;
 
index 2aae0d805e8286303a43df96b8a172b73e21e093..df8f3936faf89a2c5b5550901d2e6e9bcf12ebdb 100644 (file)
@@ -30,7 +30,7 @@
 #include "write.h"
 #include "fd.h"
 #include "version.h"
-#include "audiod_command_list.h"
+#include "audiod.command_list.h"
 
 extern struct sched sched;
 extern char *stat_item_values[NUM_STAT_ITEMS];
index 4c4806f928950919d0d763a02104e5d93f316796..2159117e7cbff55b04e38d1ab167482419546680 100644 (file)
--- a/client.c
+++ b/client.c
@@ -35,8 +35,8 @@ __printf_2_3 void (*para_log)(int, const char*, ...) = stderr_log;
 
 #ifdef HAVE_READLINE
 #include "interactive.h"
-#include "server_completion.h"
-#include "afs_completion.h"
+#include "server.completion.h"
+#include "afs.completion.h"
 
 struct exec_task {
        struct task *task;
index db28b39dff8362a76d668d16ca6c7ac13541a9c7..80584510b88437a6272c5490c455c8721b9759ba 100644 (file)
--- a/command.c
+++ b/command.c
@@ -35,8 +35,8 @@
 #include "fd.h"
 #include "ipc.h"
 #include "user_list.h"
-#include "server_command_list.h"
-#include "afs_command_list.h"
+#include "server.command_list.h"
+#include "afs.command_list.h"
 #include "signal.h"
 #include "version.h"
 
index c6424daaf1e7dc6a02ec4bfabe800d9591c0c0b8..80a6d40b9d359700ffe632f57e99e38d8d9f149b 100755 (executable)
--- a/depend.sh
+++ b/depend.sh
@@ -4,10 +4,12 @@
 # the given input file and parse the output to add a *.d target with the same
 # dependencies.
 
-# The first three arguments to that script are special: $1 is the
+# The first four arguments to that script are special: $1 is the
 # dependency directory and $2 is the object directory. These are used
 # to prefix the .d and .o targets respectively. $3 is the directory
-# that contains the *.cmdline.h files generated by gengetopt.
+# that contains the *.cmdline.h files generated by gengetopt. Similarly,
+# $4 is the command list directory which contains all files generated by
+# the command_util script.
 
 # As gcc outputs the dependencies on the *.cmdline.h files either as
 # foo.cmdline.h or as $cmdline_dir/foo.cmdline.h, depending on whether the
 dep_dir="$1"
 object_dir="$2"
 cmdline_dir="$3"
+cmdlist_dir="$4"
+shift
 shift
 shift
 shift
 
 LC_ALL=C cc -MM -MG "$@" \
        | sed -e "s@^\(.*\)\.o:@$dep_dir/\1.d $object_dir/\1.o:@" \
-       -e "s@[         ^]\([a-zA-Z0-9_]\{1,\}\.cmdline.h\)@ $cmdline_dir/\1@g"
+       -e "s@[         ^]\([a-zA-Z0-9_]\{1,\}\.cmdline.h\)@ $cmdline_dir/\1@g" \
+       -e "s@[         ^]\([a-zA-Z0-9_]\{1,\}\.command_list.h\)@ $cmdlist_dir/\1@g" \
+       -e "s@[         ^]\([a-zA-Z0-9_]\{1,\}\.completion.h\)@ $cmdlist_dir/\1@g"
diff --git a/play.c b/play.c
index 9fc49e377e8048cb2f6b703cdabf9d156843812d..5e8c1cfcf2ab346abea56ae0c009b73a727232b3 100644 (file)
--- a/play.c
+++ b/play.c
@@ -633,7 +633,7 @@ static char **get_mapped_keyseqs(void)
        return result;
 }
 
-#include "play_completion.h"
+#include "play.completion.h"
 
 
 /* defines one command of para_play */
@@ -645,11 +645,11 @@ struct pp_command {
        const char *help;
 };
 
-#include "play_command_list.h"
+#include "play.command_list.h"
 static struct pp_command pp_cmds[] = {DEFINE_PLAY_CMD_ARRAY};
 #define FOR_EACH_COMMAND(c) for (c = 0; pp_cmds[c].name; c++)
 
-#include "play_completion.h"
+#include "play.completion.h"
 static struct i9e_completer pp_completers[];
 
 I9E_DUMMY_COMPLETER(jmp);