bc121a9629510c017d3522522bb8c3749b41780b
[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 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
89 PACKAGE = @PACKAGE@
90 VERSION = @VERSION@
91
92 SHELL = /bin/sh
93 @SET_MAKE@
94
95 srcdir = @srcdir@
96 top_srcdir = @top_srcdir@
97 top_builddir = ..
98 VPATH = @srcdir@
99
100 prefix = @prefix@
101 exec_prefix = @exec_prefix@
102 #datadir = $(prefix)/@DATADIRNAME@      -- not for xscreensaver
103 datadir = @PO_DATADIR@
104 datarootdir = @datarootdir@
105 localedir = $(datadir)/locale
106 #localedir = $(prefix)/share/locale
107 #gnulocaledir = $(prefix)/share/locale  -- not for xscreensaver
108 gnulocaledir = $(localedir)
109 #gettextsrcdir = $(prefix)/share/glib-2.0/gettext/po
110 subdir = po
111 DESTDIR = $(install_prefix)
112
113 INSTALL = @INSTALL@
114 INSTALL_DATA = @INSTALL_DATA@
115
116 # #### NO.  This gets me "..//usr/bin/install: No such file or directory".
117 # The @MKINSTALLDIRS@ variable must have the absolute (or unqualified)
118 # path of the install program.  --jwz.
119 # MKINSTALLDIRS = $(top_builddir)/@MKINSTALLDIRS@
120
121 MKINSTALLDIRS = @MKINSTALLDIRS@
122
123 CC = @CC@
124 #GENCAT = @GENCAT@
125 GMSGFMT = @GMSGFMT@
126 MSGFMT = @MSGFMT@
127 XGETTEXT = @XGETTEXT@
128 INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
129 INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
130 MSGMERGE = $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
131 GENPOT   = $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
132
133 DEFS = @DEFS@
134 CFLAGS = @CFLAGS@
135 CPPFLAGS = @CPPFLAGS@
136
137 INCLUDES = -I.. -I$(top_srcdir)/intl
138
139 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
140
141 SOURCES = 
142 POFILES = @POFILES@
143 GMOFILES = @GMOFILES@
144 DISTFILES_1 = ChangeLog Makefile.in.in POTFILES.in update.sh
145 DISTFILES = $(DISTFILES_1) $(GETTEXT_PACKAGE).pot \
146             $(POFILES) $(GMOFILES) $(SOURCES)
147
148 TARFILES = $(DISTFILES_1) $(POFILES) $(SOURCES)
149
150 POTFILES = \
151
152 CATALOGS = @CATALOGS@
153 CATOBJEXT = @CATOBJEXT@
154 INSTOBJEXT = @INSTOBJEXT@
155
156 .SUFFIXES:
157 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
158
159 .c.o:
160         $(COMPILE) $<
161
162 .po.pox:
163         $(MAKE) $(GETTEXT_PACKAGE).pot
164         INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
165         export INTLTOOL_EXTRACT ; \
166         echo $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox ; \
167              $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
168
169 .po.mo:
170         $(MSGFMT) -o $@ $<
171
172 # jwz: the "-" means "ignore any errors here, because I don't give a shit."
173 .po.gmo:
174         @-file=`echo $* | sed 's,.*/,,'`.gmo ; \
175          rm -f "$$file" ; \
176          echo $(GMSGFMT) -o "$$file" $< ; \
177               $(GMSGFMT) -o "$$file" $<
178
179 #.po.cat:
180 #       @echo "sed -f ../intl/po2msg.sed < $< > $*.msg" ; \
181 #              sed -f ../intl/po2msg.sed < $< > $*.msg && \
182 #        rm -f $@ && \
183 #        echo $(GENCAT) "$@" "$*.msg" ; \
184 #             $(GENCAT) "$@" "$*.msg"
185
186
187 all: all-@USE_NLS@
188 default: all
189
190 all-yes: $(CATALOGS)
191 all-no:
192
193 $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
194         @INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
195         export INTLTOOL_EXTRACT ; \
196         echo top_srcdir=$(top_srcdir) $(GENPOT) ; \
197              top_srcdir=$(top_srcdir) $(GENPOT)
198
199 install-strip: install
200
201 install: install-exec install-data
202 install-exec:
203 install-program:
204 install-man:
205 install-strip:
206 tags:
207 install-data: install-data-@USE_NLS@
208 install-data-no: all
209 install-data-yes: all
210         @set -e; \
211         catalogs='$(CATALOGS)'; \
212         losers=""; \
213         for cat in $$catalogs; do \
214           cat=`basename $$cat`; \
215           case "$$cat" in \
216             *.gmo) destdir=$(gnulocaledir);; \
217             *)     destdir=$(localedir);; \
218           esac; \
219           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
220           dir=$(install_prefix)$$destdir/$$lang/LC_MESSAGES; \
221           dest=$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
222           if test -r $$cat -o -r $$cat.m; then \
223             echo $(MKINSTALLDIRS) $$dir; \
224                  $(MKINSTALLDIRS) $$dir; \
225           else \
226             losers="$$losers $$lang"; \
227           fi ; \
228           if test -r $$cat; then \
229             echo $(INSTALL_DATA) $$cat $$dest; \
230                  $(INSTALL_DATA) $$cat $$dest; \
231           fi; \
232           if test -r $$cat.m; then \
233             echo $(INSTALL_DATA) $$cat.m $$dest.m; \
234                  $(INSTALL_DATA) $$cat.m $$dest.m; \
235           fi; \
236         done; \
237         if [ "$$losers" != '' ]; then \
238           echo "Warning: these catalogs were not installed:" >&2 ; \
239           echo "        $$losers" >&2; \
240         fi
241
242 # Define this as empty until I found a useful application.
243 installcheck:
244
245 uninstall:
246         @catalogs='$(CATALOGS)'; \
247         for cat in $$catalogs; do \
248           cat=`basename $$cat`; \
249           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
250           suffix="$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
251           for f in $(install_prefix)$(localedir)/$$suffix \
252                    $(install_prefix)$(localedir)/$$suffix.m \
253                    $(install_prefix)$(gnulocaledir)/$$suffix \
254                    $(install_prefix)$(gnulocaledir)/$$suffix.m; do \
255             if [ -f $$f ]; then \
256               echo rm -f $$f; \
257                    rm -f $$f; \
258             fi; \
259           done; \
260         done
261
262 uninstall-program:
263 uninstall-man:
264
265 check: all
266
267 dvi info tags TAGS ID:
268
269 mostlyclean:
270         rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
271         rm -fr *.o
272
273 clean: mostlyclean
274
275 distclean: clean
276         rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m *.gmo *.pot
277
278 maintainer-clean: distclean
279         @echo "This command is intended for maintainers to use;"
280         @echo "it deletes files that may require special tools to rebuild."
281         rm -f $(GMOFILES)
282
283 depend:
284 # fuck off.  love, jwz.
285 #distdepend: generate_potfiles_in update-po $(DISTFILES)
286 distdepend::
287
288
289 # jwz: Generates po/POTFILES.in by examining the source tree:
290 # that way we don't have to keep this list up to date as files are added.
291 #
292 generate_potfiles_in:
293         @tmp=po.$$$$ ;                          \
294          file=POTFILES.in ;                     \
295          ( cd $(top_srcdir);                    \
296            echo "# Auto-generated: `LANG=C date`" ;     \
297            ( grep -l '_("' driver/*.[ch] ;      \
298              ls driver/*.glade2                 \
299                 driver/*.desktop.in             \
300                 hacks/config/*.xml ) | sort     \
301           ) > $$tmp &&                          \
302          mv $$tmp $$file &&                     \
303          echo "created `pwd`/$$file"
304
305 echo_tarfiles:
306         @echo $(TARFILES)
307
308 distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
309 dist distdir: update-po $(DISTFILES)
310         dists="$(DISTFILES)"; \
311         for file in $$dists; do \
312           ln $(srcdir)/$$file $(distdir) 2> /dev/null \
313             || cp -p $(srcdir)/$$file $(distdir); \
314         done
315
316 update-po: Makefile
317         $(MAKE) $(GETTEXT_PACKAGE).pot
318         @catalogs='$(CATALOGS)'; \
319         INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
320         export INTLTOOL_EXTRACT ; \
321         for cat in $$catalogs; do \
322           cat=`basename $$cat`; \
323           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
324           if [ ! -f $$lang.po ] ; then \
325              cp $(srcdir)/$$lang.po . ; \
326           fi ; \
327           cp $$lang.po $$lang.old.po; \
328           echo $(MSGMERGE) $$lang; \
329           if   $(MSGMERGE) $$lang >/dev/null 2>&1; then \
330             rm -f $$lang.old.po; \
331           else \
332             echo "msgmerge for $$cat failed!"; \
333             rm -f $$lang.po; \
334             mv $$lang.old.po $$lang.po; \
335           fi; \
336         done
337
338 .po: Makefile
339         $(MAKE)  $(PACKAGE).pot;
340         INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) ; \
341         export INTLTOOL_EXTRACT ; \
342         echo; printf "$*: "; \
343         if $(MSGMERGE) $*; then \
344           rm -f $*.old.po; \
345           else \
346             echo "msgmerge for * failed!"; \
347             mv $*.old.po $*.po; \
348         fi; \
349         msgfmt --statistics $*.po; echo;
350
351
352 # POTFILES is created from POTFILES.in by stripping comments, empty lines
353 # and Intltool tags (enclosed in square brackets), and appending a full
354 # relative path to them
355 POTFILES: POTFILES.in
356         ( if test 'x$(srcdir)' != 'x.'; then \
357             posrcprefix='$(top_srcdir)/'; \
358           else \
359             posrcprefix="../"; \
360           fi; \
361           rm -f $@-t $@ \
362             && (sed -e '/^#/d'                                          \
363                     -e "s/^\[.*\] +//"                                  \
364                     -e '/^[     ]*$$/d'                                 \
365                     -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
366                 | sed -e '$$s/\\$$//') > $@-t \
367             && chmod a-w $@-t \
368             && mv $@-t $@ )
369
370 # Please to be fucking the hell off.   This breaks "make distdepend". -jwz
371 #Makefile: Makefile.in.in ../config.status POTFILES
372 #       cd .. \
373 #         && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
374 #              $(SHELL) ./config.status
375
376 # Tell versions [3.59,3.63) of GNU make not to export all variables.
377 # Otherwise a system limit (for SysV at least) may be exceeded.
378 .NOEXPORT: