Makefile 1.58 KB
Newer Older
1
2
3
# See LICENSE file for license and copyright information

PROJECT = zathura
4
GETTEXT_PACKAGE = $(PROJECT)
Sebastian Ramacher's avatar
Sebastian Ramacher committed
5
6
CATALOGS  = $(wildcard *.po)
LINGUAS  ?= $(patsubst %.po, %, $(CATALOGS))
7
8
9
ALINGUAS   = $(shell find $(patsubst %, %.po, $(LINGUAS)) 2>/dev/null)
MOS = $(patsubst %, %/LC_MESSAGES/${GETTEXT_PACKAGE}.mo, $(patsubst %.po, %, $(ALINGUAS)))

10
11
12
13
14
15
16

include ../config.mk
include ../common.mk

all: ${MOS}

clean:
Sebastian Ramacher's avatar
Sebastian Ramacher committed
17
	$(QUIET)rm -rf POTFILES.in POTFILES.in.tmp $(patsubst %.po, %, $(CATALOGS)) ${PROJECT}.pot
18
19
20
21
22
23
24
25
26
27
28
29

POTFILES.in: $(wildcard ../*.c)
	$(QUIET) set -e && rm -f $@.tmp && touch $@.tmp && \
	for f in $(^F) ; do \
		echo $$f >> $@.tmp ; \
	done && \
	mv $@.tmp $@

${PROJECT}.pot: POTFILES.in
	$(ECHO) regenerate ${PROJECT}.pot
	$(QUIET)intltool-update --pot --gettext-package=${PROJECT}

30
31
32
33
update-po: ${PROJECT}.pot
	$(ECHO) updating po: files ${CATALOGS}
	$(QUIET)set -e && for f in ${CATALOGS} ; do \
		intltool-update --dist --gettext-package=${PROJECT} `echo $$f | sed 's/\.po//'` ; \
34
		sed -i 's/Report-Msgid-Bugs-To: \\n/Report-Msgid-Bugs-To: http:\/\/bugs.pwmt.org\\n/'  "$$f" ; \
35
	done
36
37
38
39

%/LC_MESSAGES/${PROJECT}.mo: %.po
	@mkdir -p $(@D)
	$(ECHO) msgfmt $(shell echo $< | sed 's/\.po//')
40
	$(QUIET)${MSGFMT} ${MSGFMTFLAGS} -c $< -o $@
41
42
43
44

install: ${MOS}
	$(ECHO) installing translations
	$(QUIET)set -e && for f in $^ ; do \
Sebastian Ramacher's avatar
Sebastian Ramacher committed
45
		mkdir -p -m 755 $(DESTDIR)$(LOCALEDIR)/`dirname $$f`; \
46
47
		install -m 644 $$f $(DESTDIR)$(LOCALEDIR)/`dirname $$f` ; \
	done
48
49
50
51
52
53

uninstall: ${MOS}
	$(ECHO) removing translations
	$(QUIET)set -e && for f in $^ ; do \
		rm -f $(LOCALEDIR)/$$f; \
	done
54
55

.PHONY: all clean update-po install uninstall