1 |
greg |
1.1 |
#!/bin/csh -f |
2 |
greg |
1.8 |
# RCSid $Id: makeall,v 1.7 2003/07/12 08:38:44 schorsch Exp $ |
3 |
greg |
1.1 |
# |
4 |
|
|
# Make all the Radiance programs |
5 |
|
|
# |
6 |
|
|
if ( $#argv < 1 ) then |
7 |
|
|
echo "Usage: makeall install [clean] [make options]" |
8 |
|
|
echo " or: makeall clean" |
9 |
|
|
echo " or: makeall library" |
10 |
|
|
exit 1 |
11 |
|
|
endif |
12 |
|
|
if ( "$1" == library ) then |
13 |
|
|
source installib |
14 |
greg |
1.8 |
cp -f src/*/*.{cal,tab,hex} $ldir |
15 |
greg |
1.1 |
echo "" |
16 |
|
|
echo "Set the environment variable RAYPATH=.:$ldir" |
17 |
|
|
echo 'For C-shell users, put the following into ~/.cshrc' |
18 |
|
|
echo " setenv RAYPATH .:$ldir" |
19 |
|
|
echo 'For Bourne shell users, put the following into $HOME/profile' |
20 |
|
|
echo " RAYPATH=.:$ldir" |
21 |
|
|
echo " export RAYPATH" |
22 |
|
|
echo "" |
23 |
|
|
exit 0 |
24 |
|
|
endif |
25 |
|
|
set srcdirs=( common meta cv gen ot rt px hd util cal ) |
26 |
|
|
if ( "$1" == install ) then |
27 |
|
|
cat << _EOF_ |
28 |
|
|
|
29 |
|
|
`cat src/rt/VERSION` INSTALLATION |
30 |
|
|
|
31 |
|
|
This script rebuilds all of the Radiance programs and installs |
32 |
|
|
them on your system. You should read the file README before running |
33 |
|
|
this script. You can type ^C (followed by return) at any time to abort. |
34 |
|
|
|
35 |
|
|
You must first answer the following questions. |
36 |
|
|
|
37 |
|
|
_EOF_ |
38 |
|
|
if ( ! $?EDITOR ) then |
39 |
|
|
echo -n "What is your preferred editor [vi]? " |
40 |
|
|
set ans="$<" |
41 |
|
|
if ( "$ans" != "" ) then |
42 |
|
|
setenv EDITOR "$ans" |
43 |
|
|
else |
44 |
|
|
setenv EDITOR vi |
45 |
|
|
endif |
46 |
|
|
endif |
47 |
|
|
again1: |
48 |
|
|
echo -n "Where do you want the executables [/usr/local/bin]? " |
49 |
|
|
set idir=$< |
50 |
|
|
(echo $idir) >/dev/null |
51 |
greg |
1.4 |
if ( $status ) then |
52 |
|
|
goto again1 |
53 |
|
|
endif |
54 |
greg |
1.1 |
set idir=$idir |
55 |
|
|
if ( "$idir" == "" ) then |
56 |
|
|
set idir=/usr/local/bin |
57 |
|
|
else if ( "$idir" !~ /* ) then |
58 |
|
|
echo "Directory must be relative to root, please reenter" |
59 |
|
|
goto again1 |
60 |
|
|
endif |
61 |
|
|
if ( ! -d $idir ) then |
62 |
|
|
mkdir $idir |
63 |
|
|
if ( $status ) then |
64 |
|
|
echo "Cannot create directory, please reenter" |
65 |
|
|
goto again1 |
66 |
|
|
endif |
67 |
|
|
endif |
68 |
|
|
if ( ! -d $idir/dev ) then |
69 |
|
|
mkdir $idir/dev |
70 |
|
|
if ( $status ) then |
71 |
|
|
echo "Cannot create subdirectory, please reenter" |
72 |
|
|
goto again1 |
73 |
|
|
endif |
74 |
|
|
endif |
75 |
|
|
set rmake=$idir/rmake |
76 |
greg |
1.4 |
if ( "`ls -tL $rmake $0 |& head -1`" == $rmake ) then |
77 |
|
|
goto gotrmake |
78 |
|
|
endif |
79 |
greg |
1.1 |
set newrmake |
80 |
|
|
goto skiplicense |
81 |
|
|
cat << _EOF_ |
82 |
|
|
|
83 |
|
|
RADIANCE LICENSE AGREEMENT |
84 |
|
|
|
85 |
|
|
Radiance is a registered copyright of The Regents of the University of |
86 |
|
|
California ("The Regents"). The Regents grant to you a nonexclusive, |
87 |
|
|
nontransferable license ("License") to use Radiance source code without |
88 |
|
|
fee. You may not sell or distribute Radiance to others without the |
89 |
|
|
prior express written permission of The Regents. You may compile and |
90 |
|
|
use this software on any machines to which you have personal access, |
91 |
|
|
and may share its use with others who have access to the same machines. |
92 |
|
|
|
93 |
|
|
NEITHER THE UNITED STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY |
94 |
|
|
OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY |
95 |
|
|
LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS |
96 |
|
|
OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS |
97 |
|
|
THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. By downloading, using |
98 |
|
|
or copying this software, you agree to abide by the intellectual property laws |
99 |
|
|
and all other applicable laws of the United States, and by the terms of this |
100 |
|
|
License Agreement. Ownership of the software shall remain solely in The |
101 |
|
|
Regents. The Regents shall have the right to terminate this License |
102 |
|
|
immediately by written notice upon your breach of, or noncompliance with, any |
103 |
|
|
of its terms. You shall be liable for any infringement or damages resulting |
104 |
|
|
from your failure to abide by the terms of this License Agreement. |
105 |
|
|
|
106 |
|
|
_EOF_ |
107 |
|
|
echo -n "Do you understand and accept the terms of this agreement [n]? " |
108 |
|
|
set ans="$<" |
109 |
|
|
if ( "$ans" !~ [yY]* ) exit |
110 |
|
|
echo -n "Are you a new Radiance user or with a new address [y]? " |
111 |
|
|
set ans="$<" |
112 |
|
|
if ( "$ans" !~ [nN]* ) then |
113 |
|
|
csh -f newuser |
114 |
|
|
else |
115 |
|
|
echo `cat src/rt/VERSION` compiled by `whoami` | mail [email protected] |
116 |
|
|
endif |
117 |
|
|
skiplicense: |
118 |
|
|
set special= |
119 |
|
|
set arch= |
120 |
|
|
set opt= |
121 |
|
|
set mach= |
122 |
|
|
set compat= |
123 |
|
|
set extras= |
124 |
|
|
cat << _EOF_ |
125 |
|
|
|
126 |
|
|
Please select your system type from the following list: |
127 |
|
|
|
128 |
|
|
1) Sun Solaris |
129 |
|
|
2) HP workstation |
130 |
|
|
3) Silicon Graphics |
131 |
|
|
4) AIX (RS/6000) |
132 |
|
|
5) BSDI BSD/386 |
133 |
|
|
6) Linux |
134 |
|
|
7) MacOS X |
135 |
|
|
8) FreeBSD |
136 |
|
|
9) Other |
137 |
|
|
|
138 |
|
|
_EOF_ |
139 |
|
|
echo -n "Choice? " |
140 |
|
|
set arch="$<" |
141 |
|
|
switch ("$arch") |
142 |
|
|
case 1: # SPARC Station |
143 |
|
|
set arch=sun |
144 |
greg |
1.4 |
set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO" |
145 |
|
|
set opt="-O -DSPEED=80" |
146 |
|
|
set compat="bmalloc.o strcmp.o getpagesize.o" |
147 |
greg |
1.1 |
breaksw |
148 |
|
|
case 2: # HP workstation |
149 |
|
|
set mach="" |
150 |
|
|
set opt="-O -DSPEED=80 -Aa -D_HPUX_SOURCE" |
151 |
greg |
1.3 |
set compat="bmalloc.o getpagesize.o strcmp.o" |
152 |
greg |
1.1 |
set arch=hpux |
153 |
|
|
breaksw |
154 |
|
|
case 3: # Silicon Graphics |
155 |
|
|
set arch=sgi |
156 |
|
|
switch (`uname -r`) |
157 |
|
|
case 3.*: |
158 |
|
|
set mach="-noprototypes" |
159 |
|
|
set opt="-O -DSPEED=80" |
160 |
|
|
set special="sgi" |
161 |
|
|
set compat="malloc.o strcmp.o" |
162 |
|
|
breaksw |
163 |
|
|
case 4.*: |
164 |
|
|
set mach="" |
165 |
|
|
set opt="-O2 -DSPEED=100" |
166 |
|
|
set compat="malloc.o strcmp.o" |
167 |
|
|
set extras='"MLIB=-lfastm -lm"' |
168 |
|
|
breaksw |
169 |
|
|
default: # 5.x or later |
170 |
|
|
ln -s `which wish` $idir/wish4.0 |
171 |
|
|
set path=($idir $path) |
172 |
|
|
set mach="-w" |
173 |
|
|
set opt="-O2 -DSPEED=200" |
174 |
|
|
set special="ogl" |
175 |
greg |
1.3 |
set compat="bmalloc.o strcmp.o" |
176 |
greg |
1.1 |
breaksw |
177 |
|
|
endsw |
178 |
|
|
breaksw |
179 |
|
|
case 4: # AIX |
180 |
|
|
set opt="-O" |
181 |
greg |
1.6 |
set compat="bmalloc.o erf.o strcmp.o" |
182 |
|
|
set arch=PowerPC |
183 |
greg |
1.1 |
breaksw |
184 |
|
|
case 5: # BSDI BSD/386 |
185 |
|
|
set mach="-DBSD -L/usr/X11/lib -I/usr/X11/include" |
186 |
|
|
set opt="-O -DSPEED=100" |
187 |
|
|
set arch=IBMPC |
188 |
|
|
set compat="malloc.o erf.o strcmp.o" |
189 |
|
|
breaksw |
190 |
|
|
case 6: # Linux |
191 |
schorsch |
1.7 |
set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO" |
192 |
greg |
1.1 |
set opt="-O2 -DSPEED=200" |
193 |
|
|
set arch=IBMPC |
194 |
|
|
set compat="bmalloc.o erf.o getpagesize.o" |
195 |
|
|
set extras=CC=gcc |
196 |
|
|
breaksw |
197 |
|
|
case 7: # MacOS X |
198 |
|
|
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib" |
199 |
|
|
set opt="-O2 -DSPEED=200" |
200 |
|
|
set arch=PowerPC |
201 |
|
|
set compat="bmalloc.o" |
202 |
|
|
set extras="CC=cc CONFIGURE_ARCH=powerpc" |
203 |
|
|
set special="ogl" |
204 |
|
|
breaksw |
205 |
|
|
case 8: # FreeBSD |
206 |
|
|
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib" |
207 |
|
|
set opt="-O -DSPEED=200" |
208 |
|
|
set compat="bmalloc.o erf.o" |
209 |
|
|
set extras="CC=cc" |
210 |
|
|
set arch=IBMPC |
211 |
|
|
breaksw |
212 |
|
|
case 9: # Other |
213 |
|
|
set opt="-O" |
214 |
|
|
set compat="bmalloc.o erf.o strcmp.o" |
215 |
|
|
echo -n "Are you using the GNU C compiler [n]? " |
216 |
|
|
if ( "$<" =~ [yY]* ) then |
217 |
|
|
set extras="CC=gcc" |
218 |
|
|
endif |
219 |
greg |
1.6 |
set arch=other |
220 |
greg |
1.1 |
breaksw |
221 |
|
|
default: |
222 |
|
|
echo "Illegal choice\!" |
223 |
|
|
echo "Installation aborted." |
224 |
|
|
exit 1 |
225 |
|
|
breaksw |
226 |
|
|
endsw |
227 |
|
|
source installib |
228 |
|
|
sed 's/[ ]*$//' > $rmake << _EOF_ |
229 |
|
|
#!/bin/sh |
230 |
|
|
exec make "SPECIAL=$special" \ |
231 |
|
|
"OPT=$opt" \ |
232 |
|
|
"MACH=$mach" \ |
233 |
|
|
ARCH=$arch "COMPAT=$compat" \ |
234 |
|
|
INSTDIR=$idir \ |
235 |
|
|
LIBDIR=$ldir \ |
236 |
|
|
$extras "\$@" -f Rmakefile |
237 |
|
|
_EOF_ |
238 |
|
|
chmod 755 $rmake |
239 |
|
|
chmod 644 src/*/Rmakefile src/rt/devtable.c |
240 |
|
|
gotrmake: |
241 |
|
|
echo "Current rmake command is:" |
242 |
|
|
cat $rmake |
243 |
|
|
echo -n "Do you want to change it? " |
244 |
|
|
set ans="$<" |
245 |
|
|
if ( "$ans" =~ [yY]* ) then |
246 |
|
|
cp $rmake /tmp/rmake$$ |
247 |
|
|
$EDITOR $rmake |
248 |
|
|
if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake |
249 |
|
|
rm -f /tmp/rmake$$ |
250 |
|
|
endif |
251 |
|
|
if ( ! -d src/lib ) then |
252 |
|
|
mkdir src/lib |
253 |
|
|
endif |
254 |
|
|
if ( $?newrmake ) then |
255 |
|
|
echo 'New rmake command -- running "makeall clean"...' |
256 |
|
|
csh -f $0 clean |
257 |
|
|
endif |
258 |
|
|
cd src |
259 |
|
|
echo "Making programs..." |
260 |
|
|
set errs=0 |
261 |
|
|
foreach i ( $srcdirs ) |
262 |
|
|
pushd $i |
263 |
|
|
echo "In directory $i..." |
264 |
|
|
$rmake -k $* |
265 |
|
|
@ errs += $status |
266 |
|
|
popd |
267 |
|
|
end |
268 |
|
|
if ( $errs ) then |
269 |
|
|
echo "There were some errors." |
270 |
|
|
else |
271 |
|
|
echo "Done." |
272 |
|
|
endif |
273 |
|
|
cd .. |
274 |
|
|
if (! -d /usr/tmp) then |
275 |
|
|
ln -s /tmp /usr/tmp |
276 |
|
|
if ($status) then |
277 |
|
|
echo "" |
278 |
|
|
echo "IMPORTANT: Execute 'sudo ln -s /tmp /usr/tmp'" |
279 |
|
|
echo "" |
280 |
|
|
endif |
281 |
|
|
endif |
282 |
|
|
else |
283 |
|
|
cd src |
284 |
|
|
foreach i ( $srcdirs ) |
285 |
|
|
pushd $i |
286 |
|
|
echo "In directory $i..." |
287 |
|
|
make -f Rmakefile $* |
288 |
|
|
popd |
289 |
|
|
end |
290 |
|
|
echo "Done." |
291 |
|
|
cd .. |
292 |
|
|
endif |
293 |
|
|
foreach i ( $* ) |
294 |
|
|
if ( "$i" == clean ) then |
295 |
|
|
echo "Removing library archives..." |
296 |
greg |
1.3 |
rm -f src/lib/*.[ao] |
297 |
greg |
1.1 |
endif |
298 |
|
|
end |
299 |
|
|
exit 0 |