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