]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Simplify ggo makefile.
authorAndre Noll <maan@systemlinux.org>
Sun, 29 Jul 2012 18:51:18 +0000 (20:51 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 27 Aug 2012 11:01:08 +0000 (13:01 +0200)
Currently we have three different targets for creating *_cmdline.[ch]
files. This is because receivers, filters and writers need slightly
different command line options.

This patch defines the common options in the ggo makefile and moves
additional parameters to the individual .m4 files so that a single
target to create *_cmdline.[ch] is now sufficient.

The name of the command line parsers of some filters and writers
changed due to this unification, so these are updated accordingly.

20 files changed:
alsa_write.c
amp_filter.c
ao_write.c
compress_filter.c
file_write.c
m4/gengetopt/afh.m4
m4/gengetopt/audioc.m4
m4/gengetopt/audiod.m4
m4/gengetopt/client.m4
m4/gengetopt/fade.m4
m4/gengetopt/filter.m4
m4/gengetopt/gui.m4
m4/gengetopt/makefile
m4/gengetopt/recv.m4
m4/gengetopt/server.m4
m4/gengetopt/write.m4
mp3dec_filter.c
oss_write.c
osx_write.c
prebuffer_filter.c

index 73c9b8232679bde7b4ea910011ba648202761e9b..16497bdf222d8b16c155fe41ab22999bc60f366e 100644 (file)
@@ -333,13 +333,13 @@ __malloc static void *alsa_parse_config_or_die(int argc, char **argv)
        struct alsa_write_args_info *conf = para_calloc(sizeof(*conf));
 
        /* exits on errors */
-       alsa_cmdline_parser(argc, argv, conf);
+       alsa_write_cmdline_parser(argc, argv, conf);
        return conf;
 }
 
 static void alsa_free_config(void *conf)
 {
-       alsa_cmdline_parser_free(conf);
+       alsa_write_cmdline_parser_free(conf);
 }
 
 /**
@@ -353,7 +353,7 @@ void alsa_write_init(struct writer *w)
 {
        struct alsa_write_args_info dummy;
 
-       alsa_cmdline_parser_init(&dummy);
+       alsa_write_cmdline_parser_init(&dummy);
        w->close = alsa_close;
        w->pre_select = alsa_write_pre_select;
        w->post_select = alsa_write_post_select;
@@ -363,5 +363,5 @@ void alsa_write_init(struct writer *w)
                .short_help = alsa_write_args_info_help,
                .detailed_help = alsa_write_args_info_detailed_help
        };
-       alsa_cmdline_parser_free(&dummy);
+       alsa_write_cmdline_parser_free(&dummy);
 }
index 7e88cc495f2f805196c60ff45538050dc7c33338..dd2c61949da4877a88ef4ca468fb6bf4be7e6b7e 100644 (file)
@@ -38,7 +38,7 @@ static int amp_parse_config(int argc, char **argv, void **config)
        struct amp_filter_args_info *amp_conf = para_calloc(sizeof(*amp_conf));
        int ret = -E_AMP_SYNTAX;
 
-       if (amp_cmdline_parser(argc, argv, amp_conf))
+       if (amp_filter_cmdline_parser(argc, argv, amp_conf))
                goto err;
        ret = -ERRNO_TO_PARA_ERROR(EINVAL);
        if (amp_conf->amp_arg < 0)
@@ -123,7 +123,7 @@ err:
 
 static void amp_free_config(void *conf)
 {
-       amp_cmdline_parser_free(conf);
+       amp_filter_cmdline_parser_free(conf);
 }
 
 /**
@@ -135,7 +135,7 @@ void amp_filter_init(struct filter *f)
 {
        struct amp_filter_args_info dummy;
 
-       amp_cmdline_parser_init(&dummy);
+       amp_filter_cmdline_parser_init(&dummy);
        f->open = amp_open;
        f->close = amp_close;
        f->pre_select = generic_filter_pre_select;
index 165caa0cd411a65aeb849cc5f3e105d37d9e63b6..b1c344cc4586c9044e68f2f386ee54aa3024e01b 100644 (file)
@@ -342,13 +342,13 @@ __malloc static void *aow_parse_config_or_die(int argc, char **argv)
        struct ao_write_args_info *conf = para_calloc(sizeof(*conf));
 
        /* exits on errors */
-       ao_cmdline_parser(argc, argv, conf);
+       ao_write_cmdline_parser(argc, argv, conf);
        return conf;
 }
 
 static void aow_free_config(void *conf)
 {
-       ao_cmdline_parser_free(conf);
+       ao_write_cmdline_parser_free(conf);
 }
 
 /**
@@ -365,7 +365,7 @@ void ao_write_init(struct writer *w)
        ao_info **driver_list;
        char **dh; /* detailed help */
 
-       ao_cmdline_parser_init(&dummy);
+       ao_write_cmdline_parser_init(&dummy);
        w->close = aow_close;
        w->pre_select = aow_pre_select;
        w->post_select = aow_post_select;
@@ -411,7 +411,7 @@ void ao_write_init(struct writer *w)
        }
        dh[num_lines] = NULL;
        w->help.detailed_help = (const char **)dh;
-       ao_cmdline_parser_free(&dummy);
+       ao_write_cmdline_parser_free(&dummy);
        ao_shutdown();
 }
 
index 3dee5ccd1e62e5e5e155e717b44bf7dd408ffdfb..49d6d66c4f7a6b37d3b5ba4e072f2208f3a90715 100644 (file)
@@ -120,7 +120,7 @@ static int compress_parse_config(int argc, char **argv, void **config)
                = para_calloc(sizeof(*compress_conf));
 
        ret = -E_COMPRESS_SYNTAX;
-       if (compress_cmdline_parser(argc, argv, compress_conf))
+       if (compress_filter_cmdline_parser(argc, argv, compress_conf))
                goto err;
        *config = compress_conf;
        return 1;
@@ -142,7 +142,7 @@ static void compress_open(struct filter_node *fn)
 
 static void compress_free_config(void *conf)
 {
-       compress_cmdline_parser_free(conf);
+       compress_filter_cmdline_parser_free(conf);
 }
 
 /**
@@ -154,7 +154,7 @@ void compress_filter_init(struct filter *f)
 {
        struct compress_filter_args_info dummy;
 
-       compress_cmdline_parser_init(&dummy);
+       compress_filter_cmdline_parser_init(&dummy);
        f->open = compress_open;
        f->close = compress_close;
        f->pre_select = generic_filter_pre_select;
index 9817571570e0dac6975a983845ff545523781325..32f6c3abdffdee58f8c4b49087c01b66c3909c1b 100644 (file)
@@ -138,13 +138,13 @@ __malloc static void *file_write_parse_config_or_die(int argc, char **argv)
        struct file_write_args_info *conf = para_calloc(sizeof(*conf));
 
        /* exits on errors */
-       file_cmdline_parser(argc, argv, conf);
+       file_write_cmdline_parser(argc, argv, conf);
        return conf;
 }
 
 static void file_write_free_config(void *conf)
 {
-       file_cmdline_parser_free(conf);
+       file_write_cmdline_parser_free(conf);
 }
 
 /** the init function of the file writer */
@@ -152,7 +152,7 @@ void file_write_init(struct writer *w)
 {
        struct file_write_args_info dummy;
 
-       file_cmdline_parser_init(&dummy);
+       file_write_cmdline_parser_init(&dummy);
        w->pre_select = file_write_pre_select;
        w->post_select = file_write_post_select;
        w->parse_config_or_die = file_write_parse_config_or_die;
@@ -162,5 +162,5 @@ void file_write_init(struct writer *w)
                .short_help = file_write_args_info_help,
                .detailed_help = file_write_args_info_detailed_help
        };
-       file_cmdline_parser_free(&dummy);
+       file_write_cmdline_parser_free(&dummy);
 }
index 1cb44931fb89a6a6ae5e0ed8f9ad5cc9b0e2eec6..8adb29cf3036c9e881538773766aaac884768108 100644 (file)
@@ -1,4 +1,4 @@
-args "--unamed-opts=audio_file"
+args "--unamed-opts=audio_file --no-handle-version"
 
 include(header.m4)
 <qu>
index cb7ab03ed258f74f88c8fc70083fb25662ab1a1f..736d70727d6d643e543a8911da4c73ce209d65e6 100644 (file)
@@ -1,4 +1,4 @@
-args "--unamed-opts=command"
+args "--unamed-opts=command --conf-parser --no-handle-version"
 
 include(header.m4)
 <qu>
index f20bd105144fb54a00c4567acde86dc2075c1e81..5522a56dc0af4b10bcf0dfcd3172e426a0ee174c 100644 (file)
@@ -1,4 +1,4 @@
-args "--no-handle-help"
+args "--no-handle-help --no-handle-version --conf-parser"
 
 include(header.m4)
 define(CURRENT_PROGRAM,para_audiod)
index 6b589dc7c46b88ff7879af9c522e92af6b4bef88..23f7c1e65bd7e5aeb23b14a478278596b417bed9 100644 (file)
@@ -1,4 +1,4 @@
-args "--unamed-opts=command --no-handle-error"
+args "--unamed-opts=command --no-handle-error --conf-parser --no-handle-version"
 
 include(header.m4)
 define(CURRENT_PROGRAM,para_client)
index 80f8b73c3999ef3c22cea89bac2931b036ed9606..ff4b451b34cb027e0e0375f778678c38e90abeee 100644 (file)
@@ -1,3 +1,5 @@
+args "--conf-parser --no-handle-version"
+
 section "General options"
 #########################
 
index f2efbc445c3eb92d1620a361163d193f06acfef1..c7337beb3a61989460067e4916bab1f6e3eabd27 100644 (file)
@@ -1,4 +1,4 @@
-args "--no-handle-help"
+args "--no-handle-help --no-handle-version --conf-parser"
 
 include(header.m4)
 include(loglevel.m4)
index 895229b22f8ef68cf7fa143c525eb90310c75a79..bafd325bdea98d831db842ff08931815754aec53 100644 (file)
@@ -1,3 +1,5 @@
+args "--conf-parser --no-handle-version"
+
 include(header.m4)
 define(CURRENT_PROGRAM,para_gui)
 define(DEFAULT_CONFIG_FILE,~/.paraslash/gui.conf)
index cc5835c79dd307f3d0c2322410feae86bd33238d..c613816f214e166f37ae9163877133d21474b0d2 100644 (file)
@@ -1,45 +1,15 @@
-module_ggo_opts := --set-version="($(PACKAGE_STRING), $(codename))"
-
-$(cmdline_dir)/%_recv.cmdline.h $(cmdline_dir)/%_recv.cmdline.c: $(ggo_dir)/%_recv.ggo | $(cmdline_dir)
-       @[ -z "$(Q)" ] || echo 'GGO $<'
-       $(Q) $(GENGETOPT) $(module_ggo_opts) \
-               --output-dir=$(cmdline_dir) \
-               --set-package=$(subst .ggo,,$(<F)) \
-               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
-               --file-name=$(subst .ggo,,$(<F)).cmdline \
-               --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
-
-$(cmdline_dir)/%_filter.cmdline.h $(cmdline_dir)/%_filter.cmdline.c: $(ggo_dir)/%_filter.ggo | $(cmdline_dir)
-       @[ -z "$(Q)" ] || echo 'GGO $<'
-       $(Q) $(GENGETOPT) $(module_ggo_opts) \
-               --output-dir=$(cmdline_dir) \
-               --set-package=$(subst .ggo,,$(<F)) \
-               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
-               --file-name=$(subst .ggo,,$(<F)).cmdline \
-               --func-name=$(subst _filter.ggo,,$(<F))_cmdline_parser < $<
-$(cmdline_dir)/%_write.cmdline.h $(cmdline_dir)/%_write.cmdline.c: $(ggo_dir)/%_write.ggo | $(cmdline_dir)
-       @[ -z "$(Q)" ] || echo 'GGO $<'
-       $(Q) $(GENGETOPT) $(module_ggo_opts) \
-               --output-dir=$(cmdline_dir) \
-               --set-package=$(subst .ggo,,$(<F)) \
-               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
-               --file-name=$(subst .ggo,,$(<F)).cmdline \
-               --func-name $(subst _write.ggo,,$(<F))_cmdline_parser < $<
-
-define ggo-opts
---conf-parser \
---output-dir=$(cmdline_dir) \
---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)"
+define ggo_opts
+       --output-dir=$(cmdline_dir) \
+       --set-version="$(PACKAGE_VERSION)" \
+       --arg-struct-name=$(*F)_args_info \
+       --file-name=$(*F).cmdline \
+       --func-name=$(*F)_cmdline_parser \
+       --set-package="para_$(*F)"
 endef
 
 $(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo | $(cmdline_dir)
        @[ -z "$(Q)" ] || echo 'GGO $<'
-       $(Q) $(GENGETOPT) $(ggo-opts) < $<
+       $(Q) $(GENGETOPT) $(ggo_opts) < $<
 
 $(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \
        $(m4_ggo_dir)/loglevel.m4 $(m4_ggo_dir)/color.m4 \
index 7bc7c106c2288ba99d88c44157d5d79daa4f8bb8..c7b89fe4981bb0dad0ea997b057e3611dd762f7e 100644 (file)
@@ -1,4 +1,4 @@
-args "--no-handle-help"
+args "--no-handle-help --no-handle-version"
 
 include(header.m4)
 include(loglevel.m4)
index 8731561cb5efa663be9da03914e37b0740ed30e1..24d344e9e2fb41a3287c32bc1e2db1c52f918040 100644 (file)
@@ -1,3 +1,5 @@
+args "--conf-parser --no-handle-version"
+
 include(header.m4)
 define(CURRENT_PROGRAM,para_server)
 define(DEFAULT_CONFIG_FILE,~/.paraslash/server.conf)
index 325ce58d906b798595f53727c1d0d56ddaf1bee0..56698e187839786bdbb86558cc8c1171b945dba9 100644 (file)
@@ -1,4 +1,4 @@
-args "--no-handle-help"
+args "--no-handle-help --no-handle-version"
 
 include(header.m4)
 include(loglevel.m4)
index b58c694b4c31040c97284d9684067dcb6df90f71..bcb1eca8dc563881ddc50065b1a2f4e0d18f1182 100644 (file)
@@ -189,7 +189,7 @@ static int mp3dec_parse_config(int argc, char **argv, void **config)
 
        mp3_conf = para_calloc(sizeof(*mp3_conf));
        ret = -E_MP3DEC_SYNTAX;
-       if (mp3dec_cmdline_parser(argc, argv, mp3_conf))
+       if (mp3dec_filter_cmdline_parser(argc, argv, mp3_conf))
                goto err;
        *config = mp3_conf;
        return 1;
@@ -208,7 +208,7 @@ static int mp3dec_execute(struct btr_node *btrn, const char *cmd, char **result)
 
 static void mp3dec_free_config(void *conf)
 {
-       mp3dec_cmdline_parser_free(conf);
+       mp3dec_filter_cmdline_parser_free(conf);
 }
 /**
  * The init function of the mp3dec filter.
@@ -221,7 +221,7 @@ void mp3dec_filter_init(struct filter *f)
 {
        struct mp3dec_filter_args_info dummy;
 
-       mp3dec_cmdline_parser_init(&dummy);
+       mp3dec_filter_cmdline_parser_init(&dummy);
        f->open = mp3dec_open;
        f->close = mp3dec_close;
        f->parse_config = mp3dec_parse_config;
index 57e2387f74affad9a3608a30ff3501e8e520dfeb..d2dc963eaeb03f3b5cc520248109cef0cac6b08b 100644 (file)
@@ -207,13 +207,13 @@ __malloc static void *oss_parse_config_or_die(int argc, char **argv)
        struct oss_write_args_info *conf = para_calloc(sizeof(*conf));
 
        /* exits on errors */
-       oss_cmdline_parser(argc, argv, conf);
+       oss_write_cmdline_parser(argc, argv, conf);
        return conf;
 }
 
 static void oss_free_config(void *conf)
 {
-       oss_cmdline_parser_free(conf);
+       oss_write_cmdline_parser_free(conf);
 }
 
 /**
@@ -227,7 +227,7 @@ void oss_write_init(struct writer *w)
 {
        struct oss_write_args_info dummy;
 
-       oss_cmdline_parser_init(&dummy);
+       oss_write_cmdline_parser_init(&dummy);
        w->close = oss_close;
        w->pre_select = oss_pre_select;
        w->post_select = oss_post_select;
@@ -237,5 +237,5 @@ void oss_write_init(struct writer *w)
                .short_help = oss_write_args_info_help,
                .detailed_help = oss_write_args_info_detailed_help
        };
-       oss_cmdline_parser_free(&dummy);
+       oss_write_cmdline_parser_free(&dummy);
 }
index 69a781cc1b385b3e92009b6291eed4835ee895b9..8dcfb4cd1fcc32082abeae34bdff3a23214a2f20 100644 (file)
@@ -222,13 +222,13 @@ __malloc static void *osx_write_parse_config_or_die(int argc, char **argv)
        struct osx_write_args_info *conf = para_calloc(sizeof(*conf));
 
        /* exits on errors */
-       osx_cmdline_parser(argc, argv, conf);
+       osx_write_cmdline_parser(argc, argv, conf);
        return conf;
 }
 
 static void osx_free_config(void *conf)
 {
-       osx_cmdline_parser_free(conf);
+       osx_write_cmdline_parser_free(conf);
 }
 
 static void osx_write_close(struct writer_node *wn)
@@ -326,7 +326,7 @@ void osx_write_init(struct writer *w)
 {
        struct osx_write_args_info dummy;
 
-       osx_cmdline_parser_init(&dummy);
+       osx_write_cmdline_parser_init(&dummy);
        w->close = osx_write_close;
        w->pre_select = osx_write_pre_select;
        w->post_select = osx_write_post_select;
@@ -336,5 +336,5 @@ void osx_write_init(struct writer *w)
                .short_help = osx_write_args_info_help,
                .detailed_help = osx_write_args_info_detailed_help
        };
-       osx_cmdline_parser_free(&dummy);
+       osx_write_cmdline_parser_free(&dummy);
 }
index 9c6fda56b78430b0f979ec2503299460d00f5212..76ec7c73a411c292ebc62b2b9f857bd212562e60 100644 (file)
@@ -82,7 +82,7 @@ static int prebuffer_parse_config(int argc, char **argv, void **config)
                = para_calloc(sizeof(*prebuffer_conf));
        int ret = -E_PREBUFFER_SYNTAX;
 
-       if (prebuffer_cmdline_parser(argc, argv, prebuffer_conf))
+       if (prebuffer_filter_cmdline_parser(argc, argv, prebuffer_conf))
                goto err;
        ret = -ERRNO_TO_PARA_ERROR(EINVAL);
        if (prebuffer_conf->duration_arg < 0)
@@ -108,7 +108,7 @@ static void prebuffer_open(struct filter_node *fn)
 
 static void prebuffer_free_config(void *conf)
 {
-       prebuffer_cmdline_parser_free(conf);
+       prebuffer_filter_cmdline_parser_free(conf);
 }
 
 /**
@@ -120,7 +120,7 @@ void prebuffer_filter_init(struct filter *f)
 {
        struct prebuffer_filter_args_info dummy;
 
-       prebuffer_cmdline_parser_init(&dummy);
+       prebuffer_filter_cmdline_parser_init(&dummy);
        f->open = prebuffer_open;
        f->close = prebuffer_close;
        f->parse_config = prebuffer_parse_config;