summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxhe <xhebox@users.noreply.github.com>2017-08-30 22:29:18 +0800
committerGitHub <noreply@github.com>2017-08-30 22:29:18 +0800
commitce0d49fe0c35edb286b7bdfad142c347c40047cc (patch)
treef0a378a422935ae8252d0101dc89e89915d02c22
parent092551b242a472ff9618fb21f1b777eccaa3c138 (diff)
parent7cf56e34dd453a996b1346589dea5e76292d2622 (diff)
downloadgettext-tiny-ce0d49fe0c35edb286b7bdfad142c347c40047cc.tar.gz
Merge pull request #13 from sabotage-linux/autopoint-makefile
support auto generation of po Makefile
-rw-r--r--Makefile9
-rw-r--r--data/autopoint_Makefile.in173
-rwxr-xr-xsrc/autopoint.in15
3 files changed, 180 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 283354e..7842c0f 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ bindir=$(prefix)/bin
includedir=$(prefix)/include
libdir=$(prefix)/lib
sysconfdir=$(prefix)/etc
-m4dir=$(prefix)/share/gettext-tiny
+datadir=$(prefix)/share/gettext-tiny
ifeq ($(LIBINTL), MUSL)
LIBSRC = libintl/libintl-musl.c
@@ -28,6 +28,7 @@ ALL_LIBS=libintl.a
endif
ALL_TOOLS=msgfmt msgmerge xgettext autopoint
ALL_M4S=$(sort $(wildcard m4/*.m4))
+ALL_DATA=$(sort $(wildcard data/*))
CFLAGS=-O0 -fPIC
@@ -41,7 +42,7 @@ BUILDCFLAGS=$(CFLAGS)
all: $(ALL_LIBS) $(ALL_TOOLS)
-install: $(ALL_LIBS:lib%=$(DESTDIR)$(libdir)/lib%) $(ALL_INCLUDES:%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:%=$(DESTDIR)$(bindir)/%) $(ALL_M4S:%=$(DESTDIR)$(m4dir)/%)
+install: $(ALL_LIBS:lib%=$(DESTDIR)$(libdir)/lib%) $(ALL_INCLUDES:%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:%=$(DESTDIR)$(bindir)/%) $(ALL_M4S:%=$(DESTDIR)$(datadir)/%) $(ALL_DATA:%=$(DESTDIR)$(datadir)/%)
clean:
rm -f $(ALL_LIBS)
@@ -66,7 +67,7 @@ xgettext:
cp src/xgettext.sh ./xgettext
autopoint: src/autopoint.in
- cat $< | sed 's,@m4dir@,$(m4dir),' > $@
+ cat $< | sed 's,@datadir@,$(datadir),' > $@
$(DESTDIR)$(libdir)/%.a: %.a
install -D -m 755 $< $@
@@ -77,7 +78,7 @@ $(DESTDIR)$(includedir)/%.h: include/%.h
$(DESTDIR)$(bindir)/%: %
install -D -m 755 $< $@
-$(DESTDIR)$(m4dir)/%: %
+$(DESTDIR)$(datadir)/%: %
install -D -m 644 $< $@
.PHONY: all clean install
diff --git a/data/autopoint_Makefile.in b/data/autopoint_Makefile.in
new file mode 100644
index 0000000..93d2254
--- /dev/null
+++ b/data/autopoint_Makefile.in
@@ -0,0 +1,173 @@
+# Makefile for PO directory in any package using GNU gettext.
+# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+#
+# Origin: gettext-0.19.8
+#
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+SED = @SED@
+SHELL = /bin/sh
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
+datadir = @datadir@
+localedir = @localedir@
+gettextsrcdir = $(datadir)/gettext/po
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+mkinstalldirs = $(SHELL) @install_sh@ -d
+install_sh = $(SHELL) @install_sh@
+MKDIR_P = @MKDIR_P@
+mkdir_p = @mkdir_p@
+CROSS_COMPILING = @CROSS_COMPILING@
+GMSGFMT_ = @GMSGFMT@
+GMSGFMT_no = @GMSGFMT@
+GMSGFMT_yes = @GMSGFMT_015@
+GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
+MSGFMT_ = @MSGFMT@
+MSGFMT_no = @MSGFMT@
+MSGFMT_yes = @MSGFMT_015@
+MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
+
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+
+# Makevars gets inserted here. (Don't remove this line!)
+
+.SUFFIXES:
+.SUFFIXES: .po .gmo .mo
+
+.po.mo:
+ @echo "$(MSGFMT) -c -o $@ $<"; \
+ $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+
+.po.gmo:
+ @lang=`echo $* | sed -e 's,.*/,,'`; \
+ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+ echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
+ cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+
+all: all-@USE_NLS@
+all-yes:
+ test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
+all-no:
+
+install: install-@USE_NLS@
+install-strip: install
+install-no:
+install-yes: all
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+ dir=$(localedir)/$$lang/LC_MESSAGES; \
+ $(mkdir_p) $(DESTDIR)$$dir; \
+ if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
+ $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
+ echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
+ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+ if test -n "$$lc"; then \
+ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+ for file in *; do \
+ if test -f $$file; then \
+ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+ fi; \
+ done); \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+ else \
+ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+ :; \
+ else \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ fi; \
+ fi; \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+ ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+ ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+ cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+ echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
+ fi; \
+ done; \
+ done
+
+
+installdirs: installdirs-@USE_NLS@
+installdirs-no:
+installdirs-yes:
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+ dir=$(localedir)/$$lang/LC_MESSAGES; \
+ $(mkdir_p) $(DESTDIR)$$dir; \
+ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+ if test -n "$$lc"; then \
+ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+ for file in *; do \
+ if test -f $$file; then \
+ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+ fi; \
+ done); \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+ else \
+ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+ :; \
+ else \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ fi; \
+ fi; \
+ fi; \
+ done; \
+ done
+
+installcheck:
+
+uninstall: uninstall-@USE_NLS@
+uninstall-no:
+uninstall-yes:
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+ for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+ done; \
+ done
+
+check: all
+
+info dvi ps pdf html tags TAGS ctags CTAGS ID:
+
+install-dvi install-ps install-pdf install-html:
+
+mostlyclean:
+clean:
+ rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+ rm -fr *.o
+
+distclean: clean
+ rm -f Makefile Makefile.in *.mo
diff --git a/src/autopoint.in b/src/autopoint.in
index 56834c4..9b29500 100755
--- a/src/autopoint.in
+++ b/src/autopoint.in
@@ -1,16 +1,5 @@
#!/bin/sh
-m4src=@m4dir@/m4
-
-gen_makefile() {
-cat << EOF > "$1"
-all:
-clean:
-dist:
-distclean:
-install:
-.PHONY: all clean dist distclean install
-EOF
-}
+m4src=@datadir@/m4
mkdir -p m4 intl po
for i in $m4src/*.m4 ; do
@@ -20,6 +9,6 @@ done
touch config.rpath ABOUT-NLS
for i in intl/Makefile.in po/Makefile.in.in ; do
- [ -e "$i" ] && touch "$i" || gen_makefile "$i"
+ [ -e "$i" ] || install -D -m 644 @datadir@/data/autopoint_Makefile.in "$i"
done
true