First draft of the oss writer.
[paraslash.git] / ggo / makefile
index 4988d6f..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 < $<
 
                --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
 %.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 \
 
 $(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \
        $(ggo_dir)/loglevel.m4 $(ggo_dir)/color.m4 \
@@ -66,4 +63,4 @@ $(ggo_dir)/write.ggo: $(ggo_dir)/loglevel.m4
 $(ggo_dir)/client.ggo: $(ggo_dir)/loglevel.m4 $(ggo_dir)/config_file.m4
 
 $(ggo_dir)/%.ggo: $(ggo_dir)/%.m4 $(ggo_dir)/header.m4
 $(ggo_dir)/client.ggo: $(ggo_dir)/loglevel.m4 $(ggo_dir)/config_file.m4
 
 $(ggo_dir)/%.ggo: $(ggo_dir)/%.m4 $(ggo_dir)/header.m4
-       (cd $(ggo_dir) && m4 $(<F)) > $@
+       cd $(ggo_dir); m4 $(<F) > $(@F)