aboutsummaryrefslogtreecommitdiffstats
path: root/po/Makefile
blob: 02a58b08bd6dd7fa886fc0e5e78269cf8f25ab93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Basic Makefile for compiling & installing the translation files.
#
# Supports standard GNU Makefile variables for specifying the paths:
# * prefix
# * sbindir
# * libexecdir
# * datarootdir
# * datadir
# * sysconfdir
# * DESTDIR
#

SHELL       = /bin/bash

# Normally /usr/local is used. However, it does not make sense for us to use it
# here, as it just complicates things even further.
prefix      = /usr
sbindir     = $(prefix)/sbin
libexecdir  = $(prefix)/libexec
datarootdir = $(prefix)/share
datadir     = $(datarootdir)
sysconfdir  = /etc

NLSDIR      = $(datadir)/locale
NLSPACKAGE  = initscripts

CATALOGS    = $(shell ls *.po)
FMTCATALOGS = $(patsubst %.po,%.mo,$(CATALOGS))

POTFILES    = $(shell ls ../network-scripts/* | grep -v ifcfg-) \
	..$(sbindir)/service \
	..$(libexecdir)/import-state \
	..$(libexecdir)/loadmodules \
	..$(libexecdir)/readonly-root \
	..$(sysconfdir)/rc.d/init.d/*\


all: $(NLSPACKAGE).pot $(FMTCATALOGS)

$(NLSPACKAGE).pot: $(POTFILES)
	if [ -z "$(PYTHON)" ]; then \
		./xgettext_sh.py $(POTFILES) > $(NLSPACKAGE).po; \
	else \
		$(PYTHON) xgettext_sh.py $(POTFILES) > $(NLSPACKAGE).po; \
	fi
	if cmp -s $(NLSPACKAGE).po $(NLSPACKAGE).pot; then \
	    rm -f $(NLSPACKAGE).po; \
	else \
	    mv $(NLSPACKAGE).po $(NLSPACKAGE).pot; \
	fi

%.mo: %.po
	msgfmt -o $@ $<

install: all
	install -m 0755 -d $(DESTDIR)/$(NLSDIR)
	for file in $(CATALOGS); do \
	    lang=`basename $$file .po`; \
	    mo_file=$$lang.mo; \
	    install -m 0755 -d $(DESTDIR)$(NLSDIR)/$$lang; \
	    install -m 0755 -d $(DESTDIR)$(NLSDIR)/$$lang/LC_MESSAGES; \
	    install -m 0644 $$mo_file $(DESTDIR)/$(NLSDIR)/$$lang/LC_MESSAGES/$(NLSPACKAGE).mo; \
	done

clean:
	rm -f *.mo *.pyc