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
9PACKAGE = policycoreutils
10VERSION = 1.1
11
12SHELL = /bin/sh
13
14
15srcdir = .
16top_srcdir = ..
17
18
19prefix = /usr
20exec_prefix = ${prefix}
21datadir = $(prefix)/share
22localedir = $(datadir)/locale
23gnulocaledir = $(prefix)/share/locale
24gettextsrcdir = $(prefix)/share/gettext/po
25subdir = po
26
27INSTALL = /usr/bin/install -c
28INSTALL_DATA = ${INSTALL} -m 644
29MKINSTALLDIRS = mkdir -p
30
31CC = gcc
32GENCAT =
33GMSGFMT = PATH=../src:$$PATH /usr/bin/msgfmt
34MSGFMT = /usr/bin/msgfmt
35XGETTEXT = PATH=../src:$$PATH /usr/bin/xgettext
36MSGMERGE = PATH=../src:$$PATH msgmerge
37
38DEFS = -DHAVE_CONFIG_H
39CFLAGS = -g -O2
40CPPFLAGS =
41
42INCLUDES = -I.. -I$(top_srcdir)/intl
43
44COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
45
46POFILES =  da.po de.po es.po et.po fr.po gl.po id.po it.po ko.po nl.po pl.po pt_BR.po ru.po sv.po
47GMOFILES =  da.gmo de.gmo es.gmo et.gmo fr.gmo gl.gmo id.gmo it.gmo ko.gmo nl.gmo pl.gmo pt_BR.gmo ru.gmo sv.gmo
48DISTFILES = Makefile.in.in POTFILES.in $(PACKAGE).pot \
49$(POFILES) $(GMOFILES) $(SOURCES)
50
51POTFILES = \
52
53CATALOGS =  #da.gmo de.gmo es.gmo et.gmo fr.gmo gl.gmo id.gmo it.gmo ko.gmo nl.gmo pl.gmo pt_BR.gmo ru.gmo sv.gmo
54CATOBJEXT = .gmo
55INSTOBJEXT = .mo
56
57.SUFFIXES:
58.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
59
60.c.o:
61	$(COMPILE) $<
62
63.po.pox:
64	$(MAKE) $(PACKAGE).pot
65	$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
66
67.po.mo:
68	$(MSGFMT) -o $@ $<
69
70.po.gmo:
71	file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
72	  && rm -f $$file && $(GMSGFMT) -o $$file $<
73
74.po.cat:
75	sed -f ../intl/po2msg.sed < $< > $*.msg \
76	  && rm -f $@ && $(GENCAT) $@ $*.msg
77
78
79all: all-yes
80
81all-yes: $(CATALOGS)
82all-no:
83
84$(srcdir)/$(PACKAGE).pot: $(POTFILES)
85	$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
86	  --add-comments --keyword=_ --keyword=N_ \
87	  --files-from=$(srcdir)/POTFILES.in \
88	&& test ! -f $(PACKAGE).po \
89	   || ( rm -f $(srcdir)/$(PACKAGE).pot \
90		&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
91
92install: install-exec install-data
93install-exec:
94install-data: install-data-yes
95install-data-no: all
96install-data-yes: all
97	$(MKINSTALLDIRS) $(DESTDIR)$(datadir);
98	for cat in $(CATALOGS); do \
99	  cat=`basename $$cat`; \
100	  case "$$cat" in \
101	    *.gmo) destdir=$(DESTDIR)$(gnulocaledir);; \
102	    *)     destdir=$(DESTDIR)$(localedir);; \
103	  esac; \
104	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
105	  dir=$$destdir/$$lang/LC_MESSAGES; \
106	  echo $dir \
107	  $(MKINSTALLDIRS) $$dir; \
108	  if test -r $$cat; then \
109	    $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
110	    echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
111	  else \
112	    $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
113	    echo "installing $(srcdir)/$$cat as" \
114		 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
115	  fi; \
116	  if test -r $$cat.m; then \
117	    $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
118	    echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
119	  else \
120	    if test -r $(srcdir)/$$cat.m ; then \
121	      $(INSTALL_DATA) $(srcdir)/$$cat.m \
122		$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
123	      echo "installing $(srcdir)/$$cat as" \
124		   "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
125	    else \
126	      true; \
127	    fi; \
128	  fi; \
129	done
130	if test "$(PACKAGE)" = "gettext"; then \
131	  $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
132	  $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
133			  $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
134	else \
135	  : ; \
136	fi
137
138# Define this as empty until I found a useful application.
139installcheck:
140
141uninstall:
142	catalogs='$(CATALOGS)'; \
143	for cat in $$catalogs; do \
144	  cat=`basename $$cat`; \
145	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
146	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
147	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
148	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
149	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
150	done
151
152check: all
153
154dvi info tags TAGS ID:
155
156mostlyclean:
157	rm -f core core.* *.pox $(PACKAGE).po *.old.po
158	rm -fr *.o
159
160clean: mostlyclean
161	rm -f *.gmo
162
163distclean: clean
164	rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
165
166maintainer-clean: distclean
167	@echo "This command is intended for maintainers to use;"
168	@echo "it deletes files that may require special tools to rebuild."
169	rm -f $(GMOFILES)
170
171distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
172dist distdir: update-po $(DISTFILES)
173	dists="$(DISTFILES)"; \
174	for file in $$dists; do \
175	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
176	    || cp -p $(srcdir)/$$file $(distdir); \
177	done
178
179update-po: Makefile
180	$(MAKE) $(PACKAGE).pot
181	PATH=`pwd`/../src:$$PATH; \
182	cd $(srcdir); \
183	catalogs='$(CATALOGS)'; \
184	for cat in $$catalogs; do \
185	  cat=`basename $$cat`; \
186	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
187	  mv $$lang.po $$lang.old.po; \
188	  echo "$$lang:"; \
189	  if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
190	    rm -f $$lang.old.po; \
191	  else \
192	    echo "msgmerge for $$cat failed!"; \
193	    rm -f $$lang.po; \
194	    mv $$lang.old.po $$lang.po; \
195	  fi; \
196	done
197
198POTFILES: POTFILES.in
199	( if test 'x$(srcdir)' != 'x.'; then \
200	    posrcprefix='$(top_srcdir)/'; \
201	  else \
202	    posrcprefix="../"; \
203	  fi; \
204	  rm -f $@-t $@ \
205	    && (sed -e '/^#/d' -e '/^[ 	]*$$/d' \
206		    -e "s@.*@	$$posrcprefix& \\\\@" < $(srcdir)/$@.in \
207		| sed -e '$$s/\\$$//') > $@-t \
208	    && chmod a-w $@-t \
209	    && mv $@-t $@ )
210
211Makefile: Makefile.in.in ../config.status POTFILES
212	cd .. \
213	  && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
214	       $(SHELL) ./config.status
215
216# Tell versions [3.59,3.63) of GNU make not to export all variables.
217# Otherwise a system limit (for SysV at least) may be exceeded.
218.NOEXPORT:
219