Skip to content

Commit 89ae9f8

Browse files
author
Povilas Kanapickas
committed
Makefile: Move all built files to output/ directory
Previous contents of output/ are moved to output/reference
1 parent 205581f commit 89ae9f8

5 files changed

Lines changed: 63 additions & 60 deletions

File tree

Makefile

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2011, 2012 Povilas Kanapickas <tir5c3@yahoo.co.uk>
1+
# Copyright (C) 2011-2014 Povilas Kanapickas <povilas@radix.lt>
22
#
33
# This file is part of cppreference-doc
44
#
@@ -58,20 +58,10 @@ DISTFILES= \
5858
README
5959

6060
CLEANFILES= \
61-
output \
62-
images/output \
63-
cppreference-doc-en-c.devhelp2 \
64-
cppreference-doc-en-cpp.devhelp2 \
65-
cppreference-doc-en-c.qch \
66-
cppreference-doc-en-cpp.qch \
67-
qch-help-project-cpp.xml \
68-
qch-files.xml \
69-
devhelp-index-c.xml \
70-
devhelp-index-cpp.xml \
71-
link-map.xml
61+
output
7262

7363
clean:
74-
rm -rf $(CLEANFILES)
64+
rm -rf $(CLEANFILES)
7565

7666
check:
7767

@@ -83,73 +73,85 @@ dist: clean
8373

8474
install:
8575
# install the devhelp documentation
86-
pushd "output" > /dev/null; \
76+
pushd "output/reference" > /dev/null; \
8777
find . -type f \
8878
-exec install -DT -m 644 '{}' "$(DESTDIR)$(docdir)/html/{}" \; ; \
8979
popd > /dev/null
9080

91-
install -DT -m 644 cppreference-doc-en-c.devhelp2 \
81+
install -DT -m 644 "output/cppreference-doc-en-c.devhelp2" \
9282
"$(DESTDIR)$(bookdir)/cppreference-doc-en-c/cppreference-doc-en-c.devhelp2"
93-
install -DT -m 644 cppreference-doc-en-cpp.devhelp2 \
83+
install -DT -m 644 "output/cppreference-doc-en-cpp.devhelp2" \
9484
"$(DESTDIR)$(bookdir)/cppreference-doc-en-cpp/cppreference-doc-en-cpp.devhelp2"
9585

9686
# install the .qch (Qt Help) documentation
97-
install -DT -m 644 cppreference-doc-en-cpp.qch $(DESTDIR)$(docdir)/qch/cppreference-doc-en-cpp.qch
87+
install -DT -m 644 "output/cppreference-doc-en-cpp.qch" \
88+
"$(DESTDIR)$(docdir)/qch/cppreference-doc-en-cpp.qch"
9889

9990
uninstall:
10091
rm -rf "$(DESTDIR)$(docdir)"
10192
rm -rf "$(DESTDIR)$(bookdir)"
10293

10394
#WORKER RULES
95+
doc_html: output/reference
10496

105-
doc_devhelp: cppreference-doc-en-c.devhelp2 cppreference-doc-en-cpp.devhelp2
97+
doc_devhelp: output/cppreference-doc-en-c.devhelp2 output/cppreference-doc-en-cpp.devhelp2
10698

107-
doc_qch: cppreference-doc-en-cpp.qch
99+
doc_qch: output/cppreference-doc-en-cpp.qch
108100

109101
#builds the title<->location map
110-
link-map.xml: output
102+
output/link-map.xml: output/reference
111103
./build_link_map.py
112104

113105
#build the .devhelp2 index
114-
cppreference-doc-en-c.devhelp2: output link-map.xml
115-
./index2devhelp.py $(docdir)/html index-chapters-c.xml \
106+
output/cppreference-doc-en-c.devhelp2: \
107+
output/reference \
108+
output/link-map.xml
109+
./index2devhelp.py $(docdir)/html index-chapters-c.xml \
116110
"C Standard Library reference" "cppreference-doc-en-c" "c" \
117111
index-functions-c.xml devhelp-index-c.xml
118-
./fix_devhelp-links.py devhelp-index-c.xml cppreference-doc-en-c.devhelp2
112+
./fix_devhelp-links.py "output/devhelp-index-c.xml" \
113+
"output/cppreference-doc-en-c.devhelp2"
119114

120-
cppreference-doc-en-cpp.devhelp2: output link-map.xml
121-
./index2devhelp.py $(docdir)/html index-chapters-cpp.xml \
115+
output/cppreference-doc-en-cpp.devhelp2: \
116+
output/reference \
117+
output/link-map.xml
118+
./index2devhelp.py $(docdir)/html index-chapters-cpp.xml \
122119
"C++ Standard Library reference" "cppreference-doc-en-cpp" "cpp" \
123-
index-functions-cpp.xml devhelp-index-cpp.xml
124-
./fix_devhelp-links.py devhelp-index-cpp.xml cppreference-doc-en-cpp.devhelp2
120+
index-functions-cpp.xml "output/devhelp-index-cpp.xml"
121+
./fix_devhelp-links.py "output/devhelp-index-cpp.xml" \
122+
"output/cppreference-doc-en-cpp.devhelp2"
125123

126124
#build the .qch (QT help) file
127-
cppreference-doc-en-cpp.qch: qch-help-project-cpp.xml
125+
output/cppreference-doc-en-cpp.qch: output/qch-help-project-cpp.xml
128126
#qhelpgenerator only works if the project file is in the same directory as the documentation
129-
cp qch-help-project-cpp.xml output/qch.xml
127+
cp "output/qch-help-project-cpp.xml" "output/reference/qch.xml"
130128

131-
pushd "output" > /dev/null; \
132-
qhelpgenerator qch.xml -o "../cppreference-doc-en-cpp.qch"; \
129+
pushd "output/reference" > /dev/null; \
130+
qhelpgenerator "qch.xml" -o "../cppreference-doc-en-cpp.qch"; \
133131
popd > /dev/null
134132

135-
rm -f output/qch.xml
133+
rm -f "output/reference/qch.xml"
136134

137-
qch-help-project-cpp.xml: cppreference-doc-en-cpp.devhelp2
135+
output/qch-help-project-cpp.xml: output/cppreference-doc-en-cpp.devhelp2
138136
#build the file list
139-
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files>" > "qch-files.xml"
137+
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><files>" > "output/qch-files.xml"
140138

141-
pushd "output" > /dev/null; \
139+
pushd "output/reference" > /dev/null; \
142140
find . -type f -not -iname "*.ttf" \
143141
-exec echo "<file>"'{}'"</file>" >> "../qch-files.xml" \; ; \
144142
popd > /dev/null
145143

146-
echo "</files>" >> "qch-files.xml"
144+
echo "</files>" >> "output/qch-files.xml"
147145

148146
#create the project (copies the file list)
149-
xsltproc devhelp2qch.xsl cppreference-doc-en-cpp.devhelp2 > "qch-help-project-cpp.xml"
147+
xsltproc devhelp2qch.xsl "output/cppreference-doc-en-cpp.devhelp2" > \
148+
"output/qch-help-project-cpp.xml"
150149

151-
#create preprocessed archive
152150
output:
151+
mkdir -p output
152+
153+
#create preprocessed archive
154+
output/reference: output
153155
./preprocess.py
154156

155157
#redownloads the source documentation directly from en.cppreference.com

README

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ Note, that abovementioned documentation is still a raw copy of the website and
2222
needs to be transformed in order to be suitable for local viewing. Three
2323
documentation formats are currently supported:
2424

25-
1) Plain html documentation. Can be generated using `make output`. The result
26-
of the transformation will be placed at the 'output/' subdirectory.
25+
1) Plain html documentation. Can be generated using `make doc_html`. The
26+
result of the transformation will be placed at the 'output/reference'
27+
subdirectory.
2728

2829
2) Devhelp documentation format. Can be generated using `make doc_devhelp`.
2930
`make install` installs the documentation into proper locations.

build_link_map.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import os
2727

2828
# returns a dict { title -> filename }.
29-
# directory - either 'output' or 'reference'
29+
# directory - either 'output/reference' or 'reference'
3030
def build_link_map(directory):
3131
# find all html files
3232
html_files = []
@@ -57,7 +57,7 @@ def build_link_map(directory):
5757
return link_map
5858

5959
def main():
60-
link_map = build_link_map('output')
60+
link_map = build_link_map('output/reference')
6161

6262
# create an xml file containing mapping between page title and actual location
6363
root = e.Element('files')
@@ -67,7 +67,7 @@ def main():
6767
file_el.set('from', key)
6868
file_el.set('to', link_map[key])
6969

70-
out = open('link-map.xml', 'w')
70+
out = open('output/link-map.xml', 'w')
7171
out.write('<?xml version="1.0" encoding="UTF-8"?>')
7272
out.write(e.tostring(root, encoding=str, pretty_print=True))
7373
out.close()

devhelp2qch.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
</keywords>
6060

6161
<files>
62-
<xsl:copy-of select="document('qch-files.xml')/files/*"/>
62+
<xsl:copy-of select="document('output/qch-files.xml')/files/*"/>
6363
</files>
6464

6565
</filterSection>

preprocess.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,34 @@
2222
import os
2323

2424
# copy the source tree
25-
os.system('rm -rf output')
26-
os.system('mkdir output')
27-
os.system('cp -rt output reference/*')
25+
os.system('rm -rf output/reference')
26+
os.system('mkdir -p output/reference')
27+
os.system('cp -rt output/reference reference/*')
2828

29-
# rearrange the archive
29+
# rearrange the archive {root} here is output/reference
3030

3131
# before
32-
# output/en.cppreference.com/w/ : html
33-
# output/en.cppreference.com/mwiki/ : data
34-
# output/en.cppreference.com/ : data
32+
# {root}/en.cppreference.com/w/ : html
33+
# {root}/en.cppreference.com/mwiki/ : data
34+
# {root}/en.cppreference.com/ : data
3535
# ... (other languages)
36-
# output/upload.cppreference.com/mwiki/ : data
36+
# {root}/upload.cppreference.com/mwiki/ : data
3737

3838
# after
39-
# output/common/ : all data
40-
# output/en/ : html for en
39+
# {root}/common/ : all common data
40+
# {root}/en/ : html for en
4141
# ... (other languages)
4242

43-
data_path = "output/common"
43+
data_path = "output/reference/common"
4444
os.system('mkdir ' + data_path)
45-
os.system('mv output/upload.cppreference.com/mwiki/* ' + data_path)
46-
os.system('rm -r output/upload.cppreference.com/')
45+
os.system('mv output/reference/upload.cppreference.com/mwiki/* ' + data_path)
46+
os.system('rm -r output/reference/upload.cppreference.com/')
4747

4848
for lang in ["en"]:
49-
path = "output/" + lang + ".cppreference.com/"
49+
path = "output/reference/" + lang + ".cppreference.com/"
5050
src_html_path = path + "w/"
5151
src_data_path = path + "mwiki/"
52-
html_path = "output/" + lang
52+
html_path = "output/reference/" + lang
5353

5454
if (os.path.isdir(src_html_path)):
5555
os.system('mv ' + src_html_path + ' ' + html_path)
@@ -69,7 +69,7 @@
6969
# find all html and css files
7070
html_files = []
7171
css_files = []
72-
for root, dirnames, filenames in os.walk('output'):
72+
for root, dirnames, filenames in os.walk('output/reference/'):
7373
for filename in fnmatch.filter(filenames, '*.html'):
7474
html_files.append(os.path.join(root, filename))
7575
for filename in fnmatch.filter(filenames, '*.css'):

0 commit comments

Comments
 (0)