Makefile.in.in 7.33 KB
Newer Older
1
# Makefile for program source directory in GNU NLS utilities package.
Sven Neumann's avatar
Sven Neumann committed
2
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3 4 5 6 7
#
# This file file be copied and used freely without restrictions.  It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
Sven Neumann's avatar
Sven Neumann committed
8 9 10 11
#
# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
#   instead of PACKAGE and to look for po2tbl in ./ not in intl/
#
12 13
# - Modified by jacob berkman <jacob@ximian.com> to install
#   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
14

Sven Neumann's avatar
Sven Neumann committed
15
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@-libgimp
16 17

PACKAGE = @PACKAGE@
18 19 20 21 22 23 24
VERSION = @VERSION@

SHELL = /bin/sh
@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
25
top_builddir = ..
26 27 28 29
VPATH = @srcdir@

prefix = @prefix@
exec_prefix = @exec_prefix@
Sven Neumann's avatar
Sven Neumann committed
30 31 32 33 34
datadir = @datadir@
libdir = @libdir@
localedir = $(libdir)/locale
gnulocaledir = $(datadir)/locale
gettextsrcdir = $(datadir)/glib-2.0/gettext/po
Sven Neumann's avatar
Sven Neumann committed
35
subdir = po
Sven Neumann's avatar
Sven Neumann committed
36 37 38
install_sh = @install_sh@
mkdir_p = @mkdir_p@
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
39 40 41 42 43

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

CC = @CC@
Sven Neumann's avatar
Sven Neumann committed
44
GENCAT = @GENCAT@
Sven Neumann's avatar
Sven Neumann committed
45
GMSGFMT = @GMSGFMT@
46
MSGFMT = @MSGFMT@
Sven Neumann's avatar
Sven Neumann committed
47
XGETTEXT = @XGETTEXT@
48 49
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
Sven Neumann's avatar
Sven Neumann committed
50 51
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
52 53 54 55 56 57 58 59 60

DEFS = @DEFS@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@

INCLUDES = -I.. -I$(top_srcdir)/intl

COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)

61
SOURCES = 
62 63
POFILES = @POFILES@
GMOFILES = @GMOFILES@
Sven Neumann's avatar
Sven Neumann committed
64
DISTFILES = ChangeLog Makefile.in.in POTFILES.in \
65
$(POFILES) $(GMOFILES) $(SOURCES)
66 67 68 69

POTFILES = \

CATALOGS = @CATALOGS@
Sven Neumann's avatar
Sven Neumann committed
70 71
CATOBJEXT = @CATOBJEXT@
INSTOBJEXT = @INSTOBJEXT@
72 73

.SUFFIXES:
Sven Neumann's avatar
Sven Neumann committed
74
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
75 76 77 78 79

.c.o:
	$(COMPILE) $<

.po.pox:
Sven Neumann's avatar
Sven Neumann committed
80
	$(MAKE) $(GETTEXT_PACKAGE).pot
Sven Neumann's avatar
Sven Neumann committed
81
	$(MSGMERGE) $< $(top_builddir)/po/$(GETTEXT_PACKAGE).pot -o $*pox
82 83 84 85 86

.po.mo:
	$(MSGFMT) -o $@ $<

.po.gmo:
Sven Neumann's avatar
Sven Neumann committed
87
	file=`echo $* | sed 's,.*/,,'`.gmo \
Sven Neumann's avatar
Sven Neumann committed
88 89 90 91 92
	  && rm -f $$file && $(GMSGFMT) -o $$file $<

.po.cat:
	sed -f ../intl/po2msg.sed < $< > $*.msg \
	  && rm -f $@ && $(GENCAT) $@ $*.msg
93 94 95 96


all: all-@USE_NLS@

97
all-yes: $(CATALOGS)
98 99
all-no:

Sven Neumann's avatar
Sven Neumann committed
100
$(GETTEXT_PACKAGE).pot: $(POTFILES)
101
	$(GENPOT)
102 103 104 105

install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
106 107
install-data-no: all
install-data-yes: all
Sven Neumann's avatar
Sven Neumann committed
108
	if test -n "$(MKINSTALLDIRS)"; then \
Sven Neumann's avatar
Sven Neumann committed
109 110 111 112
	  $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
	else \
	  $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
	fi
113 114 115
	@catalogs='$(CATALOGS)'; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
Sven Neumann's avatar
Sven Neumann committed
116 117 118 119 120 121
	  case "$$cat" in \
	    *.gmo) destdir=$(gnulocaledir);; \
	    *)     destdir=$(localedir);; \
	  esac; \
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
	  dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
Sven Neumann's avatar
Sven Neumann committed
122
	  if test -n "$(MKINSTALLDIRS)"; then \
Sven Neumann's avatar
Sven Neumann committed
123 124 125 126
	    $(MKINSTALLDIRS) $$dir; \
	  else \
	    $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
	  fi; \
127
	  if test -r $$cat; then \
Sven Neumann's avatar
Sven Neumann committed
128 129
	    $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
	    echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
130
	  else \
Sven Neumann's avatar
Sven Neumann committed
131
	    $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
132
	    echo "installing $(srcdir)/$$cat as" \
Sven Neumann's avatar
Sven Neumann committed
133 134 135 136 137 138 139 140 141 142 143 144 145 146
		 "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
	  fi; \
	  if test -r $$cat.m; then \
	    $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
	    echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
	  else \
	    if test -r $(srcdir)/$$cat.m ; then \
	      $(INSTALL_DATA) $(srcdir)/$$cat.m \
		$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
	      echo "installing $(srcdir)/$$cat as" \
		   "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
	    else \
	      true; \
	    fi; \
147 148
	  fi; \
	done
149
	if test "$(PACKAGE)" = "glib"; then \
Sven Neumann's avatar
Sven Neumann committed
150
	  if test -n "$(MKINSTALLDIRS)"; then \
Sven Neumann's avatar
Sven Neumann committed
151 152 153 154 155 156 157 158 159
	    $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
	  else \
	    $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
	  fi; \
	  $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
			  $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
	else \
	  : ; \
	fi
160 161 162 163 164 165 166 167

# Define this as empty until I found a useful application.
installcheck:

uninstall:
	catalogs='$(CATALOGS)'; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
Sven Neumann's avatar
Sven Neumann committed
168 169 170 171 172
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
173
	done
Sven Neumann's avatar
Sven Neumann committed
174 175 176
	if test "$(PACKAGE)" = "glib"; then \
	  rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
	fi
177 178 179 180 181 182

check: all

dvi info tags TAGS ID:

mostlyclean:
Sven Neumann's avatar
Sven Neumann committed
183
	rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
184
	rm -fr *.o
Sven Neumann's avatar
Sven Neumann committed
185
	rm -f .intltool-merge-cache
186 187 188 189

clean: mostlyclean

distclean: clean
Sven Neumann's avatar
Sven Neumann committed
190
	rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
191 192 193 194 195 196

maintainer-clean: distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."
	rm -f $(GMOFILES)

197
distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
Sven Neumann's avatar
Sven Neumann committed
198
dist distdir: $(DISTFILES) $(GETTEXT_PACKAGE).pot
199 200
	dists="$(DISTFILES)"; \
	for file in $$dists; do \
Sven Neumann's avatar
Sven Neumann committed
201 202
	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
	    || cp -p $(srcdir)/$$file $(distdir); \
203 204 205
	done

update-po: Makefile
Sven Neumann's avatar
Sven Neumann committed
206
	$(MAKE) $(GETTEXT_PACKAGE).pot
Sven Neumann's avatar
Sven Neumann committed
207
	tmpdir=`pwd`; \
Sven Neumann's avatar
Sven Neumann committed
208
	catalogs='$(CATALOGS)'; \
209 210
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
Sven Neumann's avatar
Sven Neumann committed
211
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
212
	  echo "$$lang:"; \
Sven Neumann's avatar
Sven Neumann committed
213 214 215 216 217 218 219 220 221 222 223 224 225
	  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; \
	    fi; \
226 227
	  else \
	    echo "msgmerge for $$cat failed!"; \
Sven Neumann's avatar
Sven Neumann committed
228
	    rm -f $$tmpdir/$$lang.new.po; \
229 230 231
	  fi; \
	done

232 233 234
# POTFILES is created from POTFILES.in by stripping comments, empty lines
# and Intltool tags (enclosed in square brackets), and appending a full
# relative path to them
235 236 237 238 239 240 241
POTFILES: POTFILES.in
	( if test 'x$(srcdir)' != 'x.'; then \
	    posrcprefix='$(top_srcdir)/'; \
	  else \
	    posrcprefix="../"; \
	  fi; \
	  rm -f $@-t $@ \
242 243 244 245
	    && (sed -e '/^#/d' 						\
		    -e "s/^\[.*\] +//" 					\
		    -e '/^[ 	]*$$/d' 				\
		    -e "s@.*@	$$posrcprefix& \\\\@" < $(srcdir)/$@.in	\
246 247 248 249 250 251 252 253 254 255 256 257
		| sed -e '$$s/\\$$//') > $@-t \
	    && chmod a-w $@-t \
	    && mv $@-t $@ )

Makefile: Makefile.in.in ../config.status POTFILES
	cd .. \
	  && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
	       $(SHELL) ./config.status

# 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: