source: ubiquity-slideshow-ubuntu/trunk/fuentes/Makefile

Last change on this file was 2067, checked in by daduve, 3 years ago

makefile up

File size: 3.1 KB
Line 
1# Makefile for ubiquity-slideshow-ubuntu
2
3SLIDESHOWS = \
4        ubuntu \
5        lliurex \
6        lliurex_non_edu \
7        kubuntu \
8        xubuntu \
9        lubuntu \
10        edubuntu \
11        ubuntustudio \
12        ubuntu-gnome \
13        ubuntukylin \
14        ubuntu-mate \
15        oem-config-ubuntu \
16        oem-config-ubuntu-mate
17
18SOURCE ?= .
19SOURCESLIDES ?= $(SOURCE)/slideshows
20BUILD ?= $(SOURCE)/build
21
22PO4A_FLAGS = -M UTF-8 -f xhtml -o attributes="data-translate"
23
24
25find-slides = $(filter-out %/index.html,$(wildcard $1/*.html))
26find-slidenames = $(notdir $(call find-slides,$(SOURCESLIDES)/$1/slides))
27find-locales = $(basename $(notdir $(wildcard po/$1/*.po)))
28
29
30.PHONY: all
31all: build.slideshows
32
33.PHONY: pot
34
35.PHONY: clean
36clean:
37        -rm -rf $(_ALL_TMP_DIRS) $(BUILD)
38
39.PHONY: test
40test: build
41        ./test-slideshow.sh
42
43$(BUILD):
44        mkdir -p $(BUILD)
45
46.PHONY: build.slideshows
47
48
49define MAKE-SLIDESHOW
50
51# Per-slideshow build
52
53_SOURCE_FILES_$(1) := $$(shell find -L $(SOURCESLIDES)/$(1) -type f)
54_BUILD_FILES_$(1) := $$(patsubst $(SOURCESLIDES)/%,$(BUILD)/%,$$(_SOURCE_FILES_$(1)))
55
56_ALL_TMP_DIRS += $(BUILD)/$1
57build.slideshows: build.$1
58
59.PHONY: build.$1
60build.$1: build.base.$1 build.l10n.$1
61
62.PHONY: build.base.$1
63build.base.$1: $$(_BUILD_FILES_$(1))
64
65.PHONY: build.l10n.$1
66build.l10n.$1: build.base.$1
67        ./build-directory-jsonp.py $(BUILD)/$1/slides/l10n > $(BUILD)/$1/slides/directory.jsonp
68
69# Per-slideshow pot file creation
70
71_ALL_TMP_DIRS += po/$1/.tmp
72pot: po/$1/slideshow-$1.pot
73
74po/$1/slideshow-$1.pot: $(addsuffix .pot,$(addprefix po/$1/.tmp/,$(call find-slidenames,$1)))
75        msgcat -F $$^ > $$@
76
77po/$1/.tmp/%.pot: $(SOURCESLIDES)/$1/slides/% | po/$1/.tmp
78        po4a-updatepo $(PO4A_FLAGS) -m $$^ -p $$@
79
80po/$1/.tmp:
81        mkdir -p po/$1/.tmp
82
83# Per-slideshow test scripts
84
85.PHONY: $(SLIDESHOWS)
86$(SLIDESHOWS): %: build.%
87
88.PHONY: test.$1
89test.$1: build.base.$1
90        ./Slideshow.py --path="$(BUILD)/$1" --controls
91
92$(foreach p,$(call find-locales,$1),$(eval $(call MAKE-SLIDESHOW-LOCALE,$1,$p)))
93
94endef
95
96
97define MAKE-SLIDESHOW-LOCALE
98
99# Per-locale per-slideshow build
100# By creating a different target for each locale, parallel build works as expected.
101
102build.l10n.$1: build.l10n.$1.$2
103
104.PHONY: build.l10n.$1.$2
105build.l10n.$1.$2: $(addprefix $(BUILD)/$1/slides/l10n/$2/,$(call find-slidenames,$1))
106        rmdir --ignore-fail-on-non-empty $(BUILD)/$1/slides/l10n/$2
107
108$(BUILD)/$1/slides/l10n/$2/%: $(SOURCESLIDES)/$1/slides/% po/$1/$2.po | $(BUILD)/$1/slides/l10n/$2
109        po4a-translate $(PO4A_FLAGS) --keep=1 --master=$$< --po=po/$1/$2.po --localized=$$@
110
111$(BUILD)/$1/slides/l10n/$2:
112        # translate all slides inside this locale
113        mkdir -p $$@
114
115# Per-locale per-slideshow test scripts
116
117test.$1.$2: build.base.$1 build.l10n.$1.$2
118        ./build-directory-jsonp.py $(BUILD)/$1/slides/l10n > $(BUILD)/$1/slides/directory.jsonp
119        ./Slideshow.py --path="$(BUILD)/$1" --controls --locale=$2
120
121test.$1.$2.rtl: build.base.$1 build.l10n.$1.$2
122        ./build-directory-jsonp.py $(BUILD)/$1/slides/l10n > $(BUILD)/$1/slides/directory.jsonp
123        ./Slideshow.py --path="$(BUILD)/$1" --controls --locale=$2 --rtl
124
125endef
126
127
128$(foreach s,$(SLIDESHOWS),$(eval $(call MAKE-SLIDESHOW,$s)))
129
130
131$(BUILD)/%: $(SOURCESLIDES)/% | $(BUILD)
132        mkdir -p $(@D)
133        cp $^ $@
134
135$(BUILD)/%.js: $(SOURCESLIDES)/%.js | $(BUILD)
136        mkdir -p $(@D)
137        cp $^ $@
Note: See TracBrowser for help on using the repository browser.