-
Notifications
You must be signed in to change notification settings - Fork 10
/
makeall
executable file
·233 lines (226 loc) · 5 KB
/
makeall
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
#!/bin/csh -f
# RCSid $Id: makeall,v 1.29 2018/05/30 14:14:55 greg Exp $
#
# Make all the Radiance programs
#
if ( $#argv < 1 ) then
echo "Usage: makeall install [clean] [make options]"
echo " or: makeall clean"
echo " or: makeall library"
exit 1
endif
if ( "$1" == library ) then
source installib
cp -f src/*/*.{cal,tab,hex,dat} $ldir
echo ""
echo "Set the environment variable RAYPATH=.:$ldir"
echo 'For C-shell users, put the following into ~/.cshrc'
echo " setenv RAYPATH .:$ldir"
echo 'For Bourne shell users, put the following into $HOME/.profile'
echo " RAYPATH=.:$ldir"
echo " export RAYPATH"
echo ""
exit 0
endif
set srcdirs=( common rt meta cv gen ot px hd util cal )
if ( "$1" == install ) then
cat << _EOF_
`cat src/rt/VERSION` INSTALLATION
This script rebuilds all of the Radiance programs and installs
them on your system. You should read the file README before running
this script. You can type ^C (followed by return) at any time to abort.
You must first answer the following questions.
_EOF_
if ( ! $?EDITOR ) then
echo -n "What is your preferred editor [vi]? "
set ans="$<"
if ( "$ans" != "" ) then
setenv EDITOR "$ans"
else
setenv EDITOR vi
endif
endif
again1:
echo -n "Where do you want the executables [/usr/local/bin]? "
set idir=$<
(echo $idir) >/dev/null
if ( $status ) then
goto again1
endif
set idir=$idir
if ( "$idir" == "" ) then
set idir=/usr/local/bin
else if ( "$idir" !~ /* ) then
echo "Directory must be relative to root, please reenter"
goto again1
endif
if ( ! -d $idir ) then
mkdir $idir
if ( $status ) then
echo "Cannot create directory, please reenter"
goto again1
endif
endif
set inpath=0
foreach i ( $path )
if ( "$i" == "$idir" ) then
set inpath=1
break
endif
end
set rmake=$idir/rmake
if ( "`ls -tL $rmake $0 |& head -1`" == $rmake ) then
goto gotrmake
endif
set newrmake
more License.txt
echo -n "Do you understand and accept the terms of this agreement [n]? "
set ans="$<"
if ( "$ans" !~ [yY]* ) exit
set special=
set arch=
set opt=
set mach=
set compat=
set extras=
set esuffix=
cat << _EOF_
Please select your system type from the following list:
1) Sun Solaris
2) Linux
3) MacOS X
4) FreeBSD
5) Cygwin
6) Other
_EOF_
echo -n "Choice? "
set arch="$<"
switch ("$arch")
case 1: # SPARC Station
set arch=sun
set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO"
set opt="-O"
set compat="strcmp.o timegm.o"
breaksw
case 2: # Linux
set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO"
set opt="-O2"
set arch=IBMPC
set compat="strlcpy.o"
set extras=CC=gcc
breaksw
case 3: # MacOS X
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
set opt="-O2"
set arch=Intel
set extras="CC=cc CONFIGURE_ARCH=i386"
set special="ogl"
breaksw
case 4: # FreeBSD
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
set opt="-O"
set compat="erf.o"
set extras='CC=cc MLIB="-lcompat -lm"'
set arch=IBMPC
breaksw
case 5: # Cygwin
set mach="-Dfreebsd -L/usr/lib -L/usr/X11R6/lib -I/usr/include/X11 -I/usr/X11R6/include -DNOSTEREO"
set opt="-O2"
set arch=IBMPC
set compat="erf.o strlcpy.o"
set extras="CC=gcc"
set special="ogl"
set esuffix=".exe"
breaksw
case 6: # Other
set opt="-O"
set compat="erf.o strcmp.o strlcpy.o"
echo -n "Are you using the GNU C compiler [n]? "
if ( "$<" =~ [yY]* ) then
set extras="CC=gcc"
else
set compat="$compat timegm.o"
endif
set arch=other
breaksw
default:
echo "Illegal choice\!"
echo "Installation aborted."
exit 1
breaksw
endsw
source installib
sed 's/[ ]*$//' > $rmake << _EOF_
#!/bin/sh
exec make "SPECIAL=$special" \
"OPT=$opt" \
"MACH=$mach" \
ARCH=$arch "COMPAT=$compat" \
INSTDIR=$idir \
LIBDIR=$ldir \
ESUFFIX=$esuffix \
$extras "\$@" -f Rmakefile
_EOF_
chmod 755 $rmake
chmod 644 src/*/Rmakefile src/rt/devtable.c
gotrmake:
echo "Current rmake command is:"
cat $rmake
echo -n "Do you want to change it? "
set ans="$<"
if ( "$ans" =~ [yY]* ) then
cp $rmake /tmp/rmake$$
$EDITOR $rmake
if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake
rm -f /tmp/rmake$$
endif
if ( ! -d src/lib ) then
mkdir src/lib
endif
if ( $?newrmake ) then
echo 'New rmake command -- running "makeall clean"...'
csh -f $0 clean
endif
cd src
echo "Making programs..."
set errs=0
foreach i ( $srcdirs )
pushd $i
echo "In directory $i..."
$rmake -k $*
@ errs += $status
popd
end
if ( $errs ) then
echo "There were some errors."
else
echo "Done."
endif
cd ..
if (! $inpath ) then
echo ""
echo "Add $idir to the beginning of your execution path:"
echo 'For C-shell users, put the following into ~/.cshrc'
echo " set path=( $idir "'$path )'
echo 'For Bourne shell users, put the following into $HOME/.profile'
echo " PATH=$idir"':$PATH'
echo " export PATH"
endif
else
cd src
foreach i ( $srcdirs )
pushd $i
echo "In directory $i..."
make -f Rmakefile $*
popd
end
cd ..
foreach i ( $* )
if ( "$i" == clean ) then
echo "Removing library archives..."
rm -f src/lib/*.{a,o,la}
endif
end
echo "Done."
endif
exit 0