--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 \