Simplify ggo/makefile.
[paraslash.git] / ggo / makefile
1 module_ggo_opts := --set-version="($(PACKAGE_STRING), $(codename))"
2
3 grab_client.cmdline.h grab_client.cmdline.c: $(ggo_dir)/grab_client.ggo
4 gengetopt $(module_ggo_opts) \
5 -S \
6 --set-package=grab \
7 --no-handle-help \
8 --no-handle-error \
9 --no-handle-version \
10 --arg-struct-name=grab_client_args_info \
11 --file-name=$(subst .ggo,,$(<F)).cmdline \
12 --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
13
14 %_recv.cmdline.h %_recv.cmdline.c: $(ggo_dir)/%_recv.ggo
15 gengetopt $(module_ggo_opts) \
16 --set-package=$(subst .ggo,,$(<F)) \
17 --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
18 --file-name=$(subst .ggo,,$(<F)).cmdline \
19 --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
20
21 %_filter.cmdline.h %_filter.cmdline.c: $(ggo_dir)/%_filter.ggo
22 gengetopt $(module_ggo_opts) \
23 --set-package=$(subst .ggo,,$(<F)) \
24 --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
25 --file-name=$(subst .ggo,,$(<F)).cmdline \
26 --func-name $(subst _filter.ggo,,$(<F))_cmdline_parser < $<
27 %_write.cmdline.h %_write.cmdline.c: $(ggo_dir)/%_write.ggo
28 gengetopt -S $(module_ggo_opts) \
29 --set-package=$(subst .ggo,,$(<F)) \
30 --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
31 --file-name=$(subst .ggo,,$(<F)).cmdline \
32 --func-name $(subst _write.ggo,,$(<F))_cmdline_parser < $<
33
34 define ggo-opts
35 $(if $(filter recv filter write audiod,$(*F)), --no-handle-help) \
36 $(if $(filter afh,$(*F)), --unamed-opts=audio_file) \
37 $(if $(filter client audioc,$(*F)), --unamed-opts=command) \
38 $(if $(filter fsck,$(*F)), --unamed-opts=table, --conf-parser)\
39 --no-handle-version \
40 --file-name=$(*F).cmdline \
41 --func-name $(*F)_cmdline_parser \
42 --arg-struct-name=$(*F)_args_info \
43 --set-package="para_$(*F)" \
44 --set-version="$(PACKAGE_VERSION)"
45 endef
46
47 %.cmdline.h %.cmdline.c: $(ggo_dir)/%.ggo
48 gengetopt $(ggo-opts) < $<
49
50 $(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \
51 $(ggo_dir)/loglevel.m4 $(ggo_dir)/color.m4 \
52 $(ggo_dir)/config_file.m4 $(ggo_dir)/logfile.m4 \
53 $(ggo_dir)/daemon.m4 $(ggo_dir)/user.m4 \
54 $(ggo_dir)/group.m4
55
56 $(ggo_dir)/afh.ggo: $(ggo_dir)/loglevel.m4
57 $(ggo_dir)/audioc.ggo: $(ggo_dir)/loglevel.m4
58 $(ggo_dir)/filter.ggo: $(ggo_dir)/loglevel.m4
59 $(ggo_dir)/fsck.ggo: $(ggo_dir)/loglevel.m4
60 $(ggo_dir)/gui.ggo: $(ggo_dir)/loglevel.m4
61 $(ggo_dir)/recv.ggo: $(ggo_dir)/loglevel.m4
62 $(ggo_dir)/write.ggo: $(ggo_dir)/loglevel.m4
63 $(ggo_dir)/client.ggo: $(ggo_dir)/loglevel.m4 $(ggo_dir)/config_file.m4
64
65 $(ggo_dir)/%.ggo: $(ggo_dir)/%.m4 $(ggo_dir)/header.m4
66 cd $(ggo_dir); m4 $(<F) > $(@F)