Subversion Repositories svn LFS-FR

Rev

Rev 7288 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7282 jlepiller 1
#!/usr/bin/make -f
2
 
3
# Use make L=... to build only a subset of the languages.
4
 
5
LANGUAGES := fr
6
LANG_fr := fr_FR.UTF-8
7
L = all
8
 
9
ORIGDIR := clfs-en/BOOK
10
 
11
 
12
TAG := trunk
13
 
14
# Depending on what we track, we choose the correct branch from upstream.
15
ifeq ($(TAG), trunk)
16
EN_VER := trunk/BOOK
17
else
18
EN_VER := tags/$(TAG)
19
endif
20
 
21
# Some version of echo (for instance the one shipped in dash) doesn't understand -e
22
# but acts as if it was passed by default.
23
ifeq ($(shell echo -n -e),-e)
24
ECHO:=echo
25
else
26
ECHO:=echo -e
27
endif
28
 
29
# Files that are needed for the build process once translations are generated.
30
filestocopy := INSTALL README filesize.sh obfuscate.sh tidy.sh Makefile \
31
	users_groups.ent
32
# Additional files that may require some changes.
33
filestoget := $(filestocopy) packages.ent tidy.conf patches.ent general.ent
34
 
35
FR_REPO:=svn://svn.linuxfromscratch.org/fr-lfs
36
EN_REPO:=git://git.clfs.org/cross-lfs.git
37
 
38
.PHONY: svnup
39
 
40
# Don't delete intermediates (.po files).
41
.SECONDARY:
42
 
43
all: genhtml genpdf
44
	@echo DONE
45
 
46
include include.mk
47
 
48
init: $(ORIGDIR)
49
 
50
$(ORIGDIR):
51
	[ -d $@ ] || git clone $(EN_REPO) $(shell dirname $(ORIGDIR))/
52
 
53
# When updating, check that we still want to follow the checked-out branch.
54
# If not, remove it and check out the new branch.
55
svnup: init
56
	cd $(ORIGDIR); git pull
57
 
58
clean: clean-gen
59
	rm -rf $(ORIGDIR) include.mk
60
 
61
# include.mk contains most of the logic of the Makefile.
62
# We generate lists of XML files to be translated, PO files that contain translations,
63
# images and stylesheet files, and the list of files to copy from the english repo.
64
#
65
# It also contains targets to build different html versions, to refresh the PO
66
# files and to generate the translated XML files. We need to use this target
67
# because the language in the name of the target and the file name are both
68
# wildcards, which cannot be used.
69
include.mk: $(ORIGDIR) Makefile
70
	echo -n 'XML := ' > $@.tmp
71
	for lang in $(LANGUAGES); do \
72
		find $(ORIGDIR) -name '*.xml' -o -name '*stylesheets*' -prune -a -type f |\
73
			sed "s|$(ORIGDIR)/|clfsgen-$$lang/|g" | \
74
			tr '\n' ' ' >> $@.tmp; \
75
	done
76
	echo >> $@.tmp
77
	echo -n 'PO := ' >> $@.tmp
78
	for lang in $(LANGUAGES); do \
79
		find $(ORIGDIR) -name '*.xml' -o -name '*stylesheets*' -prune -a -type f |\
80
			sed "s|$(ORIGDIR)/|$$lang/|g" | \
81
			sed 's|.xml$$|.po|' | tr '\n' ' ' >> $@.tmp; \
82
	done
83
	echo >> $@.tmp
84
	echo -n 'SCHEMAS := ' >> $@.tmp
85
	for lang in $(LANGUAGES); do \
86
		(cd $(ORIGDIR); find schema -type f) \
87
			| sed "s|^|clfsgen-$$lang/|g" | tr '\n' ' ' >> $@.tmp; \
88
	done
89
	echo >> $@.tmp
90
	echo -n 'IMAGES := ' >> $@.tmp
91
	for lang in $(LANGUAGES); do \
92
		find images -type f | sed "s|^|clfsgen-$$lang/|g" | tr '\n' ' ' >> $@.tmp; \
93
	done
94
	echo >> $@.tmp
95
	echo -n 'STYLESHEETS := ' >> $@.tmp
96
	for lang in $(LANGUAGES); do \
97
		find stylesheets -type f | sed "s|^|clfsgen-$$lang/|g" | tr '\n' ' ' >> $@.tmp;\
98
	done
99
	echo >> $@.tmp
100
	echo -n 'COPY = ' >> $@.tmp
101
	for lang in $(LANGUAGES); do \
102
		echo -n ' $$(addprefix clfsgen-'"$$lang"'/,$$(filestoget))' >> $@.tmp ;\
103
	done
104
	echo >> $@.tmp
105
	echo >> $@.tmp
106
	for lang in $(LANGUAGES); do \
107
		echo "clfsgen-$$lang/images/%: images/%" >> $@.tmp ;\
108
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
109
		$(ECHO) '\t@rm -f $$@' >> $@.tmp ;\
110
		$(ECHO) '\tcp $$< $$@' >> $@.tmp ;\
111
	done
112
	echo >> $@.tmp
113
	for lang in $(LANGUAGES); do \
114
		echo "clfsgen-$$lang/stylesheets/%: stylesheets/%" >> $@.tmp ;\
115
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
116
		$(ECHO) '\t@rm -f $$@' >> $@.tmp ;\
117
		$(ECHO) '\tcp $$< $$@' >> $@.tmp ;\
118
	done
119
	echo >> $@.tmp
120
	for lang in $(LANGUAGES); do \
121
		echo "clfsgen-$$lang/schema/%: $(ORIGDIR)/schema/%" >> $@.tmp ;\
122
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
123
		$(ECHO) '\t@rm -f $$@' >> $@.tmp ;\
124
		$(ECHO) '\tcp $$< $$@' >> $@.tmp ;\
125
	done
126
	echo >> $@.tmp
127
	for lang in $(LANGUAGES); do \
128
		echo "clfsgen-$$lang/%.xml: $(ORIGDIR)/%.xml $$lang/%.po sed-$$lang" \
129
			>> $@.tmp ;\
130
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
131
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') po4a-translate -k 0 -f docbook' \
132
			'-m $$< -l $$@.tmp -p $$(word 2,$$^)' >> $@.tmp ;\
133
		$(ECHO) '\t./$$(word 3,$$^) $$@' >> $@.tmp ;\
134
		$(ECHO) '\trm $$@.tmp' >> $@.tmp ;\
135
	done
136
	echo >> $@.tmp
137
	for lang in $(LANGUAGES); do \
138
		echo "$$lang/%.po: $(ORIGDIR)/%.xml" \
139
			>> $@.tmp ;\
140
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
141
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') po4a-updatepo -f docbook' \
142
			'-m $$< -p $$@' >> $@.tmp ;\
143
		$(ECHO) '\t@touch $$@' >> $@.tmp ;\
144
	done
145
	echo >> $@.tmp
146
	echo 'clean-gen:' >> $@.tmp
147
	for lang in $(LANGUAGES); do \
148
		$(ECHO) "\trm -rf clfsgen-$$lang" >> $@.tmp ;\
149
	done
150
	echo >> $@.tmp
151
	echo .SECONDEXPANSION: >> $@.tmp
152
	for lang in $(LANGUAGES); do \
153
		echo '$$(addprefix clfsgen-'"$$lang"'/,$$(filestocopy)):' \
154
			'INPUT=$$(ORIGDIR)$$(subst clfsgen-'"$$lang"',,$$@)' >> $@.tmp ;\
155
		echo '$$(addprefix clfsgen-'"$$lang"'/,$$(filestocopy)):' \
156
			'$$$$(INPUT)' >> $@.tmp ;\
157
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
158
		$(ECHO) '\tcp -r $$< $$@' >> $@.tmp ;\
159
	done
160
	echo >> $@.tmp
161
	for lang in $(LANGUAGES); do \
162
		xml='$$(filter clfsgen-'"$$lang"'/%,$$(XML))' ;\
163
		copy='$$(filter clfsgen-'"$$lang"'/%,$$(COPY))' ;\
164
		echo 'genhtml-'"$$lang"': '"$$copy $$xml"' $$(IMAGES) $$(STYLESHEETS) $$(SCHEMAS)' >> $@.tmp ;\
165
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') make -C clfsgen-'"$$lang"' -j1 REV=sysv RENDERDIR=../html-'"$$lang" >> $@.tmp ;\
166
		echo 'genpdf-'"$$lang"': '"$$copy $$xml"' $$(IMAGES) $$(STYLESHEETS) $$(SCHEMAS)' >> $@.tmp ;\
167
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') make -C clfsgen-'"$$lang"' -j1 REV=sysv BASEDIR=../pdf-'"$$lang"' pdf' >> $@.tmp ;\
168
	done
169
	echo >> $@.tmp
170
	mv $@.tmp $@
171
 
172
ifeq ($(L),all)
173
L=$(LANGUAGES)
174
endif
175
 
176
HTMLDEPS=$(addprefix genhtml-,$(L))
177
PDFDEPS=$(addprefix genpdf-,$(L))
178
 
179
genhtml: $(HTMLDEPS)
180
genpdf: $(PDFDEPS)
181
 
182
update: $(PO)
183
 
184
pootle:
7288 jlepiller 185
	pootle sync_stores --project=clfs
7282 jlepiller 186
	$(MAKE) svnup
187
	$(MAKE) update
188
	pootle update_stores --project=clfs
189
 
190
USER:=jlepiller
191
upload:
192
	for lang in $(L); do \
193
		cd html-$$lang/html;\
194
		rsync --progress --recursive * $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/view/clfs-svn/ ;\
195
		cd .. ;\
196
	done
197
 
198
###############################################################################
199
# These files are not translated using po files. We use sed to modify them    #
200
# directly.                                                                   #
201
###############################################################################
202
 
203
##
204
## French translation of non po files
205
##
206
 
207
clfsgen-fr/general.ent: $(ORIGDIR)/general.ent
208
	@mkdir -p clfsgen-fr
209
	month=$$(grep " month_name " $< | sed 's/.*"\([^"]\+\)".*/\1/') ;\
210
	sed -e "s/$$month/$$(LANG=$(LANG_fr) date -d "01 $${month} 2010" "+%B")/g"\
211
	    -e "s/Installation depends on/L'installation dépend de/g"\
212
	    -e "s/Test suite depends on/La suite de tests dépend de/g"\
213
	    -e "s/Must be installed before/Doit être installé avant/g"\
214
	    -e "s|&lfs-root;blfs/|http://fr.linuxfromscratch.org/blfs|g"\
215
	    -e "s/ISO-8859-1/UTF-8/" \
216
	    $< > $@
217
 
218
clfsgen-fr/packages.ent: $(ORIGDIR)/packages.ent
219
	@mkdir -p clfsgen-fr
220
	sed -e "s/KB/Ko/g" -e "s/MB/Mo/g" -e "s/GB/Go/g"\
221
	    -e "s/ISO-8859-1/UTF-8/" \
222
	    $< > $@
223
 
224
clfsgen-fr/patches.ent: $(ORIGDIR)/patches.ent
225
	@mkdir -p clfsgen-fr
226
	sed -e "s/KB/Ko/g" \
227
	    -e "s/ISO-8859-1/UTF-8/" \
228
	    $< > $@
229
 
230
clfsgen-fr/tidy.conf: $(ORIGDIR)/tidy.conf
231
	@mkdir -p clfsgen-fr
232
	sed -e "s/latin1/UTF8/g" \
233
	    $< > $@
234
 
235
clfsgen-fr/stylesheets/top-index.xsl: stylesheets/top-index.xsl
236
	@mkdir -p clfsgen-fr/stylesheets
237
	sed -e 's|Select your target architecture:|Choisissez votre architecture cible :|g'\
238
	    $< > $@