-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.sh
More file actions
151 lines (109 loc) · 4.93 KB
/
Makefile.sh
File metadata and controls
151 lines (109 loc) · 4.93 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# This is MakeFile is used to generate the documents for a generic UTD HPC system. The template
# is based off of Ganymede"s docs as of 9/23/2019. Firstly the we change directories to the
# ./GanymedeDocs-master directory. Once in that directory we call the sphinx-build MakeFile
# to generate the html. While much substituion is done by rst and sphinx in this step, sphinx doesn"t
# substitute many words in special formatting like bold, italics, and code blocks. To fix this
# problem, this MakeFile substitutes the words within the special formatted protions of the html.
stringOfRSTNames=' SPuppersysName-Training-v1.2.rst Connecting-To-SPuppersysName.rst Moving-Around-SPuppersysName.rst SPuppersysName-Compilers-And-Modules.rst Running-Jobs-On-SPuppersysName.rst SPuppersysName-Application-Specific-Instructions.rst SPuppersysName-Space-Constraints.rst Appendices.rst'
replaceAndCopyBaseRSTStatus=' '
sphinxSubSetupStatus=' '
arrayOfDerectives=( SRuppersysName SRsysName SRhostName SRnodecpunum SRnodememnum SRcentVer SRmatlabver SRmatlabsitenum SRmatlabdist SRdefcomp SRdefmpi SRadminemail SRmailinglistaddr SRslurmemail SRdebugnodenum SRhomequota SRhomemax SRhomerectime SRscratchquota SRscratchmax SRscratchrectime )
arrayOfHTMLDerective=( CBnetid CBsysname CBsysname CB4sys CBuserCompute CBuppersysname 'CBChapter5.4' 'CNChapter5.5.1' 'CNChapter5.5.5' 'CNChapter5.5.2' 'CNChapter5.5.3' )
# Sets Sphinx handled replacements
SRuppersysName="Ganymede"
SRsysName="ganymede"
SRhostName="@ganymede.utdallas.edu"
SRnodecpunum='4008'
SRnodememnum='14 TB'
SRcentVer='7.5'
SRmatlabver='r2018a'
SRmatlabsitenum='12,000'
SRmatlabdist='32'
SRdefcomp='\*\*Intel\*\*'
SRdefmpi='\*\*mvapich\*\*'
# Sets sphinx handled admin param replacements
SRadminemail='ganymedeadmins@utdallas.edu'
SRmailinglistaddr='ganymedeusers@lists.utdallas.edu'
SRslurmemail='slurm@ganymede.utdallas.edu'
SRdebugnodenum='2'
# Sets sphinx handled space limits replacements
SRhomequota='20 GB'
SRhomemax='30 GB'
SRhomerectime='7 Days'
SRscratchquota='None'
SRscratchmax='None'
SRscratchrectime='N/A'
# Here you can set the substitutions that sphinx won"t do these include system specific words within special formatting like codeblocks
CBnetId="jxw150830"
CBsysName="ganymede"
CBuserCompute="jxw150830"
SPuppersysName="Ganymede"
CBfourLetSysName="gany"
# Replaceable compute nodes
CNChaper54="compute-6-9-0"
CNChapter551="compute-6-9-35"
CNChapter552="compute-6-9-2"
CNChapter553="compute-7-6-4"
# A function used to set the substitutions sphinx didn't handle ***WARNING***: THIS FUNCTION
# ASSUMES IT IS WITHIN THE DIRECTORY /UTDSystemDocGenerator/GanymedeDoc/build MAKE SURE IT
# IS THERE.
nonSphinxSubs () {
for i; do
for j in "${arrayOfHTMLDerectives[@]}"; do
i="${i// \*\.rst/ \*\.html}"
echo "i = $i"
sed -i "s/$j/${!j}/g" $i
done
done
}
# A function used to set the sphinx handled substitutions ***WARNING***: THIS FUNCTION ASSUMES IT
#IS WITHIN THE DIRECTORY /UTDSystemDocGenerator/GanymedeDocs/source MAKE SURE IT IS THERE.
sphinxSubSetup () {
for i; do
for j in "${arrayOfDerectives[@]}"; do
sed -i "s/$j/${!j}/g" $i
done
done
}
# A function used to replace the names of BaseRST if they contain a replacement directive or just
#make a new copy of the file in the appropriate directory. ***WARNING***: THIS FUNCTION ASSUMES IT
#IS WITHIN THE DIRECTORY /UTDSystemDocGenerator/GanymedeDocs/source MAKE SURE IT IS THERE.
replaceAndCopyBaseRST () {
local oldNameHold=' '
for i; do
oldNameHold=${i}
i="${i//SPuppersysName/${SPuppersysName}}"
cp ../BaseRSTs/${oldNameHold} ${i}
printf " %s" "${i}"
done
}
# Moving to the GanymedeDocs-master subdirectory to change the toctree title then run sphinx-build
cd GanymedeDocs
# Moving torward index .rst to change toctree title
cd source
# Changing the CBuppersysname var to it's value then go out generate the sphinx-build then change it back to the var
sed -i "s/SPuppersysName/$(echo $SPuppersysName)/g" index.rst
replaceAndCopyBaseRSTStatus=$(replaceAndCopyBaseRST ${stringOfRSTNames})
sphinxSubSetupStatus=$(sphinxSubSetup${replaceAndCopyBaseRSTStatus})
cd ..
# Before generating the new htmls, the old ones are deleted
cd build
rm -i *.html
cd ..
# Running the sphinx-build command to build the html into the /build directory one level up
sphinx-build -b html ./source ./build
# Moving back to index.rst to change it back to var
cd source
# Deleting rst copies
echo 'Deleting RST copies...'
replaceAndCopyBaseRSTStatus=${replaceAndCopyBaseRSTStatus:1}
rm ${replaceAndCopyBaseRSTStatus}
# Changing SPuppersysname's value in the title back to the variable
sed -i "s/$(echo $SPuppersysName)/SPuppersysName/g" index.rst
# Moving back to build's parent directory
cd ..
# Going back to where the main html is stored and replacing the variables (now in build)
cd build
echo 'Performing HTML replacements...'
sphinxSubSetupSats=$(nonSphinxSubs ${stringOfRSTNames})
echo 'HTML replacements finished.'