]> git.ipfire.org Git - thirdparty/util-linux.git/blame - po/Makefile
Imported from util-linux-2.10s tarball.
[thirdparty/util-linux.git] / po / Makefile
CommitLineData
7eda085c 1PACKAGE = util-linux
7eda085c
KZ
2
3include ../make_include
eb63b9b8 4include ../MCONFIG
7eda085c
KZ
5
6#
7# po2tbl.sed is not taken from /usr/share/gettext/intl
8# Often it is not present.
9# A RedHat 5.2 installation only has po2tbl.sed.in.
10#
11PO2TBL = ./po2tbl.sed
12INTL = /usr/share/gettext/intl
13
14SHELL = /bin/sh
15
66ee8158
KZ
16localedir = $(LOCALEDIR)
17gnulocaledir = $(LOCALEDIR)
7eda085c
KZ
18
19# Not giving an explicit path improves the chances of finding this
20INSTALL = install -c
21INSTALL_DATA = ${INSTALL} -m 644
22
23# Not giving an explicit path improves the chances of finding these
24GENCAT = gencat
66ee8158 25MSGFMT = msgfmt -c # -c: undocumented, but useful option
7eda085c
KZ
26XGETTEXT = xgettext
27MSGMERGE = msgmerge
28
29
30# .. for <config.h> (if HAVE_CONFIG_H is set)
31# $(INTL) for "libgettext.h"
32INCLUDES = -I.. -I$(INTL)
33
34COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
35
36# Enter here all .po files
66ee8158 37POFILES = cs.po da.po de.po es.po fr.po it.po ja.po nl.po pt_BR.po
7eda085c 38# the same but with .gmo
66ee8158 39GMOFILES = cs.gmo da.gmo de.gmo es.gmo fr.gmo it.gmo ja.gmo nl.gmo pt_BR.gmo
7eda085c
KZ
40
41CATALOGS = $(GMOFILES)
42CATOBJEXT = .gmo
43INSTOBJEXT = .mo
44
45.SUFFIXES:
46.SUFFIXES: .c .o .po .gmo .mo .msg .cat
47
48.c.o:
49 $(COMPILE) $<
50
51.po.mo:
52 $(MSGFMT) -o $@ $<
53
54.po.gmo:
55 $(MSGFMT) -o $@ $<
56
57.po.cat:
58 sed -f $(PO2TBL) < $< > $*.msg \
59 && rm -f $@ && $(GENCAT) $@ $*.msg
60
61all: all-$(HAVE_XGETTEXT)
62
63all-yes: cat-id-tbl.c $(CATALOGS)
64all-no:
65
66util-linux.pot:
67 $(XGETTEXT) --default-domain=util-linux --directory=.. \
68 --add-comments --keyword=_ --keyword=N_ \
69 --files-from=POTFILES.in $(FOREIGN)
70 mv util-linux.po util-linux.pot
71
72cat-id-tbl.c: stamp-cat-id
73stamp-cat-id: util-linux.pot
74 rm -f cat-id-tbl.tmp
75 sed -f $(PO2TBL) util-linux.pot \
76 | sed -e "s/@PACKAGE NAME@/util-linux/" > cat-id-tbl.tmp
77 if cmp -s cat-id-tbl.tmp cat-id-tbl.c; then \
78 rm cat-id-tbl.tmp; \
79 else \
80 echo cat-id-tbl.c changed; \
81 rm -f cat-id-tbl.c; \
82 mv cat-id-tbl.tmp cat-id-tbl.c; \
83 fi
84 rm -f stamp-cat-id && echo timestamp > stamp-cat-id
85
86install: install-data-$(HAVE_XGETTEXT)
87install-data-no: all
88install-data-yes: all
7eda085c
KZ
89 @catalogs='$(CATALOGS)'; \
90 for cat in $$catalogs; do \
91 case "$$cat" in \
92 *.gmo) destdir=$(gnulocaledir);; \
93 *) destdir=$(localedir);; \
94 esac; \
95 lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
96 dir=$$destdir/$$lang/LC_MESSAGES; \
97 ../mkinstalldirs $$dir; \
98 $(INSTALL_DATA) $$cat $$dir/util-linux$(INSTOBJEXT); \
99 echo "installing $$cat as $$dir/util-linux$(INSTOBJEXT)"; \
100 if test -r $$cat.m; then \
101 $(INSTALL_DATA) $$cat.m $$dir/util-linux$(INSTOBJEXT).m; \
102 echo "installing $$cat.m as $$dir/util-linux$(INSTOBJEXT).m"; \
103 fi; \
104 done
105
106uninstall:
107 catalogs='$(CATALOGS)'; \
108 for cat in $$catalogs; do \
109 lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
110 rm -f $(localedir)/$$lang/LC_MESSAGES/util-linux$(INSTOBJEXT); \
111 rm -f $(localedir)/$$lang/LC_MESSAGES/util-linux$(INSTOBJEXT).m; \
112 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/util-linux$(INSTOBJEXT); \
113 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/util-linux$(INSTOBJEXT).m; \
114 done
7eda085c
KZ
115
116cat-id-tbl.o: $(INTL)/libgettext.h
117
118clean:
119 rm -f core core.* *~ *.o util-linux.pot cat-id-tbl.tmp
120
121distclean: clean
122 rm -f POTFILES *.gmo *.mo *.msg *.cat *.cat.m
123
124update-po:
125 $(MAKE) util-linux.pot
126 catalogs='$(CATALOGS)'; \
127 for cat in $$catalogs; do \
128 lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
129 mv $$lang.po $$lang.old.po; \
130 echo "$$lang:"; \
131 if $(MSGMERGE) $$lang.old.po util-linux.pot -o $$lang.po; then \
132 rm -f $$lang.old.po; \
133 else \
134 echo "msgmerge for $$cat failed!"; \
135 rm -f $$lang.po; \
136 mv $$lang.old.po $$lang.po; \
137 fi; \
138 done
139
140POTFILES:
141 ./update-potfiles
142