summaryrefslogtreecommitdiffstats
path: root/po/Makefile.in.in
blob: 3d4b02480bc25f6a952564189edf66eba1e870a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# 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.
#
# - 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 jwz to not suck wet farts from dead pigeons.
#   This is truly one of the worst-written Makefiles I've ever seen.
#   Problems I (tried to) fix:
#
#     - MKINSTALLDIRS was $(top_srcdir)/@MKINSTALLDIRS@, but the
#       configure script already put $(top_srcdir) into @MKINSTALLDIRS@,
#       so the result was an absolute path that didn't work at all.
#
#     - GMSGFMT and XGETTEXT set $PATH to some random value before
#       running the program.  That's completely stupid, and anyway,
#       the hardcoded $PATH value they were using (../src) do not
#       apply to xscreensaver.
#
#     - the .po.gmo, .po.cat, .po.pox, .pot, install-data-yes, update-po, and
#	uninstall rules didn't actually print the commands they were
#	executing: they just dumped a bunch of sh code at you, and expected
#	you to figure it out yourself.  This is typical behavior of Makefile
#	rules written by morons.
#
#     - intltool-update prints a lot of useless crap to both stderr and
#	stdout and has no command-line argument meaning "be quiet, and only
#	print errors", so I just redirected the whole thing to /dev/null.
#
#     - Demonstrating a total misunderstanding of build-directories and
#       VPATH, the .po.gmo rule was writing output to $(srcdir).  When
#       the current directory is not $(srcdir), one *never* writes to
#       $(srcdir) -- it is to be considered read-only.
#
#     - Likewise, install-data-yes was looking for .gmo files in both the
#       current directory, and in $(srcdir).  In the case where those are
#       not the same directory, there must be no .gmo files in $(srcdir).
#
#     - The update-po rule was explicitly writing to $(srcdir).  I changed
#       it to just work in the current directory.  As I understand it, it
#       only makes sense to run this rule while in the srcdir, e.g., from
#       distdepend -- so it should be allowed to error out when run in an
#       inappropriate directory.
#
#     - install-data-yes went through great code-duplication-contortions
#       to cope with the file mentioned by MKINSTALLDIRS not actually
#       existing!  Instead of assuming that MKINSTALLDIRS will be set to
#       an actual, correct value, it had a hardcoded check to look for it
#       in $(top_srcdir) as well!  WTF!
#
#     - It turns out that "msgfmt" silently fails to write a .gmo file
#       if the source .po file is empty (or otherwise not yet written.)
#       The install-data-yes rule made no provision for this, and would
#       just error out when the .gmo files were not there.
#
#     - $(DESTDIR) was being used where $(install_prefix) should have been.
#
#     - For xscreensaver, $(prefix) is generally /usr/X11R6/, but some files
#	need to go under /usr/ instead of under /usr/X11R6/ -- for those, we
#	use @PO_DATADIR@ instead of @prefix@.  So I changed $(datadir) and
#	$(gnulocaledir) appropriately.
#
#     - WTF is $(gettextsrcdir) doing in here?
#
#     - added  "*.gmo *.pot" to "distclean".
#
#     - I added a rule to po/POTFILES.in so that I wouldn't have to maintain
#       that list of files in two places.
#   
#     - I removed the rule to auto-regenerate Makefile from Makefile.in.in
#       because it made my top-level "make distdepend" rule fail: things
#       were executing in the wrong order.
#
#     - the .po.cat rule has a hardcoded "../intl/po2msg.sed" in it.
#       Guess what, I don't have any such directory.  And that should be
#       refering to $(srcdir) anyway.  So I just commented (my half-fixed
#       version of) this rule out.
#

# config.status complains if "po/Makefile.in.in was not created by intltoolize".
# INTLTOOL_MAKEFILE

GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
PACKAGE = @PACKAGE@
VERSION = @VERSION@

SHELL = /bin/sh
@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
VPATH = @srcdir@

prefix = @prefix@
exec_prefix = @exec_prefix@
#datadir = $(prefix)/@DATADIRNAME@      -- not for xscreensaver
datadir = @PO_DATADIR@
datarootdir = @datarootdir@
localedir = $(datadir)/locale
#localedir = $(prefix)/share/locale
#gnulocaledir = $(prefix)/share/locale  -- not for xscreensaver
gnulocaledir = $(localedir)
#gettextsrcdir = $(prefix)/share/glib-2.0/gettext/po
subdir = po
DESTDIR = $(install_prefix)

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

# #### NO.  This gets me "..//usr/bin/install: No such file or directory".
# The @MKINSTALLDIRS@ variable must have the absolute (or unqualified)
# path of the install program.  --jwz.
# MKINSTALLDIRS = $(top_builddir)/@MKINSTALLDIRS@

MKINSTALLDIRS = @MKINSTALLDIRS@

CC = @CC@
#GENCAT = @GENCAT@
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
MSGMERGE = $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
GENPOT   = $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot

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

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

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

SOURCES = 
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES_1 = ChangeLog Makefile.in.in POTFILES.in update.sh
DISTFILES = $(DISTFILES_1) $(GETTEXT_PACKAGE).pot \
	    $(POFILES) $(GMOFILES) $(SOURCES)

TARFILES = $(DISTFILES_1) $(POFILES) $(SOURCES)

POTFILES = \
# This comment gets stripped out

CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
INSTOBJEXT = @INSTOBJEXT@

.SUFFIXES:
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat

.c.o:
	$(COMPILE) $<

.po.pox:
	$(MAKE) $(GETTEXT_PACKAGE).pot
	INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
	export INTLTOOL_EXTRACT ; \
	echo $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox ; \
	     $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox

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

# jwz: the "-" means "ignore any errors here, because I don't give a shit."
.po.gmo:
	@-file=`echo $* | sed 's,.*/,,'`.gmo ; \
	 rm -f "$$file" ; \
	 echo $(GMSGFMT) -o "$$file" $< ; \
	      $(GMSGFMT) -o "$$file" $<

#.po.cat:
#	@echo "sed -f ../intl/po2msg.sed < $< > $*.msg" ; \
#	       sed -f ../intl/po2msg.sed < $< > $*.msg && \
#	 rm -f $@ && \
#	 echo $(GENCAT) "$@" "$*.msg" ; \
#	      $(GENCAT) "$@" "$*.msg"


all: all-@USE_NLS@
default: all

all-yes: $(CATALOGS)
all-no:

$(GETTEXT_PACKAGE).pot: $(POTFILES)
	@INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
	export INTLTOOL_EXTRACT ; \
	echo top_srcdir=$(top_srcdir) $(GENPOT) ; \
	     top_srcdir=$(top_srcdir) $(GENPOT)

install-strip: install

install: install-exec install-data
install-exec:
install-program:
install-man:
install-strip:
tags:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
	@set -e; \
	catalogs='$(CATALOGS)'; \
	losers=""; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  case "$$cat" in \
	    *.gmo) destdir=$(gnulocaledir);; \
	    *)     destdir=$(localedir);; \
	  esac; \
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
	  dir=$(install_prefix)$$destdir/$$lang/LC_MESSAGES; \
	  dest=$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
	  if test -r $$cat -o -r $$cat.m; then \
	    echo $(MKINSTALLDIRS) $$dir; \
	         $(MKINSTALLDIRS) $$dir; \
	  else \
	    losers="$$losers $$lang"; \
	  fi ; \
	  if test -r $$cat; then \
	    echo $(INSTALL_DATA) $$cat $$dest; \
		 $(INSTALL_DATA) $$cat $$dest; \
	  fi; \
	  if test -r $$cat.m; then \
	    echo $(INSTALL_DATA) $$cat.m $$dest.m; \
		 $(INSTALL_DATA) $$cat.m $$dest.m; \
	  fi; \
	done; \
	if [ "$$losers" != '' ]; then \
	  echo "Warning: these catalogs were not installed:" >&2 ; \
	  echo "	$$losers" >&2; \
	fi

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

uninstall:
	@catalogs='$(CATALOGS)'; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
	  suffix="$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
	  for f in $(install_prefix)$(localedir)/$$suffix \
		   $(install_prefix)$(localedir)/$$suffix.m \
		   $(install_prefix)$(gnulocaledir)/$$suffix \
		   $(install_prefix)$(gnulocaledir)/$$suffix.m; do \
	    if [ -f $$f ]; then \
	      echo rm -f $$f; \
	           rm -f $$f; \
	    fi; \
	  done; \
	done

uninstall-program:
uninstall-man:

check: all

dvi info tags TAGS ID:

mostlyclean:
	rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
	rm -fr *.o

clean: mostlyclean

distclean: clean
	rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m *.gmo *.pot
	rm -f stamp-it

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)

depend:
distdepend: generate_potfiles_in update-po $(DISTFILES)


# jwz: Generates po/POTFILES.in by examining the source tree:
# that way we don't have to keep this list up to date as files are added.
#
generate_potfiles_in:
	@tmp=po.$$$$ ;				\
	 file=POTFILES.in ;			\
	 echo "sleeping 3 seconds..." ;\
	 sleep 3; \
	 ( cd $(top_srcdir);			\
	   echo "# Auto-generated: `LANG=C date`" ;	\
	   ( grep -l '_("' driver/*.[ch] ;	\
	     ls driver/*.glade2.in			\
		driver/*.desktop.in		\
		hacks/config/*.xml ) | sort	\
	  ) > $$tmp &&				\
	 mv $$tmp $$file &&			\
	 echo "created `pwd`/$$file"

echo_tarfiles:
	@echo $(TARFILES)

distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
dist distdir: update-po $(DISTFILES)
	dists="$(DISTFILES)"; \
	for file in $$dists; do \
	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
	    || cp -p $(srcdir)/$$file $(distdir); \
	done

update-po: Makefile
	$(MAKE) $(GETTEXT_PACKAGE).pot
	@catalogs='$(CATALOGS)'; \
	INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
	export INTLTOOL_EXTRACT ; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
          if [ ! -f $$lang.po ] ; then \
             cp $(srcdir)/$$lang.po . ; \
          fi ; \
	  cp $$lang.po $$lang.old.po; \
	  echo $(MSGMERGE) $$lang; \
	  if   $(MSGMERGE) $$lang >/dev/null 2>&1; then \
	    rm -f $$lang.old.po; \
	  else \
	    echo "msgmerge for $$cat failed!"; \
	    rm -f $$lang.po; \
	    mv $$lang.old.po $$lang.po; \
	  fi; \
	done

.po: Makefile
	$(MAKE)  $(PACKAGE).pot;
	INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
	export INTLTOOL_EXTRACT ; \
	echo; printf "$*: "; \
	if $(MSGMERGE) $*; then \
	  rm -f $*.old.po; \
	  else \
	    echo "msgmerge for * failed!"; \
	    mv $*.old.po $*.po; \
	fi; \
	msgfmt --statistics $*.po; echo;


# 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
POTFILES: POTFILES.in
	( if test 'x$(srcdir)' != 'x.'; then \
	    posrcprefix='$(top_srcdir)/'; \
	  else \
	    posrcprefix="../"; \
	  fi; \
	  rm -f $@-t $@ \
	    && (sed -e '/^#/d' 						\
		    -e "s/^\[.*\] +//" 					\
		    -e '/^[ 	]*$$/d' 				\
		    -e "s@.*@	$$posrcprefix& \\\\@" < $@.in		\
		| sed -e '$$s/\\$$//') > $@-t \
	    && chmod a-w $@-t \
	    && mv $@-t $@ )

# jwz: depending on stamp-it breaks distclean.
Makefile:
	@if test ! -f $@; then \
		rm -f stamp-it; \
		$(MAKE) stamp-it; \
	fi

stamp-it: Makefile.in.in ../config.status POTFILES
	cd .. \
	  && CONFIG_FILES=$(subdir)/Makefile.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: