Makefile 1.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
# See LICENSE file for license and copyright information

PROJECT = zathura
CATALOGS = $(wildcard *.po)
MOS = $(patsubst %.po, %/LC_MESSAGES/${PROJECT}.mo, $(CATALOGS))

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

all: ${MOS}

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

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}

26
27
28
29
30
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//'` ; \
	done
31
32
33
34

%/LC_MESSAGES/${PROJECT}.mo: %.po
	@mkdir -p $(@D)
	$(ECHO) msgfmt $(shell echo $< | sed 's/\.po//')
Sebastian Ramacher's avatar
Sebastian Ramacher committed
35
	$(QUIET)msgfmt $< -o $@ -f -c
36
37
38
39
40
41
42

install: ${MOS}
	$(ECHO) installing translations
	$(QUIET)set -e && for f in $^ ; do \
		mkdir -p $(DESTDIR)$(LOCALEDIR)/`dirname $$f`; \
		install -m 644 $$f $(DESTDIR)$(LOCALEDIR)/`dirname $$f` ; \
	done
43
44
45
46
47
48

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

.PHONY: all clean update-po install uninstall