File: Makefile

package info (click to toggle)
backup-manager 0.7.14-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,656 kB
  • sloc: sh: 4,041; perl: 1,176; makefile: 215
file content (67 lines) | stat: -rw-r--r-- 1,789 bytes parent folder | download | duplicates (5)
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
67
SYSTEM := $(shell uname)
ifeq ($(SYSTEM), Darwin)
   prefix=$(DESTDIR)/sw
else
   prefix=$(DESTDIR)/$(PREFIX)
endif

# List here all source files with translatable strings.
POTFILES= \
	$(shell find ../lib -type f -name \*.sh) \
	../backup-manager

POFILES_SRC=backup-manager.files
POFILES=$(wildcard *.po)
MOFILES=$(POFILES:.po=.mo)
PACKAGE=backup-manager
.SUFFIXES: .po .mo

all: backup-manager.pot $(POFILES) $(MOFILES)

install: backup-manager.pot $(MOFILES)
	@echo "Installing mo files"
	for file in $(MOFILES); do \
		lang=`echo $$file | sed 's/\.mo//'`; \
		install -d $(prefix)/share/locale/$$lang/LC_MESSAGES/; \
		install -m 0644 $$file $(prefix)/share/locale/$$lang/LC_MESSAGES/backup-manager.mo; \
	done

$(POFILES_SRC):
	find ../lib -type f -name \*.sh | sort > $(POFILES_SRC)
	echo ../backup-manager >> $(POFILES_SRC)

$(PACKAGE).pot: $(POFILES_SRC)
	xgettext --keyword=info \
			 --keyword=warning \
			 --keyword=error \
			 --keyword=echo_translated \
			 --language=Shell \
			 -o backup-manager.pot \
			 --files-from=$(POFILES_SRC)
clean:
	rm -f backup-manager.pot \
		  backup-manager.files \
	      $(MOFILES) \
		  messages messages.mo \
		  messages.po
	for file in $(wildcard *.old); do \
		mv -f $$file `echo $$file | sed 's/\.old//'`; \
		done

.po.mo: backup-manager.pot
	@echo "Merging $(PACKAGE).pot and $*.po"
	@msgmerge $*.po $(PACKAGE).pot -o $*.po.new
	@if [ "`diff $*.po $*.po.new | grep '[<>]' | wc -l`" -ne 2 ]; then \
        mv -f --backup=simple --suffix='.old' $*.po.new $*.po; \
    else \
        rm -f $*.po.new; \
    fi
	@msgfmt --statistics $*.po
	msgfmt --no-hash -o $*.mo $*.po

check:
	@for file in $(POFILES); do \
		lang=`echo $$file | sed 's/\.po//'`; \
		printf "$$lang: "; \
		msgfmt -o /dev/null -c -v --statistics $$lang.po;\
	done