]>
Commit | Line | Data |
---|---|---|
7eda085c | 1 | PACKAGE = util-linux |
7eda085c KZ |
2 | |
3 | include ../make_include | |
eb63b9b8 | 4 | include ../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 | # | |
11 | PO2TBL = ./po2tbl.sed | |
12 | INTL = /usr/share/gettext/intl | |
13 | ||
14 | SHELL = /bin/sh | |
15 | ||
66ee8158 KZ |
16 | localedir = $(LOCALEDIR) |
17 | gnulocaledir = $(LOCALEDIR) | |
7eda085c KZ |
18 | |
19 | # Not giving an explicit path improves the chances of finding this | |
20 | INSTALL = install -c | |
21 | INSTALL_DATA = ${INSTALL} -m 644 | |
22 | ||
23 | # Not giving an explicit path improves the chances of finding these | |
24 | GENCAT = gencat | |
66ee8158 | 25 | MSGFMT = msgfmt -c # -c: undocumented, but useful option |
7eda085c KZ |
26 | XGETTEXT = xgettext |
27 | MSGMERGE = msgmerge | |
28 | ||
29 | ||
30 | # .. for <config.h> (if HAVE_CONFIG_H is set) | |
31 | # $(INTL) for "libgettext.h" | |
32 | INCLUDES = -I.. -I$(INTL) | |
33 | ||
34 | COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) | |
35 | ||
36 | # Enter here all .po files | |
66ee8158 | 37 | POFILES = 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 | 39 | GMOFILES = cs.gmo da.gmo de.gmo es.gmo fr.gmo it.gmo ja.gmo nl.gmo pt_BR.gmo |
7eda085c KZ |
40 | |
41 | CATALOGS = $(GMOFILES) | |
42 | CATOBJEXT = .gmo | |
43 | INSTOBJEXT = .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 | ||
61 | all: all-$(HAVE_XGETTEXT) | |
62 | ||
63 | all-yes: cat-id-tbl.c $(CATALOGS) | |
64 | all-no: | |
65 | ||
66 | util-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 | ||
72 | cat-id-tbl.c: stamp-cat-id | |
73 | stamp-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 | ||
86 | install: install-data-$(HAVE_XGETTEXT) | |
87 | install-data-no: all | |
88 | install-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 | ||
106 | uninstall: | |
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 | |
116 | cat-id-tbl.o: $(INTL)/libgettext.h | |
117 | ||
118 | clean: | |
119 | rm -f core core.* *~ *.o util-linux.pot cat-id-tbl.tmp | |
120 | ||
121 | distclean: clean | |
122 | rm -f POTFILES *.gmo *.mo *.msg *.cat *.cat.m | |
123 | ||
124 | update-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 | ||
140 | POTFILES: | |
141 | ./update-potfiles | |
142 |