Home | History | Annotate | Download | only in po
      1 # Makefile for program source directory in GNU NLS utilities package.
      2 # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper (a] gnu.ai.mit.edu>
      3 # Copyright (C) 2003-2014 Free Software Foundation, Inc.
      4 #
      5 # This file may be copied and used freely without restrictions.  It can
      6 # be used in projects which are not available under the GNU Public License
      7 # but which still want to provide support for the GNU gettext functionality.
      8 # Please note that the actual code is *not* freely available.
      9 
     10 PACKAGE = @PACKAGE@
     11 VERSION = @VERSION@
     12 
     13 SHELL = /bin/sh
     14 @SET_MAKE@
     15 
     16 srcdir = @srcdir@
     17 top_srcdir = @top_srcdir@
     18 VPATH = @srcdir@
     19 top_builddir = @top_builddir@
     20 
     21 prefix = @prefix@
     22 exec_prefix = @exec_prefix@
     23 datadir = $(prefix)/@DATADIRNAME@
     24 localedir = $(datadir)/locale
     25 gnulocaledir = $(prefix)/share/locale
     26 gettextsrcdir = $(prefix)/share/gettext/po
     27 subdir = po
     28 
     29 DESTDIR =
     30 
     31 INSTALL = @INSTALL@
     32 INSTALL_DATA = @INSTALL_DATA@
     33 MKINSTALLDIRS = @MKINSTALLDIRS@
     34 
     35 CC = @CC@
     36 GENCAT = @GENCAT@
     37 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
     38 MSGFMT = @MSGFMT@
     39 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
     40 MSGMERGE = PATH=../src:$$PATH msgmerge
     41 
     42 DEFS = @DEFS@
     43 CFLAGS = @CFLAGS@
     44 CPPFLAGS = @CPPFLAGS@
     45 
     46 INCLUDES = -I.. -I$(top_srcdir)/intl
     47 
     48 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
     49 
     50 SOURCES = cat-id-tbl.c
     51 POFILES = @POFILES@
     52 GMOFILES = @GMOFILES@
     53 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
     54 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
     55 
     56 POTFILES = \
     57 
     58 CATALOGS = @CATALOGS@
     59 CATOBJEXT = @CATOBJEXT@
     60 INSTOBJEXT = @INSTOBJEXT@
     61 
     62 .SUFFIXES:
     63 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
     64 
     65 .c.o:
     66 	$(COMPILE) $<
     67 
     68 .po.pox:
     69 	$(MAKE) $(PACKAGE).pot
     70 	$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
     71 
     72 .po.mo:
     73 	$(MSGFMT) -o $@ $<
     74 
     75 .po.gmo:
     76 	file=`echo $* | sed 's,.*/,,'`.gmo \
     77 	  && rm -f $$file && $(GMSGFMT) -o $$file $<
     78 
     79 .po.cat:
     80 	sed -f ../intl/po2msg.sed < $< > $*.msg \
     81 	  && rm -f $@ && $(GENCAT) $@ $*.msg
     82 
     83 
     84 all: all-@USE_NLS@
     85 
     86 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
     87 all-no:
     88 
     89 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
     90 	$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
     91 	  --add-comments -C --keyword=_ --keyword=N_ \
     92 	  --msgid-bugs-address=bug-binutils (a] gnu.org \
     93 	  --files-from=$(srcdir)/POTFILES.in
     94 	rm -f $(srcdir)/$(PACKAGE).pot
     95 	mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
     96 
     97 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
     98 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
     99 	rm -f cat-id-tbl.tmp
    100 	sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
    101 		| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
    102 	if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
    103 	  rm cat-id-tbl.tmp; \
    104 	else \
    105 	  echo cat-id-tbl.c changed; \
    106 	  rm -f $(srcdir)/cat-id-tbl.c; \
    107 	  mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
    108 	fi
    109 	cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
    110 
    111 
    112 install: install-exec install-data
    113 install-exec:
    114 install-info:
    115 install-html:
    116 install-pdf:
    117 install-data: install-data-@USE_NLS@
    118 install-data-no: all
    119 install-data-yes: all
    120 	if test -r $(MKINSTALLDIRS); then \
    121 	  $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
    122 	else \
    123 	  $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
    124 	fi
    125 	@catalogs='$(CATALOGS)'; \
    126 	for cat in $$catalogs; do \
    127 	  cat=`basename $$cat`; \
    128 	  case "$$cat" in \
    129 	    *.gmo) destdir=$(gnulocaledir);; \
    130 	    *)     destdir=$(localedir);; \
    131 	  esac; \
    132 	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
    133 	  dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
    134 	  if test -r $(MKINSTALLDIRS); then \
    135 	    $(MKINSTALLDIRS) $$dir; \
    136 	  else \
    137 	    $(top_srcdir)/mkinstalldirs $$dir; \
    138 	  fi; \
    139 	  if test -r $$cat; then \
    140 	    $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
    141 	    echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
    142 	  else \
    143 	    $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
    144 	    echo "installing $(srcdir)/$$cat as" \
    145 		 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
    146 	  fi; \
    147 	  if test -r $$cat.m; then \
    148 	    $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
    149 	    echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
    150 	  else \
    151 	    if test -r $(srcdir)/$$cat.m ; then \
    152 	      $(INSTALL_DATA) $(srcdir)/$$cat.m \
    153 		$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
    154 	      echo "installing $(srcdir)/$$cat as" \
    155 		   "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
    156 	    else \
    157 	      true; \
    158 	    fi; \
    159 	  fi; \
    160 	done
    161 	if test "$(PACKAGE)" = "gettext"; then \
    162 	  if test -r $(MKINSTALLDIRS); then \
    163 	    $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
    164 	  else \
    165 	    $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
    166 	  fi; \
    167 	  $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
    168 			  $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
    169 	else \
    170 	  : ; \
    171 	fi
    172 
    173 # Define this as empty until I found a useful application.
    174 installcheck:
    175 
    176 uninstall:
    177 	catalogs='$(CATALOGS)'; \
    178 	for cat in $$catalogs; do \
    179 	  cat=`basename $$cat`; \
    180 	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
    181 	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
    182 	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
    183 	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
    184 	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
    185 	done
    186 	rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
    187 
    188 check: all
    189 
    190 cat-id-tbl.o: ../intl/libgettext.h
    191 
    192 html dvi pdf ps info tags TAGS ID:
    193 
    194 mostlyclean:
    195 	rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
    196 	rm -fr *.o
    197 
    198 clean: mostlyclean
    199 
    200 distclean: clean
    201 	rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
    202 
    203 maintainer-clean: distclean
    204 	@echo "This command is intended for maintainers to use;"
    205 	@echo "it deletes files that may require special tools to rebuild."
    206 	rm -f $(GMOFILES)
    207 
    208 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
    209 dist distdir: update-po $(DISTFILES)
    210 	dists="$(DISTFILES)"; \
    211 	for file in $$dists; do \
    212 	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
    213 	    || cp -p $(srcdir)/$$file $(distdir); \
    214 	done
    215 
    216 update-po: Makefile
    217 	$(MAKE) $(PACKAGE).pot
    218 	PATH=`pwd`/../src:$$PATH; \
    219 	cd $(srcdir); \
    220 	catalogs='$(CATALOGS)'; \
    221 	for cat in $$catalogs; do \
    222 	  cat=`basename $$cat`; \
    223 	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
    224 	  mv $$lang.po $$lang.old.po; \
    225 	  echo "$$lang:"; \
    226 	  if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
    227 	    rm -f $$lang.old.po; \
    228 	  else \
    229 	    echo "msgmerge for $$cat failed!"; \
    230 	    rm -f $$lang.po; \
    231 	    mv $$lang.old.po $$lang.po; \
    232 	  fi; \
    233 	done
    234 
    235 POTFILES: POTFILES.in
    236 	( if test 'x$(srcdir)' != 'x.'; then \
    237 	    posrcprefix='$(top_srcdir)/'; \
    238 	  else \
    239 	    posrcprefix="../"; \
    240 	  fi; \
    241 	  rm -f $@-t $@ \
    242 	    && (sed -e '/^#/d' -e '/^[ 	]*$$/d' \
    243 		    -e "s@.*@	$$posrcprefix& \\\\@" < $(srcdir)/$@.in \
    244 		| sed -e '$$s/\\$$//') > $@-t \
    245 	    && chmod a-w $@-t \
    246 	    && mv $@-t $@ )
    247 
    248 POTFILES.in: @MAINT@ ../Makefile
    249 	cd .. && $(MAKE) po/POTFILES.in
    250 
    251 Makefile: Make-in ../config.status POTFILES
    252 	cd .. \
    253 	  && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
    254 	     CONFIG_HEADERS= $(SHELL) ./config.status
    255 
    256 # Tell versions [3.59,3.63) of GNU make not to export all variables.
    257 # Otherwise a system limit (for SysV at least) may be exceeded.
    258 .NOEXPORT:
    259