GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — rmake/rmake at master · IBIC/rmake

Expand file tree

/

rmake

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
234 lines (182 loc) · 5.79 KB
/

rmake

Copy path

File metadata and controls

executable file
·
234 lines (182 loc) · 5.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!/bin/bash
# Please set to 80 chars wide
user=$(whoami)
make_changes="
Options for the make call have been converted to lower case.
These are the changes (* = arg):
-I * include dir -> -a *
-B unconditional make -> -b
-L check symlink times -> -m
-W * consider always new -> -z *
X -C Ignored (no use)
X -f Disabled; we need symlinks named 'Makefile'
X -j/l Not useful; exit here.
X -r/R Built-in rules/variables aren't used in our applications, no reason to
disable them.
X -S Ignored, '-k' is never inherited in context.
"
usage() {
cat <<-EOF
This is the help file for rmake. To access make's help, use rmake -h.
Note rmake will automatically prepend 's' to IDs that start with a
number. qsub won't accept jobs that start with a number.
Options to rmake (* = arg):
-----------------
-C Print only the changes to flags to make
-D qsub recon; don't submit qsub job.
-H Print this help message and exit.
-M Debug; print arguments to make call. (No qsub submission.)
-N * Set job name; if not set, it will be set to target, then a
random name.
-O Save output/error files to qsub-[out|err] directories.
-P Append <date>_<time> to the jobid.
-Q * Choose which queue. If left unspecified, queue will be chosen
by qsub.
-S * Run qsub on these subjects only; if not set, run on all.
-T * Set the target for make.
Options to make:
----------------
${make_changes}
EOF
}
# List the flags for make that were modified (made lowercase for rmake)
make_changes(){
echo "${make_changes}"
}
# Send message to stderr
errcho(){
echo "${1}" >&2
}
### ACTUAL CODE ################################################################
# Run rmake without arguments, but warn user.
if [ ${#} -eq 0 ] ; then
errcho "No parameters supplied. Please set a target."
exit 1
fi
# Give a phony name, in case they run it without a target
name=$(pwgen 5 1)
# Find only in one and below; -L traverses symlinks
subjects=$(find -L . -mindepth 2 -maxdepth 2 -name 'Makefile' | \
sed -e 's|/Makefile||' -e 's|./||')
makeparam=
quit=
MAKETARGET=''
testmake=n
setdate=n
queue=
while getopts ":abde:hijklmno:pqstvwz:CDHMN:OPQ:S:T:" opt ; do
case ${opt} in
# Options to make
a) makeparam=${makeparam}" --include-dir=${OPTARG}" ;;
b) makeparam=${makeparam}" --always-make" ;;
d) makeparam=${makeparam}" --debug" ;;
e) makeparam=${makeparam}" --environment-overrides" ;;
h) make --help ; make_changes
exit 0 ;;
i) makeparam=${makeparam}" --ignore-errors" ;;
j|l) echo "You can't parallize make while using SGE!"
exit 1 ;;
k) makeparam=${makeparam}" --keep-going" ;;
m) makeparam=${makeparam}" --check-symlink-times" ;;
n) makeparam=${makeparam}" --recon" ;;
o) makeparam=${makeparam}" --old-file=${OPTARG}" ;;
p) makeparam=${makeparam}" --print-data-base" ;;
q) makeparam=${makeparam}" --question"
qset="yes" ;;
s) makeparam=${makeparam}" --silent" ;;
t) makeparam=${makeparam}" --touch" ;;
v) make --version
exit 0 ;;
w) make --print-directory
exit 0 ;;
z) makeparam=${makeparam}" --what-if=${OPTARG}" ;;
# Options to rmake
C) make_changes
exit 0 ;;
D) quit='-verify' ;;
H) usage
exit 0 ;;
M) testmake=y ;;
N) name=${OPTARG} ;;
O) oedirs=y ;;
P) setdate=y
date=$(date +%y%m%d-%H-%I) ;;
Q) queue="-q ${OPTARG}" ;;
S) subjects="${OPTARG}"
# Sanity check argument to subjects.
subjnum=$(echo ${subjects} | wc -w)
if [ ${subjnum} -eq 1 ] ; then
echo -en "\n!--- Only one argument to -S; ensure your" >&2
echo -e " argument is quoted. ---!\n" >&2
fi ;;
T) MAKETARGET="${OPTARG}"
name=$(echo ${OPTARG} | sed -e 's/[[:space:]]/,/g' -e 's|/|-|g' ) ;;
?) errcho \
"-${OPTARG} is not a valid rmake flag (or is missing an argument)."
usage
exit 11 ;;
esac
done
# Make sure directory is set up for recursive make, which our script relies on.
# Don't do this until after options are parsed (in case they're help).
if [ ! -f Makefile ] ; then
errcho
errcho "In order to run rmake, make needs to be able to run recursively."
errcho "Please set up a recursive makefile in ${PWD} named 'Makefile'."
errcho
exit 1
fi
# Conform whitespace; who knows what you're gonna get.
subjects=$(echo ${subjects} | tr '\n' ' ' | sed -e 's/[[:space:]]+/ /g')
echo "Subjects: ${subjects}"
# Wait until here to echo make flags so we get them all.
if [[ ${testmake} == y ]] ; then
echo make "<subj> TARGET=\"${MAKETARGET}\" ${makeparam}"
exit 0
fi
# Add the date to the job name if requested
if [[ ${setdate} == y ]] ; then
name=${name}.${date}
fi
# Submit subjects individually to SGE
for subj in ${subjects} ; do
# If the subject ID begins with a number, qsub will choke, so prepend with
# an 's' if necessary
prefix=
if [[ "${subj}" =~ ^[0-9] ]] ; then
echo "Adding s to subject ID."
prefix="s"
fi
if [[ ${oedirs} == y ]] ; then
# If output/error directories are requested, create them and add that
# option to the qsub command
mkdir -p q{out,err}.${prefix}${subj}.${user}
qsub ${quit} ${queue} -S /bin/bash <<-EOF
#SGE submission options
#$ -cwd
#$ -V
#$ -N ${prefix}${subj}.${name}
#$ -o qout.${prefix}${subj}.${user}
#$ -e qerr.${prefix}${subj}.${user}
make ${subj} TARGET="${MAKETARGET}" ${makeparam}
EOF
else
# If no output/error directories, submit this way
qsub ${quit} ${queue} -S /bin/bash <<-EOF
#SGE submission options
#$ -cwd
#$ -V
#$ -N ${prefix}${subj}.${name}
make ${subj} TARGET="${MAKETARGET}" ${makeparam}
EOF
fi
done
# List how many jobs were submitted
if [[ ${quit} != '-verify' ]] ; then
echo "$(echo ${subjects} | wc -w) jobs submitted."
fi
# Helpful warning
if [[ ${qset} == "yes" ]] ; then
echo -n "Warning: You set '-q', which runs no recipe."
echo "This is NOT equivalent to '-Q', which sets the queue."
fi
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.