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
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)
CPPFLAGS += $(arch_cppflags)
CPPFLAGS += -I/usr/local/include
CPPFLAGS += -I$(cmdline_dir)
+CPPFLAGS += -I$(cmdlist_dir)
CFLAGS += -Os
CFLAGS += -Wuninitialized
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)
@[ -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)
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'
# 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"