-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (102 loc) · 4.09 KB
/
Copy pathMakefile
File metadata and controls
130 lines (102 loc) · 4.09 KB
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
LANG=en_US.UTF-8
SHELL := /bin/bash
default: html
LFS_EN = lfs-en
MLANG = zh_CN
include $(MLANG)/lang.mk
EXCLUDE_XML = $(LFS_EN)/stylesheets/lfs-xsl/lfs-l10n.xml \
$(LFS_EN)/appendices/creat-comm.xml \
$(LFS_EN)/appendices/mit-lic.xml \
$(wildcard $(LFS_EN)/chapter10/kernel/*.xml)
EXCLUDE_XML += $(LFS_EN)/chapter08/xml-parser.xml \
$(LFS_EN)/chapter08/intltool.xml
EXCLUDE_XML += $(LFS_EN)/appendices/scripts.xml \
$(LFS_EN)/appendices/udev-rules.xml \
$(LFS_EN)/chapter08/sysklogd.xml \
$(LFS_EN)/chapter08/sysvinit.xml \
$(LFS_EN)/chapter08/udev.xml \
$(LFS_EN)/chapter09/bootscripts.xml \
$(LFS_EN)/chapter09/network.xml \
$(LFS_EN)/chapter09/usage.xml
CMD_FIND_XML = find $(LFS_EN) -type f -name '*.xml'
XML_FILES = $(filter-out $(EXCLUDE_XML), $(wildcard $(shell $(CMD_FIND_XML))))
POT_DIRS = $(sort $(patsubst $(LFS_EN)/%, pot/%, $(dir $(XML_FILES))))
PO_FILES = $(patsubst $(LFS_EN)/%.xml, $(MLANG)/%.po, $(XML_FILES))
MKPO4ACFG = ./mkpo4acfg.py $(MLANG)
$(MLANG)/book: ; mkdir -pv $@
-include local.mk
$(PO_FILES) &: $(XML_FILES) mkpo4acfg.py
mkdir -pv $(POT_DIRS)
$(MKPO4ACFG) $(XML_FILES) > po4a.cfg
po4a --no-translations po4a.cfg
./changelogtranslator.py $(MLANG)
# Run again. polib does not agree with po4a on line wrappings
# in the .po file, so we need to settle it down.
po4a --no-translations po4a.cfg
MXML_FILES = $(patsubst $(LFS_EN)/%.xml, $(MLANG)/book/%.xml, $(XML_FILES))
EN_BOOK_FILES = $(shell find $(LFS_EN) -type f \
-not -path "$(LFS_EN)/.git" \
-not -path "$(LFS_EN)/conditional.ent" \
-not -path "*.tar.xz")
BOOK_FILES = $(patsubst $(LFS_EN)/%, %, $(EN_BOOK_FILES))
MBOOK_FILES = $(patsubst %, $(MLANG)/book/%, $(BOOK_FILES))
.PHONY: html booksrc nochunks pdf pofiles
pofiles: $(PO_FILES) $(MLANG)/chapter01/changelog.po
html: booksrc
rm -rf $(MLANG)/book/render # without this tidy may be stupidly slow
tmpdir=$$(mktemp -d); \
make -j1 -C $(MLANG)/book BASEDIR=render RENDERTMP=$$tmpdir; \
rm -rf $$tmpdir
nochunks: booksrc
rm -rf $(MLANG)/book/nochunks
tmpdir=$$(mktemp -d); \
make -j1 -C $(MLANG)/book BASEDIR=nochunks RENDERTMP=$$tmpdir nochunks; \
rm -rf $$tmpdir
pdf: booksrc
rm -rf $(MLANG)/book/pdf
tmpdir=$$(mktemp -d); \
make -j1 -C $(MLANG)/book BASEDIR=pdf RENDERTMP=$$tmpdir pdf; \
rm -rf $$tmpdir
booksrc: $(MBOOK_FILES) $(ORIG_FILES) $(MLANG)/book/version.ent
# $(MLANG)/book is not a git repo, so we need to generate the version info
# now and silence git-version.sh. lang.mk SHALL contain the recipe to
# localize git-version.sh.
#
# The content of version.ent does not depend on REV, so just say "systemd"
# here.
.PHONY: version
version: $(MLANG)/book/git-version.sh
cd $(<D); rm LFS-RELEASE; \
DIST=./LFS-RELEASE GIT_DIR=$(PWD)/$(LFS_EN)/.git ./$(<F) systemd
rm -fv $(MLANG)/book/conditional.ent
$(MLANG)/book/version.ent: version; true
$(MXML_FILES) &: $(XML_FILES) $(PO_FILES) mkpo4acfg.py po4a_issue295.sh
mkdir -pv $(POT_DIRS)
$(MKPO4ACFG) $(XML_FILES) > po4a.cfg
po4a po4a.cfg
sed -e 's|<book>|<book lang="$(M_DOCBOOK_LANG)">|' -i $(MLANG)/book/index.xml
cd $(MLANG)/book; $(PWD)/po4a_issue295.sh
touch $(MXML_FILES)
$(MLANG)/book/%: $(LFS_EN)/%
mkdir -pv "$(@D)"
cp -v $< $@
# The following targets are used for checking any unintentionally command
# changes.
KNOWN_DIFF = chapter09/*-symlinks \
chapter09/*-network \
chapter09/*-console \
chapter09/*-locale \
chapter10/*-fstab
cmd/en/systemd/stamp: $(EN_BOOK_FILES)
rm -rf "$(PWD)/$(@D)"
make -C $(LFS_EN) DUMPDIR="$(PWD)/$(@D)" dump-commands
cd $(@D); rm -f $(KNOWN_DIFF)
touch $@
cmd/$(MLANG)/systemd/stamp: $(MBOOK_FILES)
rm -rf "$(PWD)/$(@D)"
make -C $(MLANG)/book DUMPDIR="$(PWD)/$(@D)" dump-commands
cd $(@D); rm -f $(KNOWN_DIFF)
touch $@
.PHONY: check-cmd
check-cmd: cmd/en/systemd/stamp cmd/$(MLANG)/systemd/stamp
diff $(^D) -Naur