From http://www.jwz.org/xscreensaver/xscreensaver-5.30.tar.gz
[xscreensaver] / po / Makefile.in.in
1 # Makefile for program source directory in GNU NLS utilities package.
2 # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3 #
4 # This file file be copied and used freely without restrictions.  It can
5 # be used in projects which are not available under the GNU Public License
6 # but which still want to provide support for the GNU gettext functionality.
7 # Please note that the actual code is *not* freely available.
8 #
9 # - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
10 #   instead of PACKAGE and to look for po2tbl in ./ not in intl/
11 #
12 # - Modified by jacob berkman <jacob@ximian.com> to install
13 #   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
14 #
15 # - Modified by jwz to not suck wet farts from dead pigeons.
16 #   This is truly one of the worst-written Makefiles I've ever seen.
17 #   Problems I (tried to) fix:
18 #
19 #     - MKINSTALLDIRS was $(top_srcdir)/@MKINSTALLDIRS@, but the
20 #       configure script already put $(top_srcdir) into @MKINSTALLDIRS@,
21 #       so the result was an absolute path that didn't work at all.
22 #
23 #     - GMSGFMT and XGETTEXT set $PATH to some random value before
24 #       running the program.  That's completely stupid, and anyway,
25 #       the hardcoded $PATH value they were using (../src) do not
26 #       apply to xscreensaver.
27 #
28 #     - the .po.gmo, .po.cat, .po.pox, .pot, install-data-yes, update-po, and
29 #       uninstall rules didn't actually print the commands they were
30 #       executing: they just dumped a bunch of sh code at you, and expected
31 #       you to figure it out yourself.  This is typical behavior of Makefile
32 #       rules written by morons.
33 #
34 #     - intltool-update prints a lot of useless crap to both stderr and
35 #       stdout and has no command-line argument meaning "be quiet, and only
36 #       print errors", so I just redirected the whole thing to /dev/null.
37 #
38 #     - Demonstrating a total misunderstanding of build-directories and
39 #       VPATH, the .po.gmo rule was writing output to $(srcdir).  When
40 #       the current directory is not $(srcdir), one *never* writes to
41 #       $(srcdir) -- it is to be considered read-only.
42 #
43 #     - Likewise, install-data-yes was looking for .gmo files in both the
44 #       current directory, and in $(srcdir).  In the case where those are
45 #       not the same directory, there must be no .gmo files in $(srcdir).
46 #
47 #     - The update-po rule was explicitly writing to $(srcdir).  I changed
48 #       it to just work in the current directory.  As I understand it, it
49 #       only makes sense to run this rule while in the srcdir, e.g., from
50 #       distdepend -- so it should be allowed to error out when run in an
51 #       inappropriate directory.
52 #
53 #     - install-data-yes went through great code-duplication-contortions
54 #       to cope with the file mentioned by MKINSTALLDIRS not actually
55 #       existing!  Instead of assuming that MKINSTALLDIRS will be set to
56 #       an actual, correct value, it had a hardcoded check to look for it
57 #       in $(top_srcdir) as well!  WTF!
58 #
59 #     - It turns out that "msgfmt" silently fails to write a .gmo file
60 #       if the source .po file is empty (or otherwise not yet written.)
61 #       The install-data-yes rule made no provision for this, and would
62 #       just error out when the .gmo files were not there.
63 #
64 #     - $(DESTDIR) was being used where $(install_prefix) should have been.
65 #
66 #     - For xscreensaver, $(prefix) is generally /usr/X11R6/, but some files
67 #       need to go under /usr/ instead of under /usr/X11R6/ -- for those, we
68 #       use @PO_DATADIR@ instead of @prefix@.  So I changed $(datadir) and
69 #       $(gnulocaledir) appropriately.
70 #
71 #     - WTF is $(gettextsrcdir) doing in here?
72 #
73 #     - added  "*.gmo *.pot" to "distclean".
74 #
75 #     - I added a rule to po/POTFILES.in so that I wouldn't have to maintain
76 #       that list of files in two places.
77 #   
78 #     - I removed the rule to auto-regenerate Makefile from Makefile.in.in
79 #       because it made my top-level "make distdepend" rule fail: things
80 #       were executing in the wrong order.
81 #
82 #     - the .po.cat rule has a hardcoded "../intl/po2msg.sed" in it.
83 #       Guess what, I don't have any such directory.  And that should be
84 #       refering to $(srcdir) anyway.  So I just commented (my half-fixed
85 #       version of) this rule out.
86 #
87
88 # config.status complains if "po/Makefile.in.in was not created by intltoolize".
89 # INTLTOOL_MAKEFILE
90
91 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
92 PACKAGE = @PACKAGE@
93 VERSION = @VERSION@
94
95 SHELL = /bin/sh
96 @SET_MAKE@
97
98 srcdir = @srcdir@
99 top_srcdir = @top_srcdir@
100 top_builddir = ..
101 VPATH = @srcdir@
102
103 prefix = @prefix@
104 exec_prefix = @exec_prefix@
105 #datadir = $(prefix)/@DATADIRNAME@      -- not for xscreensaver
106 datadir = @PO_DATADIR@
107 datarootdir = @datarootdir@
108 localedir = $(datadir)/locale
109 #localedir = $(prefix)/share/locale
110 #gnulocaledir = $(prefix)/share/locale  -- not for xscreensaver
111 gnulocaledir = $(localedir)
112 #gettextsrcdir = $(prefix)/share/glib-2.0/gettext/po
113 subdir = po
114 DESTDIR = $(install_prefix)
115
116 INSTALL = @INSTALL@
117 INSTALL_DATA = @INSTALL_DATA@
118
119 # #### NO.  This gets me "..//usr/bin/install: No such file or directory".
120 # The @MKINSTALLDIRS@ variable must have the absolute (or unqualified)
121 # path of the install program.  --jwz.
122 # MKINSTALLDIRS = $(top_builddir)/@MKINSTALLDIRS@
123
124 MKINSTALLDIRS = @MKINSTALLDIRS@
125
126 CC = @CC@
127 #GENCAT = @GENCAT@
128 GMSGFMT = @GMSGFMT@
129 MSGFMT = @MSGFMT@
130 XGETTEXT = @XGETTEXT@
131 INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
132 INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
133 MSGMERGE = $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
134 GENPOT   = $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
135
136 DEFS = @DEFS@
137 CFLAGS = @CFLAGS@
138 CPPFLAGS = @CPPFLAGS@
139
140 INCLUDES = -I.. -I$(top_srcdir)/intl
141
142 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
143
144 SOURCES = 
145 POFILES = @POFILES@
146 GMOFILES = @GMOFILES@
147 DISTFILES_1 = ChangeLog Makefile.in.in POTFILES.in update.sh
148 DISTFILES = $(DISTFILES_1) $(GETTEXT_PACKAGE).pot \
149             $(POFILES) $(GMOFILES) $(SOURCES)
150
151 TARFILES = $(DISTFILES_1) $(POFILES) $(SOURCES)
152
153 POTFILES = \
154 # This comment gets stripped out
155
156 CATALOGS = @CATALOGS@
157 CATOBJEXT = @CATOBJEXT@
158 INSTOBJEXT = @INSTOBJEXT@
159
160 .SUFFIXES:
161 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
162
163 .c.o:
164         $(COMPILE) $<
165
166 .po.pox:
167         $(MAKE) $(GETTEXT_PACKAGE).pot
168         INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
169         export INTLTOOL_EXTRACT ; \
170         echo $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox ; \
171              $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
172
173 .po.mo:
174         $(MSGFMT) -o $@ $<
175
176 # jwz: the "-" means "ignore any errors here, because I don't give a shit."
177 .po.gmo:
178         @-file=`echo $* | sed 's,.*/,,'`.gmo ; \
179          rm -f "$$file" ; \
180          echo $(GMSGFMT) -o "$$file" $< ; \
181               $(GMSGFMT) -o "$$file" $<
182
183 #.po.cat:
184 #       @echo "sed -f ../intl/po2msg.sed < $< > $*.msg" ; \
185 #              sed -f ../intl/po2msg.sed < $< > $*.msg && \
186 #        rm -f $@ && \
187 #        echo $(GENCAT) "$@" "$*.msg" ; \
188 #             $(GENCAT) "$@" "$*.msg"
189
190
191 all: all-@USE_NLS@
192 default: all
193
194 all-yes: $(CATALOGS)
195 all-no:
196
197 $(GETTEXT_PACKAGE).pot: $(POTFILES)
198         @INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
199         export INTLTOOL_EXTRACT ; \
200         echo top_srcdir=$(top_srcdir) $(GENPOT) ; \
201              top_srcdir=$(top_srcdir) $(GENPOT)
202
203 install-strip: install
204
205 install: install-exec install-data
206 install-exec:
207 install-program:
208 install-man:
209 install-strip:
210 tags:
211 install-data: install-data-@USE_NLS@
212 install-data-no: all
213 install-data-yes: all
214         @set -e; \
215         catalogs='$(CATALOGS)'; \
216         losers=""; \
217         for cat in $$catalogs; do \
218           cat=`basename $$cat`; \
219           case "$$cat" in \
220             *.gmo) destdir=$(gnulocaledir);; \
221             *)     destdir=$(localedir);; \
222           esac; \
223           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
224           dir=$(install_prefix)$$destdir/$$lang/LC_MESSAGES; \
225           dest=$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
226           if test -r $$cat -o -r $$cat.m; then \
227             echo $(MKINSTALLDIRS) $$dir; \
228                  $(MKINSTALLDIRS) $$dir; \
229           else \
230             losers="$$losers $$lang"; \
231           fi ; \
232           if test -r $$cat; then \
233             echo $(INSTALL_DATA) $$cat $$dest; \
234                  $(INSTALL_DATA) $$cat $$dest; \
235           fi; \
236           if test -r $$cat.m; then \
237             echo $(INSTALL_DATA) $$cat.m $$dest.m; \
238                  $(INSTALL_DATA) $$cat.m $$dest.m; \
239           fi; \
240         done; \
241         if [ "$$losers" != '' ]; then \
242           echo "Warning: these catalogs were not installed:" >&2 ; \
243           echo "        $$losers" >&2; \
244         fi
245
246 # Define this as empty until I found a useful application.
247 installcheck:
248
249 uninstall:
250         @catalogs='$(CATALOGS)'; \
251         for cat in $$catalogs; do \
252           cat=`basename $$cat`; \
253           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
254           suffix="$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
255           for f in $(install_prefix)$(localedir)/$$suffix \
256                    $(install_prefix)$(localedir)/$$suffix.m \
257                    $(install_prefix)$(gnulocaledir)/$$suffix \
258                    $(install_prefix)$(gnulocaledir)/$$suffix.m; do \
259             if [ -f $$f ]; then \
260               echo rm -f $$f; \
261                    rm -f $$f; \
262             fi; \
263           done; \
264         done
265
266 uninstall-program:
267 uninstall-man:
268
269 check: all
270
271 dvi info tags TAGS ID:
272
273 mostlyclean:
274         rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
275         rm -fr *.o
276
277 clean: mostlyclean
278
279 distclean: clean
280         rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m *.gmo *.pot
281         rm -f stamp-it
282
283 maintainer-clean: distclean
284         @echo "This command is intended for maintainers to use;"
285         @echo "it deletes files that may require special tools to rebuild."
286         rm -f $(GMOFILES)
287
288 depend:
289 distdepend: generate_potfiles_in update-po $(DISTFILES)
290
291
292 # jwz: Generates po/POTFILES.in by examining the source tree:
293 # that way we don't have to keep this list up to date as files are added.
294 #
295 generate_potfiles_in:
296         @tmp=po.$$$$ ;                          \
297          file=POTFILES.in ;                     \
298          echo "sleeping 3 seconds..." ;\
299          sleep 3; \
300          ( cd $(top_srcdir);                    \
301            echo "# Auto-generated: `LANG=C date`" ;     \
302            ( grep -l '_("' driver/*.[ch] ;      \
303              ls driver/*.glade2.in                      \
304                 driver/*.desktop.in             \
305                 hacks/config/*.xml ) | sort     \
306           ) > $$tmp &&                          \
307          mv $$tmp $$file &&                     \
308          echo "created `pwd`/$$file"
309
310 echo_tarfiles:
311         @echo $(TARFILES)
312
313 distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
314 dist distdir: update-po $(DISTFILES)
315         dists="$(DISTFILES)"; \
316         for file in $$dists; do \
317           ln $(srcdir)/$$file $(distdir) 2> /dev/null \
318             || cp -p $(srcdir)/$$file $(distdir); \
319         done
320
321 update-po: Makefile
322         $(MAKE) $(GETTEXT_PACKAGE).pot
323         @catalogs='$(CATALOGS)'; \
324         INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
325         export INTLTOOL_EXTRACT ; \
326         for cat in $$catalogs; do \
327           cat=`basename $$cat`; \
328           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
329           if [ ! -f $$lang.po ] ; then \
330              cp $(srcdir)/$$lang.po . ; \
331           fi ; \
332           cp $$lang.po $$lang.old.po; \
333           echo $(MSGMERGE) $$lang; \
334           if   $(MSGMERGE) $$lang >/dev/null 2>&1; then \
335             rm -f $$lang.old.po; \
336           else \
337             echo "msgmerge for $$cat failed!"; \
338             rm -f $$lang.po; \
339             mv $$lang.old.po $$lang.po; \
340           fi; \
341         done
342
343 .po: Makefile
344         $(MAKE)  $(PACKAGE).pot;
345         INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
346         export INTLTOOL_EXTRACT ; \
347         echo; printf "$*: "; \
348         if $(MSGMERGE) $*; then \
349           rm -f $*.old.po; \
350           else \
351             echo "msgmerge for * failed!"; \
352             mv $*.old.po $*.po; \
353         fi; \
354         msgfmt --statistics $*.po; echo;
355
356
357 # POTFILES is created from POTFILES.in by stripping comments, empty lines
358 # and Intltool tags (enclosed in square brackets), and appending a full
359 # relative path to them
360 POTFILES: POTFILES.in
361         ( if test 'x$(srcdir)' != 'x.'; then \
362             posrcprefix='$(top_srcdir)/'; \
363           else \
364             posrcprefix="../"; \
365           fi; \
366           rm -f $@-t $@ \
367             && (sed -e '/^#/d'                                          \
368                     -e "s/^\[.*\] +//"                                  \
369                     -e '/^[     ]*$$/d'                                 \
370                     -e "s@.*@   $$posrcprefix& \\\\@" < $@.in           \
371                 | sed -e '$$s/\\$$//') > $@-t \
372             && chmod a-w $@-t \
373             && mv $@-t $@ )
374
375 # jwz: depending on stamp-it breaks distclean.
376 Makefile:
377         @if test ! -f $@; then \
378                 rm -f stamp-it; \
379                 $(MAKE) stamp-it; \
380         fi
381
382 stamp-it: Makefile.in.in ../config.status POTFILES
383         cd .. \
384           && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= \
385                $(SHELL) ./config.status
386
387 # Tell versions [3.59,3.63) of GNU make not to export all variables.
388 # Otherwise a system limit (for SysV at least) may be exceeded.
389 .NOEXPORT: