Re: [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls
On Tue, Aug 31, 2010 at 14:51, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 37 quoted lines
> Ævar Arnfjörð Bjarmason wrote:
>
>> +++ b/Makefile
>> @@ -2008,10 +2008,11 @@ cscope:
>> $(RM) cscope*
>> $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
>>
>> +XGETTEXT_OPTIONS = --add-comments
>> pot:
>> - $(XGETTEXT) --add-comments --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
>> - $(XGETTEXT) --add-comments --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
>> - $(XGETTEXT) --add-comments --join-existing --keyword=__ --output=po/git.pot --language=Perl $(SCRIPT_PERL) t/t0200/test.perl
>> + $(XGETTEXT) $(XGETTEXT_OPTIONS) --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
>> + $(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
>> + $(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --keyword=__ --output=po/git.pot --language=Perl $(SCRIPT_PERL) t/t0200/test.perl
>
> The long lines are a bit scary. :)
>
> Maybe more of it could be pulled out into variables. As a
> side-effect, users could override some settings from the command line.
> Maybe something like this?
>
> LOCALIZED_C = $(C_OBJ:o=c) t/t0200/test.c
> LOCALIZED_SH = $(SCRIPT_SH) t/t0200/test.sh
> LOCALIZED_PERL = $(SCRIPT_PERL) t/t0200/test.perl
>
> XGETTEXT_OPTIONS = --add-comments
> XGETTEXT_OPTIONS_C = $(XGETTEXT_OPTIONS) -k_ -kN_ -LC
> XGETTEXT_OPTIONS_SH = $(XGETTEXT_OPTIONS) -LShell
> XGETTEXT_OPTIONS_PERL = $(XGETTEXT_OPTIONS) -k__ -LPerl
>
> po/git.pot:
> rm -f $@+
> $(XGETTEXT) -o$@+ $(XGETTEXT_OPTIONS_C) $(LOCALIZED_C)
> $(XGETTEXT) -j -o$@+ $(XGETTEXT_OPTIONS_SH) $(LOCALIZED_SH)
> $(XGETTEXT) -j -o$@+ $(XGETTEXT_OPTIONS_PERL) $(LOCALIZED_PERL)
> mv $@+ $@
Thanks. I worked that into v2.