# Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper # # 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 to use GETTEXT_PACKAGE # instead of PACKAGE and to look for po2tbl in ./ not in intl/ # # - Modified by jacob berkman 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. # 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@ 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 = \ 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: $(srcdir)/$(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 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: # fuck off. love, jwz. #distdepend: generate_potfiles_in update-po $(DISTFILES) distdepend:: # 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 ; \ ( cd $(top_srcdir); \ echo "# Auto-generated: `LANG=C date`" ; \ ( grep -l '_("' driver/*.[ch] ; \ ls driver/*.glade2 \ 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& \\\\@" < $(srcdir)/$@.in \ | sed -e '$$s/\\$$//') > $@-t \ && chmod a-w $@-t \ && mv $@-t $@ ) # Please to be fucking the hell off. This breaks "make distdepend". -jwz #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: