Code

i18n: git-status "nothing to commit" messages
[git.git] / Makefile
index c348bb73375bcd7aed3264f2aa3efd184d6947aa..749783511c435ff40f4842b74151904cc58734f8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -217,7 +217,9 @@ all::
 # Define NO_REGEX if you have no or inferior regex support in your C library.
 #
 # Define GETTEXT_POISON if you are debugging the choice of strings marked
-# for translation.  This will turn all strings that use gettext into gibberish.
+# for translation.  In a GETTEXT_POISON build, you can turn all strings marked
+# for translation into gibberish by setting the GIT_GETTEXT_POISON variable
+# (to any value) in your environment.
 #
 # Define JSMIN to point to JavaScript minifier that functions as
 # a filter to have gitweb.js minified.
@@ -319,6 +321,7 @@ INSTALL = install
 RPMBUILD = rpmbuild
 TCL_PATH = tclsh
 TCLTK_PATH = wish
+XGETTEXT = xgettext
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
 GCOV = gcov
@@ -1374,6 +1377,7 @@ ifdef NO_SYMLINK_HEAD
        BASIC_CFLAGS += -DNO_SYMLINK_HEAD
 endif
 ifdef GETTEXT_POISON
+       LIB_OBJS += gettext.o
        BASIC_CFLAGS += -DGETTEXT_POISON
 endif
 ifdef NO_STRCASESTR
@@ -1587,6 +1591,7 @@ ifndef V
        QUIET_BUILT_IN = @echo '   ' BUILTIN $@;
        QUIET_GEN      = @echo '   ' GEN $@;
        QUIET_LNCP     = @echo '   ' LN/CP $@;
+       QUIET_XGETTEXT = @echo '   ' XGETTEXT $@;
        QUIET_GCOV     = @echo '   ' GCOV $@;
        QUIET_SUBDIR0  = +@subdir=
        QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
@@ -2054,6 +2059,20 @@ info:
 pdf:
        $(MAKE) -C Documentation pdf
 
+XGETTEXT_FLAGS = \
+       --force-po \
+       --add-comments \
+       --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
+       --from-code=UTF-8
+XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --keyword=_ --keyword=N_ --language=C
+LOCALIZED_C := $(C_OBJ:o=c)
+
+po/git.pot: $(LOCALIZED_C)
+       $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) && \
+       mv $@+ $@
+
+pot: po/git.pot
+
 $(ETAGS_TARGET): FORCE
        $(RM) $(ETAGS_TARGET)
        $(FIND) . -name '*.[hcS]' -print | xargs etags -a -o $(ETAGS_TARGET)
@@ -2321,6 +2340,7 @@ dist-doc:
 
 distclean: clean
        $(RM) configure
+       $(RM) po/git.pot
 
 clean:
        $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \