aboutsummaryrefslogtreecommitdiffstats
path: root/po/Makefile
blob: dedfc49436c95f9065d7aa8f0524e20bec6dd596 (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
# Basic Makefile for compiling & installing the translation files.
#
# Supports standard GNU Makefile variables for specifying the paths:
# * prefix
# * sbindir
# * libdir
# * 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
libdir      = $(prefix)/lib
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 \
	..$(libdir)/systemd/fedora-* \
	..$(sysconfdir)/rc.d/init.d/*\


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

$(NLSPACKAGE).pot: $(POTFILES)
	./xgettext_sh.py $(POTFILES) > $(NLSPACKAGE).po
	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