~ubuntu-core-doc/xubuntu-docs/xenial

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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Makefile for the Xubuntu Documentation
# Xubuntu Project <xubuntu-devel@lists.ubuntu.com>

# Include revision number
ifneq ($(REVNO),)
    VERSION = 
    VERSION += (Rev. $(REVNO))
endif

# All available translations
TRANSALLUSER = $(shell basename -s .po -a user-docs/po/*.po)
TRANSALLCONTR = $(shell basename -s .po -a contributor-docs/po/*.po)

ifeq ($(TRANSALLCONTR),*)
    TRANSALLCONTR =
endif

# Translation links
TRSLINKSUSER = $(shell for lang in $(TRANSLATUSER); do \
        awk -v lang="$$lang" '$$1 == lang {print "\t\t\t\t\t\t<li><a href=\\\"user/" lang "/index.html\\\">" $$2 "</a></li>\\n"; f=1; exit} END {exit !f}' libs-common/language-names || \
        awk -v lang="$$lang" '$$1 == "\"Language-Team:" {print "\t\t\t\t\t\t<li><a href=\\\"user/" lang "/index.html\\\">" $$2 "</a></li>\\n"; exit}' user-docs/po/$$lang.po; \
    done | sed '$$ s/\\n$$//')

TRSLINKSCONTR = $(shell for lang in $(TRANSLATCONTR); do \
        awk -v lang="$$lang" '$$1 == lang {print "\t\t\t\t\t\t<li><a href=\\\"contributor/" lang "/index.html\\\">" $$2 "</a></li>\\n"; f=1; exit} END {exit !f}' libs-common/language-names || \
        awk -v lang="$$lang" '$$1 == "\"Language-Team:" {print "\t\t\t\t\t\t<li><a href=\\\"contributor/" lang "/index.html\\\">" $$2 "</a></li>\\n"; exit}' contributor-docs/po/$$lang.po; \
    done | sed '$$ s/\\n$$//')

all: clean startpage user-all

user-all: user-html user-html-translations user-pdf user-pdf-translations

contributor-all: contributor-html contributor-html-translations contributor-pdf contributor-pdf-translations

startpage: startpage-style user-get-translations contributor-get-translations
	sed "s@<a href=\"[^\"]\+\">Official Documentation</a>@&$(VERSION)@; \
	    s@^\(.*\)<!-- user docs translations -->.*@$(TRSLINKSUSER)@" startpage/index.html > build/index.html
	sed -i "s@<a href=\"[^\"]\+\">Contributor Documentation</a>@&$(VERSION)@; \
	    s@^\(.*\)<!-- contributor docs translations -->.*@$(if $(TRSLINKSCONTR),$(TRSLINKSCONTR),\1)@" build/index.html

startpage-style: common-libs
	cp startpage/*.css build/
	@touch startpage-style

common-libs:
	mkdir -p build/libs-common 
	cp -r libs-common/css \
		libs-common/images \
		build/libs-common/
	@touch common-libs

user-docs/update-translations:
    ifeq ($(TRANSLATIONS),)
        ifneq ($(wildcard user-docs/po/LINGUAS),)
		cd user-docs; \
		../scripts/translate.sh -u
		@touch user-docs/update-translations
        endif
    endif

user-update-translations: user-docs/update-translations

user-get-translations: user-docs/update-translations
    ifeq ($(TRANSLATIONS),)
        ifneq ($(wildcard user-docs/po/LINGUAS),)
            export TRANSLATUSER = $(shell cat user-docs/po/LINGUAS)
            export TRANSOPTSUSER = -g
        else
            export TRANSLATUSER := $(TRANSALLUSER)
            export TRANSOPTSUSER := -l "$(TRANSLATUSER)"
        endif
    else
        export TRANSLATUSER := $(TRANSLATIONS)
        export TRANSOPTSUSER := -l "$(TRANSLATIONS)"
    endif

contributor-docs/update-translations:
    ifeq ($(TRANSLATIONS),)
        ifneq ($(wildcard contributor-docs/po/LINGUAS),)
		cd contributor-docs; \
		../scripts/translate.sh -u
		@touch contributor-docs/update-translations
        endif
    endif

contributor-update-translations: contributor-docs/update-translations

contributor-get-translations: contributor-docs/update-translations
    ifeq ($(TRANSLATIONS),)
        ifneq ($(wildcard contributor-docs/po/LINGUAS),)
            export TRANSLATCONTR = $(shell cat contributor-docs/po/LINGUAS)
            export TRANSOPTSCONTR = -g
        else
            export TRANSLATCONTR := $(TRANSALLCONTR)
            export TRANSOPTSCONTR := -l "$(TRANSLATCONTR)"
        endif
    else
        export TRANSLATCONTR := $(TRANSLATIONS)
        export TRANSOPTSCONTR := -l "$(TRANSLATIONS)"
    endif

user-html:
	$(MAKE) -C user-docs html

user-epub:
	$(MAKE) -C user-docs epub

user-pdf:
	$(MAKE) -C user-docs pdf

user-translate:
	$(MAKE) -C user-docs translate

user-html-translations:
	$(MAKE) -C user-docs html-translations

user-pdf-translations:
	$(MAKE) -C user-docs pdf-translations

contributor-html:
	$(MAKE) -C contributor-docs html

contributor-epub:
	$(MAKE) -C contributor-docs epub

contributor-pdf:
	$(MAKE) -C contributor-docs pdf

contributor-translate:
	$(MAKE) -C contributor-docs translate

contributor-html-translations:
	$(MAKE) -C contributor-docs html-translations

contributor-pdf-translations:
	$(MAKE) -C contributor-docs pdf-translations

test:
	$(MAKE) -C user-docs test
	$(MAKE) -C contributor-docs test

src-tarball:
	# exclude archive, VCS, and backups
	tar -czf xubuntu-docs.tar.gz --exclude='xubuntu-docs.tar.gz' --exclude-vcs --exclude-backups .

pot:
	scripts/get-pot.sh user-docs contributor-docs

clean:
	$(MAKE) -C user-docs clean
	$(MAKE) -C contributor-docs clean
	rm -rf build common-libs startpage-style xubuntu-docs.tar.gz

.PHONY: startpage