-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
115 lines (85 loc) · 3.61 KB
/
Makefile
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# This mainly takes care of produced code/files, like the gettext ones.
DST_DOMAINS=admin agent customer signup
SRC_DOMAINS=common $(DST_DOMAINS)
UIS= A2BAgent_UI A2Billing_UI A2BCustomer_UI Signup
LANGS-agent=el_GR en_US es_ES fr_FR it_IT pl_PL pt_PT
LANGS-admin=en_US pt_BR el_GR
LANGS-signup=el_GR en_US es_ES fr_FR it_IT pl_PL pt_PT
LANGS-customer=en_US el_GR es_ES fr_FR it_IT pl_PL pt_PT pt_BR ro_RO ru_RU tr_TR ur_PK zh_TW
LANGS-common=en_US el_GR es_ES fr_FR it_IT pl_PL pt_PT pt_BR ro_RO ru_RU tr_TR ur_PK zh_TW
CODE-admin=A2Billing_UI
CODE-agent=A2BAgent_UI
CODE-customer=A2BCustomer_UI
CODE-signup=Signup
CODE-common=common
all: pofiles binaries all-css
test:
@echo Src domains: $(SRC_DOMAINS:%=common/locale/%.pot)
messages: $(SRC_DOMAINS:%=common/locale/%.pot)
define DOMAIN_template
common/locale/$(1).files: FORCE
@find $$(CODE-$(1)) -name '*.php' > [email protected]
@find $$(CODE-$(1)) -name '*.inc' >> [email protected]
@if [ -f $$@ ] && diff -q $$@ [email protected] > /dev/null ; then \
rm -f [email protected] ; \
else mv -f [email protected] $$@ ; \
fi
common/locale/$(1).pot: common/locale/$(1).files
@[ -d common/locale/ ] || mkdir -p common/locale/
@xgettext --omit-header -o $$@ -L PHP -f common/locale/$(1).files
endef
define COMMON_template
common/locale/$(1)/LC_MESSAGES/common.po: common/locale/common.pot
if [ ! -f $$@ ] ; then \
msginit --no-translator -o $$@ -i $$< -l $(1) ; \
else msgmerge -U $$@ $$< ; fi
endef
define UI_template
common/locale/$(2)/LC_MESSAGES/$(1).po: common/locale/$(1).pot
if [ ! -f $$@ ] ; then \
msginit --no-translator -o $$@ -i $$< -l $(2) ; \
else msgmerge -U $$@ $$< ; fi
$(CODE-$(1))/lib/locale/$(2)/LC_MESSAGES/$(1).mo: common/locale/$(2)/LC_MESSAGES/$(1).po common/locale/$(2)/LC_MESSAGES/common.po
@if [ ! -d $(CODE-$(1))/lib/locale/$(2)/LC_MESSAGES/ ] ; then mkdir -p $(CODE-$(1))/lib/locale/$(2)/LC_MESSAGES/ ; fi
msgcat --use-first $$^ | msgfmt -o $$@ '-'
pofiles: common/locale/$(2)/LC_MESSAGES/$(1).po common/locale/$(2)/LC_MESSAGES/common.po
binaries: $$(CODE-$(1))/lib/locale/$(2)/LC_MESSAGES/$(1).mo
endef
$(foreach clang,$(LANGS-common),$(eval $(call COMMON_template,$(clang))))
$(foreach uii,$(SRC_DOMAINS),$(eval $(call DOMAIN_template,$(uii))))
$(foreach uii,$(DST_DOMAINS),$(foreach lang,$(LANGS-$(uii)),$(eval $(call UI_template,$(uii),$(lang)))))
gettexts:
@echo "Gettext compilation finished, you can transfer them to your web server now."
@echo
@echo "Please note that you may need to *restart* the httpd to let new texts appear"
# A template for a specific domain/style sheet.
# Args: $1: domain, $2 style
define CSS2_template
# $$(CODE-$(1))/css/$(2).css: common/css-src/common/$(2)/ common/css-src/$(1)/$(2)/
$$(CODE-$(1))/css/$(2).css: common/css-src/common/$(2)/*.inc.css common/css-src/$(1)/$(2)/*.inc.css
@mkdir -p $$(CODE-$(1))/css/
cat $$^ > $$@
clear-css: $$(CODE-$(1))/css/$(2).css
endef
define CSS_template
STYLES-$(1)-name:=$$(subst common/css-src/$(1)/,,$$(wildcard common/css-src/$(1)/*))
STYLES-$(1)-files:=$$(foreach name,$$(STYLES-$(1)-name),$$(CODE-$(1))/css/$$(name).css)
all-css: css-$(1)
$$(CODE-$(1))/css:
@[ ! -f $$(CODE-$(1))/css ] || ( echo "$$(CODE-$(1))/css is a file!" ; exit 1 )
@mkdir -p $$(CODE-$(1))/css/
@cd $$(CODE-$(1))/css/ ; ln -s ../../common/css/images ./
css-$(1): $$(CODE-$(1))/css $$(STYLES-$(1)-files)
$$(foreach style,$$(STYLES-$(1)-name),$$(eval $$(call CSS2_template,$(1),$$(style))))
endef
$(foreach uii,$(DST_DOMAINS),$(eval $(call CSS_template,$(uii))))
clear-css:
rm -f $^
list-css:
echo $(STYLES-admin-name)
#echo $(STYLES-admin)
progdocs:
cat addons/contrib/a2billing-doxygen | doxygen -
FORCE: ;
.SILENT: messages test common/locale/%.pot
#eof