]> git.ipfire.org Git - thirdparty/git.git/blobdiff - Makefile
i18n: avoid parenthesized string as array initializer
[thirdparty/git.git] / Makefile
index 5c2b797554a25d5cecee28aa6d18fc885aa0b3e8..92c1c5e23b96f8bed1b1ac2dbff6c05580ecf678 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,11 +45,6 @@ all::
 # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
 # d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
 #
-# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
-# do not support the 'size specifiers' introduced by C99, namely ll, hh,
-# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
-# some C compilers supported these specifiers prior to C99 as an extension.
-#
 # Define NO_STRCASESTR if you don't have strcasestr.
 #
 # Define NO_MEMMEM if you don't have memmem.
@@ -216,6 +211,11 @@ 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.  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.
 #
@@ -316,6 +316,7 @@ INSTALL = install
 RPMBUILD = rpmbuild
 TCL_PATH = tclsh
 TCLTK_PATH = wish
+XGETTEXT = xgettext
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
 GCOV = gcov
@@ -515,6 +516,7 @@ LIB_H += diff.h
 LIB_H += dir.h
 LIB_H += exec_cmd.h
 LIB_H += fsck.h
+LIB_H += gettext.h
 LIB_H += git-compat-util.h
 LIB_H += graph.h
 LIB_H += grep.h
@@ -871,7 +873,6 @@ ifeq ($(uname_S),SunOS)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
                NO_STRLCPY = YesPlease
-               NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
                GIT_TEST_CMP = cmp
        endif
@@ -882,21 +883,18 @@ ifeq ($(uname_S),SunOS)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
                NO_STRLCPY = YesPlease
-               NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
                GIT_TEST_CMP = cmp
        endif
        ifeq ($(uname_R),5.8)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
-               NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
                GIT_TEST_CMP = cmp
        endif
        ifeq ($(uname_R),5.9)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
-               NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
                GIT_TEST_CMP = cmp
        endif
@@ -1076,7 +1074,6 @@ ifeq ($(uname_S),Windows)
        NO_MEMMEM = YesPlease
        # NEEDS_LIBICONV = YesPlease
        NO_ICONV = YesPlease
-       NO_C99_FORMAT = YesPlease
        NO_STRTOUMAX = YesPlease
        NO_STRTOULL = YesPlease
        NO_MKDTEMP = YesPlease
@@ -1153,7 +1150,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
        NO_MEMMEM = YesPlease
        NEEDS_LIBICONV = YesPlease
        OLD_ICONV = YesPlease
-       NO_C99_FORMAT = YesPlease
        NO_STRTOUMAX = YesPlease
        NO_MKDTEMP = YesPlease
        NO_MKSTEMPS = YesPlease
@@ -1356,9 +1352,6 @@ endif
 ifdef NO_NSEC
        BASIC_CFLAGS += -DNO_NSEC
 endif
-ifdef NO_C99_FORMAT
-       BASIC_CFLAGS += -DNO_C99_FORMAT
-endif
 ifdef SNPRINTF_RETURNS_BOGUS
        COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
        COMPAT_OBJS += compat/snprintf.o
@@ -1370,6 +1363,10 @@ endif
 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
        COMPAT_CFLAGS += -DNO_STRCASESTR
        COMPAT_OBJS += compat/strcasestr.o
@@ -1581,6 +1578,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; \
@@ -2048,6 +2046,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)
@@ -2089,6 +2101,7 @@ endif
 ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
        @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
 endif
+       @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
 
 ### Detect Tck/Tk interpreter path changes
 ifndef NO_TCLTK
@@ -2149,7 +2162,7 @@ check-sha1:: test-sha1$X
 check: common-cmds.h
        if sparse; \
        then \
-               for i in *.c; \
+               for i in $(patsubst %.o, %.c, $(GIT_OBJS)); \
                do \
                        sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
                done; \
@@ -2314,6 +2327,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 \