-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathMakefile
executable file
·210 lines (179 loc) · 6.19 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
all: ps pdf html src chunky chunkytgz htmltgz
chapters= $(wildcard chapters/*.sgml)
appendices= $(wildcard appendices/*.sgml)
scripts= $(wildcard scripts/*.txt)
license= $(wildcard licensing/*.sgml)
mains= $(wildcard *.sgml)
images_eps= $(patsubst %.gif,%.eps,$(wildcard images/*.gif))
images_jpg= $(patsubst %.gif,%.jpg,$(wildcard images/*.gif))
images_png= $(patsubst %.gif,%.png,$(wildcard images/*.gif))
OUTPATH=../homepage/output/documentation/tutorials/blueflux
.PHONY: site
site: all spanish portuguese
-@echo "Making site..."
-mkdir html
-mkdir html/images
-mkdir html/other
-mkdir html/scripts
-cp iptables-tutorial.ps.gz iptables-tutorial.html html/
-cp iptables-tutorial.src.tgz iptables-tutorial.chunky.tgz html/
-cp iptables-tutorial.html.tgz html/
-cp -r other/* html/other/
-cp -r images/*.gif html/images/
-cp -r images/*.jpg html/images/
-cp -r scripts/* html/scripts/
-rm -rf html/scripts/CVS html/other/CVS
-cp TODO ChangeLog html/
-cp -r chunkyhtml html/
# -cp mirrors.html index.php html/
-cp -r portuguese/html html/portuguese
-cp -r spanish/html html/spanish
-@echo "Done."
.PHONY: portuguese
portuguese:
@echo "*** Making portuguese translation ***"
cd portuguese; make site
.PHONY: spanish
spanish:
@echo "*** Making spanish translation ***"
cd spanish; make site
.PHONY: src
src: iptables-tutorial.src.tgz
.PHONY: ps
ps: $(images_eps) index iptables-tutorial.ps.gz
.PHONY: pdf
pdf : $(images_png) index iptables-tutorial.pdf.gz
.PHONY: html
html: $(images_jpg) index iptables-tutorial.html
.PHONY: chunky
chunky: $(images_jpg) index chunkyhtml
.PHONY: chunkytgz
chunkytgz: index iptables-tutorial.chunky.tgz
.PHONY: htmltgz
htmltgz: index iptables-tutorial.html.tgz
.PHONY: index
index: $(images_jpg) iptables-tutorial-index.sgml
.PHONY: images
images: $(images_jpg) $(images_eps) $(images_png)
%-index.sgml: $(images_jpg) $(chapters) $(appendices) $(scripts) \
$(license) $(mains)
collateindex.pl -N -o $*-index.sgml
mkdir -p index/images
cp -R styles/ chapters/ appendices/ other/ licensing/ scripts/ *.sgml \
index
cp -R images/*.jpg index/images
cd index; jw --backend html -V html-index -V nochunks \
iptables-tutorial.sgml >> iptables-tutorial.html; collateindex.pl \
-g -s Symbols -p -o index.sgml HTML.index; cd ..
cp index/index.sgml ./$*-index.sgml
rm -rf index
%.chunky.tgz: $(images_jpg) $(chapters) $(appendices) $(scripts) \
$(license) chunky
@echo "Building chunky tgz version..."
cp -r chunkyhtml chunkytgz
cp changes.sh chunkytgz
cd chunkytgz; sh ./changes.sh
tar -cf $*.chunky.tar chunkyhtml
gzip -f $*.chunky.tar
mv $*.chunky.tar.gz $*.chunky.tgz
rm -rf chunkytgz
@echo "Done."
%.html.tgz: $(images_jpg) $(chapters) $(appendices) $(scripts) \
$(license) html
@echo "Building HTML tgz version..."
-mkdir $*
-mkdir $*/images
cp -r $*.html scripts other $*/
cp -r images/*.gif images/*.jpg $*/images/
cat $*/$*.html | sed -e 's/http:\/\/iptables-tutorial.frozentux.net\/scripts\//scripts\//g' > \
$*/$*2.html
cat $*/$*2.html | sed -e 's/http:\/\/iptables-tutorial.frozentux.net\/other\//other\//g' > \
$*/$*.html
rm -f $*/$*2.html
tar -cf $*.html.tar $*
gzip -f $*.html.tar
mv $*.html.tar.gz $*.html.tgz
rm -rf $*
@echo "Done."
%.src.tgz: %.sgml
@echo "Building source ball"
tar -cf temp.tar iptables-tutorial.sgml scripts/* TODO \
ChangeLog Makefile spanish/* portuguese/* images/*.gif images/templates/* styles/* \
addons/* other/* licensing/* chapters/* \
appendices/* addons/* other/* bookinfo.sgml changes.sh README.md \
> /dev/null
gzip -f temp.tar
mv temp.tar.gz $*.src.tgz
@echo "Done."
%.html: $(images_jpg) $(chapters) $(appendices) $(scripts) \
$(license) %.sgml
@echo "Building HTML version..."
mkdir tmphtml; rsync -a . --exclude=tmphtml/ tmphtml;
$(foreach file, $(chapters) $(appendices), sed '/colwidth=".*"/d' $(file) > tmphtml/$(file);)
jw -d styles/html.dsl --backend html --nochunks tmphtml/$*.sgml
rm -rf tmphtml
@echo "Done."
chunkyhtml: $(images_jpg) $(chapters) $(appendices) $(scripts) \
$(license)
@echo "Building Chunky HTML version..."
rm -rf chunkyhtml
mkdir chunkyhtml
mkdir chunkyhtml/images
jw --backend html --output chunkyhtml -d styles/html.dsl \
iptables-tutorial.sgml
cp -r images/*.gif chunkyhtml/images/
cp -r images/*.jpg chunkyhtml/images/
cp -r other chunkyhtml/other
cp -r scripts chunkyhtml/scripts
@echo "Done."
%.pdf.gz : $(images_eps) $(chapters) $(appendices) $(scripts) \
$(license) %.sgml
@echo "Building PDF version..."
mkdir -p pdf/images; cp -R licensing scripts appendices \
chapters styles *.sgml pdf; cp -R images/*.eps pdf/images/; cd pdf; \
jw --backend pdf -d styles/print.dsl $*.sgml; cd ..
mv pdf/$*.pdf ./
rm -rf pdf
gzip -f $*.pdf
%.ps.gz : $(images_eps) $(chapters) $(appendices) $(scripts) \
$(license) %.sgml
@echo "Building PS version..."
mkdir -p ps/images; cp -R licensing scripts appendices chapters \
styles *.sgml ps; cp -R images/*.eps ps/images/; cd ps; jw \
--backend ps -d styles/print.dsl $*.sgml; cd ..
mv ps/$*.ps ./
rm -rf ps
gzip -f $*.ps
%.tex : %.sgml
jw --backend tex $*.sgml
images/%.jpg : images/%.gif
convert -resize 50% images/$*.gif images/$*.jpg
images/%.eps : images/%.gif
giftopnm images/$*.gif | pnmtopng -size "11811 11811 1" | convert - images/$*.eps
images/%.png : images/%.gif
giftopnm images/$*.gif | pnmtopng -size "11811 11811 1" > images/$*.png
.PHONY: dockerimage
dockerimage:
echo "User ${USER} userid $(shell id -u) groupid $(shell id -g)"
docker build --build-arg USERNAME=${USER} \
--build-arg USERID=$(shell id -u) \
--build-arg GROUPID=$(shell id -g) \
-t iptables-tutorial:latest build-env/
.PHONY: clean
clean:
rm -rf iptables-tutorial.html iptables-tutorial.ps.gz \
iptables-tutorial.pdf.gz iptables-tutorial.src.tgz *~ \
iptables-tutorial.html.tgz iptables-tutorial.chunky.tgz \
iptables-tutorial-index.sgml iptables-tutorial.chunky.tar.gz
rm -rf pdf/ chunkyhtml/ chunkytgz/
rm -rf images/*.jpg images/*.png images/*~ images/*.eps *.log *.aux \
*.out *.tex
rm -rf html/
cd portuguese; make clean
cd spanish; make clean
distrib: ps html
cp -a mirrors.html index.php iptables-tutorial.ps.gz \
iptables-tutorial.html $(OUTPATH)
cp -a scripts $(OUTPATH)
cp -a other $(OUTPATH)
cp -a images $(OUTPATH)