Makefile.in.in 6.74 KB
Newer Older
smorlat's avatar
smorlat committed
1 2 3
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns@gmail.com>
aymeric's avatar
aymeric committed
4
#
smorlat's avatar
smorlat committed
5 6 7
# This file may be copied and used freely without restrictions.  It may
# be used in projects which are not available under a GNU Public License,
# but which still want to provide support for the GNU gettext functionality.
aymeric's avatar
aymeric committed
8
#
smorlat's avatar
smorlat committed
9 10 11 12 13 14 15 16 17 18
# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
#   instead of PACKAGE and to look for po2tbl in ./ not in intl/
#
# - Modified by jacob berkman <jacob@ximian.com> to install
#   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
#
# - Modified by Rodney Dawes <dobey.pwns@gmail.com> for use with intltool
#
# We have the following line for use by intltoolize:
# INTLTOOL_MAKEFILE
aymeric's avatar
aymeric committed
19

smorlat's avatar
smorlat committed
20
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
aymeric's avatar
aymeric committed
21 22 23
PACKAGE = @PACKAGE@
VERSION = @VERSION@

24
SHELL = @SHELL@
aymeric's avatar
aymeric committed
25 26 27

srcdir = @srcdir@
top_srcdir = @top_srcdir@
smorlat's avatar
smorlat committed
28
top_builddir = @top_builddir@
aymeric's avatar
aymeric committed
29 30 31 32 33
VPATH = @srcdir@

prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
smorlat's avatar
smorlat committed
34 35 36 37 38 39 40 41 42
datarootdir = @datarootdir@
libdir = @libdir@
DATADIRNAME = @DATADIRNAME@
itlocaledir = $(prefix)/$(DATADIRNAME)/locale
subdir = po
install_sh = @install_sh@
# Automake >= 1.8 provides @mkdir_p@.
# Until it can be supposed, use the safe fallback:
mkdir_p = $(install_sh) -d
aymeric's avatar
aymeric committed
43 44 45 46

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

smorlat's avatar
smorlat committed
47 48 49 50 51 52 53
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
GENPOT   = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
aymeric's avatar
aymeric committed
54

smorlat's avatar
smorlat committed
55 56 57 58
ALL_LINGUAS = @ALL_LINGUAS@

PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)

Jehan Monnier's avatar
Jehan Monnier committed
59
USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep '^$$lang$$' $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep '^$$lang$$'`"; then printf "$$lang "; fi; done; fi)
aymeric's avatar
aymeric committed
60

smorlat's avatar
smorlat committed
61
USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
aymeric's avatar
aymeric committed
62

smorlat's avatar
smorlat committed
63 64 65 66 67 68 69 70 71
POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)

DISTFILES = Makefile.in.in POTFILES.in $(POFILES)
EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS

POTFILES = \
# This comment gets stripped out

CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
aymeric's avatar
aymeric committed
72 73

.SUFFIXES:
smorlat's avatar
smorlat committed
74 75 76 77 78
.SUFFIXES: .po .pox .gmo .mo .msg .cat

.po.pox:
	$(MAKE) $(GETTEXT_PACKAGE).pot
	$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
aymeric's avatar
aymeric committed
79 80

.po.mo:
smorlat's avatar
smorlat committed
81
	$(MSGFMT) -o $@ $<
aymeric's avatar
aymeric committed
82 83

.po.gmo:
smorlat's avatar
smorlat committed
84 85
	file=`echo $* | sed 's,.*/,,'`.gmo \
	  && rm -f $$file && $(GMSGFMT) -o $$file $<
aymeric's avatar
aymeric committed
86

smorlat's avatar
smorlat committed
87 88 89
.po.cat:
	sed -f ../intl/po2msg.sed < $< > $*.msg \
	  && rm -f $@ && gencat $@ $*.msg
aymeric's avatar
aymeric committed
90 91 92 93


all: all-@USE_NLS@

smorlat's avatar
smorlat committed
94
all-yes: $(CATALOGS)
aymeric's avatar
aymeric committed
95 96
all-no:

smorlat's avatar
smorlat committed
97 98
$(GETTEXT_PACKAGE).pot: $(POTFILES)
	$(GENPOT)
aymeric's avatar
aymeric committed
99

smorlat's avatar
smorlat committed
100
install: install-data
aymeric's avatar
aymeric committed
101 102 103
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
smorlat's avatar
smorlat committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
	linguas="$(USE_LINGUAS)"; \
	for lang in $$linguas; do \
	  dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
	  $(mkdir_p) $$dir; \
	  if test -r $$lang.gmo; then \
	    $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
	    echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
	  else \
	    $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
	    echo "installing $(srcdir)/$$lang.gmo as" \
		 "$$dir/$(GETTEXT_PACKAGE).mo"; \
	  fi; \
	  if test -r $$lang.gmo.m; then \
	    $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
	    echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
	  else \
	    if test -r $(srcdir)/$$lang.gmo.m ; then \
	      $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
		$$dir/$(GETTEXT_PACKAGE).mo.m; \
	      echo "installing $(srcdir)/$$lang.gmo.m as" \
		   "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
	    else \
	      true; \
aymeric's avatar
aymeric committed
127
	    fi; \
smorlat's avatar
smorlat committed
128
	  fi; \
aymeric's avatar
aymeric committed
129 130
	done

smorlat's avatar
smorlat committed
131 132
# Empty stubs to satisfy archaic automake needs
dvi info tags TAGS ID:
aymeric's avatar
aymeric committed
133 134

# Define this as empty until I found a useful application.
smorlat's avatar
smorlat committed
135
install-exec installcheck:
aymeric's avatar
aymeric committed
136

smorlat's avatar
smorlat committed
137 138 139 140 141 142
uninstall:
	linguas="$(USE_LINGUAS)"; \
	for lang in $$linguas; do \
	  rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
	  rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
	done
aymeric's avatar
aymeric committed
143

smorlat's avatar
smorlat committed
144 145 146 147 148 149
check: all $(GETTEXT_PACKAGE).pot
	rm -f missing notexist
	srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
	if [ -r missing -o -r notexist ]; then \
	  exit 1; \
	fi
aymeric's avatar
aymeric committed
150 151

mostlyclean:
smorlat's avatar
smorlat committed
152 153
	rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
	rm -f .intltool-merge-cache
aymeric's avatar
aymeric committed
154 155 156 157

clean: mostlyclean

distclean: clean
smorlat's avatar
smorlat committed
158 159
	rm -f Makefile Makefile.in POTFILES stamp-it
	rm -f *.mo *.msg *.cat *.cat.m *.gmo
aymeric's avatar
aymeric committed
160 161 162 163

maintainer-clean: distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."
smorlat's avatar
smorlat committed
164 165 166 167
	rm -f Makefile.in.in

distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: $(DISTFILES)
aymeric's avatar
aymeric committed
168
	dists="$(DISTFILES)"; \
smorlat's avatar
smorlat committed
169 170 171
	extra_dists="$(EXTRA_DISTFILES)"; \
	for file in $$extra_dists; do \
	  test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
aymeric's avatar
aymeric committed
172 173
	done; \
	for file in $$dists; do \
smorlat's avatar
smorlat committed
174 175 176
	  test -f $$file || file="$(srcdir)/$$file"; \
	  ln $$file $(distdir) 2> /dev/null \
	    || cp -p $$file $(distdir); \
aymeric's avatar
aymeric committed
177 178 179
	done

update-po: Makefile
smorlat's avatar
smorlat committed
180
	$(MAKE) $(GETTEXT_PACKAGE).pot
aymeric's avatar
aymeric committed
181
	tmpdir=`pwd`; \
smorlat's avatar
smorlat committed
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
	linguas="$(USE_LINGUAS)"; \
	for lang in $$linguas; do \
	  echo "$$lang:"; \
	  result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
	  if $$result; then \
	    if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
	      rm -f $$tmpdir/$$lang.new.po; \
            else \
	      if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
	        :; \
	      else \
	        echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
	        rm -f $$tmpdir/$$lang.new.po; \
	        exit 1; \
	      fi; \
aymeric's avatar
aymeric committed
197
	    fi; \
smorlat's avatar
smorlat committed
198 199 200
	  else \
	    echo "msgmerge for $$lang.gmo failed!"; \
	    rm -f $$tmpdir/$$lang.new.po; \
aymeric's avatar
aymeric committed
201
	  fi; \
smorlat's avatar
smorlat committed
202
	done
aymeric's avatar
aymeric committed
203

smorlat's avatar
smorlat committed
204 205 206 207 208
Makefile POTFILES: stamp-it
	@if test ! -f $@; then \
	  rm -f stamp-it; \
	  $(MAKE) stamp-it; \
	fi
aymeric's avatar
aymeric committed
209

smorlat's avatar
smorlat committed
210
stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
aymeric's avatar
aymeric committed
211
	cd $(top_builddir) \
smorlat's avatar
smorlat committed
212 213
	  && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
	       $(SHELL) ./config.status
aymeric's avatar
aymeric committed
214 215 216 217

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: