summaryrefslogtreecommitdiff
path: root/po/Makefile
blob: d695b497f3750fb53a3812bf370fd26d8527cdfc (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
prefix = /usr

INSTALL= install

INSTALLNLSDIR=$(BASEDIR)$(prefix)/share/locale

PACKAGE = whois

CATALOGS = cs.mo da.mo de.mo el.mo es.mo eu.mo fi.mo fr.mo it.mo ja.mo nb.mo pl.mo pt_BR.mo ru.mo zh_CN.mo

POTFILES=../whois.c ../mkpasswd.c

all: $(PACKAGE).pot $(CATALOGS)

$(PACKAGE).pot: $(POTFILES)
	xgettext --default-domain=$(PACKAGE) \
       	  --add-comments --keyword=_ --keyword=N_ $(POTFILES)
	if cmp -s $(PACKAGE).po $(PACKAGE).pot; then \
	  rm -f $(PACKAGE).po; \
	else \
	  mv $(PACKAGE).po $(PACKAGE).pot; \
	fi

update-po: $(PACKAGE).pot
	for cat in $(CATALOGS); do \
	  lang=`echo $$cat | sed 's/.mo$$//'`; \
	  mv $$lang.po $$lang.old.po; \
	  echo "$$lang:"; \
	  if msgmerge $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
	    rm -f $$lang.old.po; \
	  else \
    	    echo "msgmerge for $$cat failed!"; \
	    rm -f $$lang.po; mv $$lang.old.po $$lang.po; \
	  fi; \
	done

%.mo: %.po
	msgfmt --statistics --check --verbose --output-file=$@ $<

clean:
	rm -f *.mo

distclean: clean
	rm -f whois.pot

install: $(CATALOGS)
	for n in $(CATALOGS); do \
	    l=`basename $$n .mo`; \
	    $(INSTALL) -m 755 -d $(INSTALLNLSDIR)/$$l; \
	    $(INSTALL) -m 755 -d $(INSTALLNLSDIR)/$$l/LC_MESSAGES; \
	    $(INSTALL) -m 644 $$n $(INSTALLNLSDIR)/$$l/LC_MESSAGES/$(PACKAGE).mo; \
	done