Simplify ggo/makefile.
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Tue, 27 Jan 2009 10:46:27 +0000 (11:46 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 27 Jan 2009 10:46:27 +0000 (11:46 +0100)
Use a define rather than shell code to compute the options to gengetopt.

ggo/makefile

index 132ea60..a771520 100644 (file)
@@ -31,24 +31,21 @@ grab_client.cmdline.h grab_client.cmdline.c: $(ggo_dir)/grab_client.ggo
                --file-name=$(subst .ggo,,$(<F)).cmdline \
                --func-name $(subst _write.ggo,,$(<F))_cmdline_parser < $<
 
+define ggo-opts
+$(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)\
+--no-handle-version \
+--file-name=$(*F).cmdline \
+--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
-       case $(<F) in client.ggo) O="--unamed-opts=command";; \
-               audioc.ggo) O="--unamed-opts=command";; \
-               fsck.ggo) O="--unamed-opts=table";; \
-               afh.ggo) O="--unamed-opts=audio_file";; \
-               recv.ggo) O="--no-handle-help";; \
-               filter.ggo) O="--no-handle-help";; \
-               write.ggo) O="--no-handle-help";; \
-               audiod.ggo) O="--no-handle-help";; \
-       esac; \
-       if test $(<F) != fsck.ggo; then O="$$O --conf-parser "; fi; \
-       gengetopt $$O \
-               --no-handle-version \
-               --file-name=$(*F).cmdline \
-               --func-name $(*F)_cmdline_parser \
-               --arg-struct-name=$(*F)_args_info \
-               --set-package="para_$(subst .cmdline,,$(*F))" \
-               --set-version="$(PACKAGE_VERSION)"  < $<
+       gengetopt $(ggo-opts) < $<
 
 $(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \
        $(ggo_dir)/loglevel.m4 $(ggo_dir)/color.m4 \