You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Erik Huelsmann <e....@gmx.net> on 2004/06/21 20:30:39 UTC

[PATCH] Refactor locale targets into separate Makefile

Hi,

The patch below refactors the locale targets into their own Makefile.  That
way translators aren't required to know about building Subversion.  To
prevent duplication of functionality I included the file into the main
Makefile.  That way all targets remain available to the main build system.

The Makefile - if used stand alone - assumes the availability of msgfmt,
msgmerge and xgettext in $PATH.  Although probably not the nicest way of
coding it, we do require those programs, so I did not see any harm assuming
them to be there.  The change is effectively a no-op for the main build
system in terms of functionality.

Comments?

bye,


Erik.


Log
[[[
Refactor locale targets into a separate Makefile.

* subversion/po/Makefile: New file. Standalone makefile for building
  locale targets.

* Makefile.in: remove locale relates targets and SUFFIXES; include the
  new subversion/po/Makefile to compensate.
]]]
Index: Makefile.in
===================================================================
--- Makefile.in (revision 10046)
+++ Makefile.in (working copy)
@@ -258,24 +258,6 @@
                                                                            
   
 local-all: @BUILD_RULES@
                                                                            
   
-locale-gnu-pot:
-       (cd $(abs_srcdir)/subversion/ ; \
-        find . \
-         -name .svn -prune -or \
-         -name tests -prune -or \
-         -name bindings -prune -or \
-         -name "*.c" -print -or \
-         -name "svn_error_codes.h" -print | \
-        $(XGETTEXT) --sort-by-file -k_ -kN_ -kSVN_ERRDEF:3 \
-         --msgid-bugs-address=dev@subversion.tigris.org \
-         --add-comments --files-from=- -o po/subversion.pot )
-
-locale-gnu-po-update: locale-gnu-pot
-       (cd $(abs_srcdir)/subversion/po ; \
-        for i in *.po ; do \
-          $(MSGMERGE) --sort-by-file --update $$i subversion.pot ; \
-        done )
-
 # clean everything but the bulky test output, returning the system back
 # to before 'make' was run.
 fast-clean: doc-clean
@@ -491,8 +473,7 @@
 # Implicit rules for creating outputs from input files
 #
 .SUFFIXES:
-.SUFFIXES: .c .lo .o .la-a .la .texi .info .dvi .txt .html .ps .pdf \
-           .po .spo .mo
+.SUFFIXES: .c .lo .o .la-a .la .texi .info .dvi .txt .html .ps .pdf
  
 .c.o:
        $(COMPILE) -o $@ -c $<
@@ -522,12 +503,10 @@
 .dvi.pdf:
        $(DVIPDF) $< $@
  
-.po.spo:
-       sed '/^"Content-Type: text\/plain; charset=UTF-8\\n"$$/d' $< > $@
  
-.spo.mo:
-       $(MSGFMT) -o $@ $<
+include subversion/po/Makefile
  
+
 install-docs: install-man @INSTALL_INFO@
  
 manroot = $(mandir)/man
Index: subversion/po/Makefile
===================================================================
--- subversion/po/Makefile      (revision 0)
+++ subversion/po/Makefile      (revision 0)
@@ -0,0 +1,35 @@
+
+abs_srcdir ?= ../..
+MSGFMT ?= msgfmt
+MSGMERGE ?= msgmerge
+XGETTEXT ?= xgettext
+
+locale-gnu-pot:
+       (cd $(abs_srcdir)/subversion/ ; \
+        find . \
+         -name .svn -prune -or \
+         -name tests -prune -or \
+         -name bindings -prune -or \
+         -name "*.c" -print -or \
+         -name "svn_error_codes.h" -print | \
+        $(XGETTEXT) --sort-by-file -k_ -kN_ -kSVN_ERRDEF:3 \
+         --msgid-bugs-address=dev@subversion.tigris.org \
+         --add-comments --files-from=- -o po/subversion.pot )
+
+locale-gnu-po-update: locale-gnu-pot
+       (cd $(abs_srcdir)/subversion/po ; \
+        for i in *.po ; do \
+          $(MSGMERGE) --sort-by-file --update $$i subversion.pot ; \
+        done )
+
+
+
+.SUFFIXES: .po .spo .mo
+
+
+.po.spo:
+       sed '/^"Content-Type: text\/plain; charset=UTF-8\\n"$$/d' $< > $@
+
+.spo.mo:
+       $(MSGFMT) -o $@ $<
+


-- 
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Refactor locale targets into separate Makefile

Posted by Branko Čibej <br...@xbc.nu>.
Erik Huelsmann wrote:

>[ about Makefile contents ]
>
>  
>
>>>+include subversion/po/Makefile
>>>      
>>>
>>Does this work if src_dir != build_ir?
>>    
>>
>
>I started wondering about that after I sent the mail; I'd need to try.
>Anybody?
>  
>
Nope, of course it doesn't. It should be $(abs_srcdir)/po/Makefile, and 
the default for abs_srcdir should be '.'. But of course, that's a minor 
issue, because not all makes understand the 'include' directive with 
that spelling. It's '.include' in some BSD makes I've seen. I wonder if 
autoconf know how to replace that? It should...

>>>Index: subversion/po/Makefile
>>>===================================================================
>>>--- subversion/po/Makefile      (revision 0)
>>>+++ subversion/po/Makefile      (revision 0)
>>>@@ -0,0 +1,35 @@
>>>+
>>>+abs_srcdir ?= ../..
>>>      
>>>
That's _not_ abs_srcdir... :-)

>>>+MSGFMT ?= msgfmt
>>>      
>>>
>>Is ?= available in all make clones we support? Probably, since you used
>>it? :-)
>>    
>>
>Hmm; no. I used it because I was looking in the (gnu) make manuals.  I'll
>have a look at the nmake manuals.
>  
>
It's completely GNUish, as far as I know. Hmmm...

One way to avoid this problem would be to use normal assignment, and 
change to top-level makefile to _call_ this one instead of oncluding it. 
That means you get to keep the suffixes, and the rules get expanded to

    $(MAKE) $@ abs_srcdir="$(abs_srcdir)" XGETTEXT="$(XGETTEXT)" MSGFMT="$(MSGFMT)"

And so on. The settings on the command line will override the 
assignments in the makefile.

-- Brane


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Refactor locale targets into separate Makefile

Posted by Erik Huelsmann <e....@gmx.net>.
[ about Makefile contents ]

> > +include subversion/po/Makefile
> 
> Does this work if src_dir != build_ir?

I started wondering about that after I sent the mail; I'd need to try.
Anybody?

> > Index: subversion/po/Makefile
> > ===================================================================
> > --- subversion/po/Makefile      (revision 0)
> > +++ subversion/po/Makefile      (revision 0)
> > @@ -0,0 +1,35 @@
> > +
> > +abs_srcdir ?= ../..
> > +MSGFMT ?= msgfmt
> 
> Is ?= available in all make clones we support? Probably, since you used
> it? :-)

Hmm; no. I used it because I was looking in the (gnu) make manuals.  I'll
have a look at the nmake manuals.

The reason I submitted a patch is because I think I have little cross
platform experience with build systems; 'just' writing a makefile is
entirely different.


bye,

Erik.

-- 
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Refactor locale targets into separate Makefile

Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Mon, 21 Jun 2004, Erik Huelsmann wrote:

> The patch below refactors the locale targets into their own Makefile.  That
> way translators aren't required to know about building Subversion.  To
> prevent duplication of functionality I included the file into the main
> Makefile.  That way all targets remain available to the main build system.
>
Looks good overall.

> +include subversion/po/Makefile

Does this work if src_dir != build_ir?

> Index: subversion/po/Makefile
> ===================================================================
> --- subversion/po/Makefile      (revision 0)
> +++ subversion/po/Makefile      (revision 0)
> @@ -0,0 +1,35 @@
> +
> +abs_srcdir ?= ../..
> +MSGFMT ?= msgfmt

Is ?= available in all make clones we support? Probably, since you used
it? :-)

Regards,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Refactor locale targets into separate Makefile

Posted by Branko Čibej <br...@xbc.nu>.
Greg Stein wrote:

>And that said, I still think that we shouldn't use 'find' in a rule to
>look for inputs. Those should be determined by gen-make with specific
>instructions from the build.conf file. It is way too easy to add a new
>subdirectory or somesuch, and have it accidentally picked up by the find
>command. The set of files could be dropped into a text file at the top
>level, and the --files-from switch would point to that file. Heck,
>build.conf might not need to change that much, as gen-make could just look
>at all the of the .c files in its dependency graph.
>  
>
There's an idea -- since 'find' won't work on Windows anyway (does for 
me, since I have cygwin, ugh), we could have gen-make generate the whole 
makefile from a template in such a way that it works on all platforms. 
We could then let autoconf generate the include bits on Unix.

So a translator would still have to run gen-make, but not autogen or 
configure (it could be gen-make -s, too).

-- Brane


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Refactor locale targets into separate Makefile

Posted by Greg Stein <gs...@lyra.org>.
On Mon, Jun 21, 2004 at 10:30:39PM +0200, Erik Huelsmann wrote:
>...
> +++ Makefile.in (working copy)
>...
> @@ -522,12 +503,10 @@
>  .dvi.pdf:
>         $(DVIPDF) $< $@
>   
> -.po.spo:
> -       sed '/^"Content-Type: text\/plain; charset=UTF-8\\n"$$/d' $< > $@
>   
> -.spo.mo:
> -       $(MSGFMT) -o $@ $<
> +include subversion/po/Makefile

That include mechanism is non-portable. Take a look at what configure
does, and the Makefile.in construction, for including build-outputs.mk. A
similar mechanism will be required *if* you want to include the targets.
It might be cleaner to use (ugh) recursive make.

>...
> +++ subversion/po/Makefile      (revision 0)
> @@ -0,0 +1,35 @@
> +
> +abs_srcdir ?= ../..
> +MSGFMT ?= msgfmt
> +MSGMERGE ?= msgmerge
> +XGETTEXT ?= xgettext

I'm not familiar with the ?= construction. I suspect it is non-portable.

> +
> +locale-gnu-pot:
> +       (cd $(abs_srcdir)/subversion/ ; \
> +        find . \
> +         -name .svn -prune -or \
> +         -name tests -prune -or \
> +         -name bindings -prune -or \
> +         -name "*.c" -print -or \
> +         -name "svn_error_codes.h" -print | \
> +        $(XGETTEXT) --sort-by-file -k_ -kN_ -kSVN_ERRDEF:3 \
> +         --msgid-bugs-address=dev@subversion.tigris.org \
> +         --add-comments --files-from=- -o po/subversion.pot )
> +
> +locale-gnu-po-update: locale-gnu-pot
> +       (cd $(abs_srcdir)/subversion/po ; \
> +        for i in *.po ; do \
> +          $(MSGMERGE) --sort-by-file --update $$i subversion.pot ; \
> +        done )

For both of these rules, there is no need to use parentheses. A subshell
is not required, although you still want to retain the semicolons and
backslashes to ensure that they are run as a single command.

[ as a guess, I'd guess that somebody didn't realize that the 'cd' won't
  extend past the single Makefile command; each line in a target is run
  within its own shell process, so the cd won't carry very far ]

And that said, I still think that we shouldn't use 'find' in a rule to
look for inputs. Those should be determined by gen-make with specific
instructions from the build.conf file. It is way too easy to add a new
subdirectory or somesuch, and have it accidentally picked up by the find
command. The set of files could be dropped into a text file at the top
level, and the --files-from switch would point to that file. Heck,
build.conf might not need to change that much, as gen-make could just look
at all the of the .c files in its dependency graph.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org