summaryrefslogtreecommitdiff
path: root/src/lib/Makefile
blob: 45fd330cd09dd6bf22e6ad7d7b3560c8a89d8bd0 (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
copy_files = common.sh.in
libexecs = $(filter-out librelib,$(wildcard libre*))
# include common.sh in libs explicitly, because it might not exist yet
# when the wildcard is performed
libs = $(sort $(wildcard *.sh) common.sh)
include ../../common.mk

# Build ##############################################################

common.sh: %: %.in %.top Makefile
	@echo "GEN $@"
	@{ \
	cat '$*.top' && \
	echo && \
	sed -r -e '/encoding problem/d;/LANG=/d' -e 's/mesg=\$$(.)/mesg="$$(_ "$$\1")"/' '$*.in' && \
	echo && \
	cat '$*.bottom' && \
	:; } > '$@'

# Translate ##########################################################

pot: libreblacklist.pot common.sh.pot librelib.pot

libreblacklist.pot: libreblacklist
	{ \
		sed -n '/^# Usage:/,/()/{ /^#/ { =; p; } }' $< | sed -r -e 's/^# (.*)/msgid   "\1"/' -e 's/^[0-9]*$$/#. embedded usage text\n#: $<:&/'; \
		sed -rn '/print /{ =; s/\s*print "([^"]*)".*/msgid   "\1"/p; }' $< | sed 's/^[0-9]*$$/#. print\n#: $<:&/' ; \
	} | sed 's/^msgid .*/&\nmsgstr  ""\n/' > $@
common.sh.pot: common.sh
	xgettext --omit-header -i --from-code=UTF-8 -L shell -o $@ $<