| 1 |
greg |
1.1 |
#!/bin/csh -f |
| 2 |
greg |
1.30 |
# RCSid $Id: makeall,v 1.29 2018/05/30 14:14:55 greg 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 |
greg |
1.30 |
echo " or: makeall test" |
| 11 |
greg |
1.1 |
exit 1 |
| 12 |
|
|
endif |
| 13 |
|
|
if ( "$1" == library ) then |
| 14 |
|
|
source installib |
| 15 |
greg |
1.28 |
cp -f src/*/*.{cal,tab,hex,dat} $ldir |
| 16 |
greg |
1.1 |
echo "" |
| 17 |
|
|
echo "Set the environment variable RAYPATH=.:$ldir" |
| 18 |
|
|
echo 'For C-shell users, put the following into ~/.cshrc' |
| 19 |
|
|
echo " setenv RAYPATH .:$ldir" |
| 20 |
greg |
1.19 |
echo 'For Bourne shell users, put the following into $HOME/.profile' |
| 21 |
greg |
1.1 |
echo " RAYPATH=.:$ldir" |
| 22 |
|
|
echo " export RAYPATH" |
| 23 |
|
|
echo "" |
| 24 |
|
|
exit 0 |
| 25 |
|
|
endif |
| 26 |
greg |
1.30 |
if ( "$1" == test ) then |
| 27 |
|
|
cd test |
| 28 |
|
|
set fails=() |
| 29 |
|
|
foreach d (cal gen util px renders) |
| 30 |
|
|
cd $d |
| 31 |
|
|
make -k clean all && make clean |
| 32 |
|
|
if ($status) set fails=($fails $d) |
| 33 |
|
|
cd .. |
| 34 |
|
|
end |
| 35 |
|
|
if ($#fails) then |
| 36 |
|
|
echo "Unit tests failed in $#fails directories" |
| 37 |
|
|
echo "Run 'make' manually in test/ subfolders: $fails" |
| 38 |
|
|
exit 1 |
| 39 |
|
|
endif |
| 40 |
|
|
echo "All tests passed successfully." |
| 41 |
|
|
exit 0 |
| 42 |
|
|
endif |
| 43 |
greg |
1.16 |
set srcdirs=( common rt meta cv gen ot px hd util cal ) |
| 44 |
greg |
1.1 |
if ( "$1" == install ) then |
| 45 |
|
|
cat << _EOF_ |
| 46 |
|
|
|
| 47 |
|
|
`cat src/rt/VERSION` INSTALLATION |
| 48 |
|
|
|
| 49 |
|
|
This script rebuilds all of the Radiance programs and installs |
| 50 |
|
|
them on your system. You should read the file README before running |
| 51 |
|
|
this script. You can type ^C (followed by return) at any time to abort. |
| 52 |
|
|
|
| 53 |
|
|
You must first answer the following questions. |
| 54 |
|
|
|
| 55 |
|
|
_EOF_ |
| 56 |
|
|
if ( ! $?EDITOR ) then |
| 57 |
|
|
echo -n "What is your preferred editor [vi]? " |
| 58 |
|
|
set ans="$<" |
| 59 |
|
|
if ( "$ans" != "" ) then |
| 60 |
|
|
setenv EDITOR "$ans" |
| 61 |
|
|
else |
| 62 |
|
|
setenv EDITOR vi |
| 63 |
|
|
endif |
| 64 |
|
|
endif |
| 65 |
|
|
again1: |
| 66 |
|
|
echo -n "Where do you want the executables [/usr/local/bin]? " |
| 67 |
|
|
set idir=$< |
| 68 |
|
|
(echo $idir) >/dev/null |
| 69 |
greg |
1.4 |
if ( $status ) then |
| 70 |
|
|
goto again1 |
| 71 |
|
|
endif |
| 72 |
greg |
1.1 |
set idir=$idir |
| 73 |
|
|
if ( "$idir" == "" ) then |
| 74 |
|
|
set idir=/usr/local/bin |
| 75 |
|
|
else if ( "$idir" !~ /* ) then |
| 76 |
|
|
echo "Directory must be relative to root, please reenter" |
| 77 |
|
|
goto again1 |
| 78 |
|
|
endif |
| 79 |
|
|
if ( ! -d $idir ) then |
| 80 |
|
|
mkdir $idir |
| 81 |
|
|
if ( $status ) then |
| 82 |
|
|
echo "Cannot create directory, please reenter" |
| 83 |
|
|
goto again1 |
| 84 |
|
|
endif |
| 85 |
|
|
endif |
| 86 |
greg |
1.10 |
set inpath=0 |
| 87 |
|
|
foreach i ( $path ) |
| 88 |
|
|
if ( "$i" == "$idir" ) then |
| 89 |
|
|
set inpath=1 |
| 90 |
|
|
break |
| 91 |
|
|
endif |
| 92 |
|
|
end |
| 93 |
greg |
1.1 |
set rmake=$idir/rmake |
| 94 |
greg |
1.4 |
if ( "`ls -tL $rmake $0 |& head -1`" == $rmake ) then |
| 95 |
|
|
goto gotrmake |
| 96 |
|
|
endif |
| 97 |
greg |
1.1 |
set newrmake |
| 98 |
greg |
1.26 |
more License.txt |
| 99 |
greg |
1.1 |
echo -n "Do you understand and accept the terms of this agreement [n]? " |
| 100 |
|
|
set ans="$<" |
| 101 |
|
|
if ( "$ans" !~ [yY]* ) exit |
| 102 |
|
|
set special= |
| 103 |
|
|
set arch= |
| 104 |
|
|
set opt= |
| 105 |
|
|
set mach= |
| 106 |
|
|
set compat= |
| 107 |
|
|
set extras= |
| 108 |
schorsch |
1.9 |
set esuffix= |
| 109 |
greg |
1.1 |
cat << _EOF_ |
| 110 |
|
|
|
| 111 |
|
|
Please select your system type from the following list: |
| 112 |
|
|
|
| 113 |
|
|
1) Sun Solaris |
| 114 |
greg |
1.24 |
2) Linux |
| 115 |
|
|
3) MacOS X |
| 116 |
|
|
4) FreeBSD |
| 117 |
|
|
5) Cygwin |
| 118 |
|
|
6) Other |
| 119 |
greg |
1.1 |
|
| 120 |
|
|
_EOF_ |
| 121 |
|
|
echo -n "Choice? " |
| 122 |
|
|
set arch="$<" |
| 123 |
|
|
switch ("$arch") |
| 124 |
|
|
case 1: # SPARC Station |
| 125 |
|
|
set arch=sun |
| 126 |
greg |
1.4 |
set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO" |
| 127 |
greg |
1.20 |
set opt="-O" |
| 128 |
greg |
1.25 |
set compat="strcmp.o timegm.o" |
| 129 |
greg |
1.1 |
breaksw |
| 130 |
greg |
1.24 |
case 2: # Linux |
| 131 |
greg |
1.22 |
set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO" |
| 132 |
greg |
1.20 |
set opt="-O2" |
| 133 |
greg |
1.1 |
set arch=IBMPC |
| 134 |
greg |
1.29 |
set compat="strlcpy.o" |
| 135 |
greg |
1.1 |
set extras=CC=gcc |
| 136 |
|
|
breaksw |
| 137 |
greg |
1.24 |
case 3: # MacOS X |
| 138 |
schorsch |
1.9 |
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib" |
| 139 |
greg |
1.20 |
set opt="-O2" |
| 140 |
greg |
1.24 |
set arch=Intel |
| 141 |
|
|
set extras="CC=cc CONFIGURE_ARCH=i386" |
| 142 |
greg |
1.1 |
set special="ogl" |
| 143 |
schorsch |
1.9 |
breaksw |
| 144 |
greg |
1.24 |
case 4: # FreeBSD |
| 145 |
schorsch |
1.9 |
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib" |
| 146 |
greg |
1.20 |
set opt="-O" |
| 147 |
greg |
1.15 |
set compat="erf.o" |
| 148 |
greg |
1.18 |
set extras='CC=cc MLIB="-lcompat -lm"' |
| 149 |
greg |
1.1 |
set arch=IBMPC |
| 150 |
schorsch |
1.9 |
breaksw |
| 151 |
greg |
1.24 |
case 5: # Cygwin |
| 152 |
schorsch |
1.9 |
set mach="-Dfreebsd -L/usr/lib -L/usr/X11R6/lib -I/usr/include/X11 -I/usr/X11R6/include -DNOSTEREO" |
| 153 |
greg |
1.20 |
set opt="-O2" |
| 154 |
schorsch |
1.9 |
set arch=IBMPC |
| 155 |
greg |
1.29 |
set compat="erf.o strlcpy.o" |
| 156 |
schorsch |
1.9 |
set extras="CC=gcc" |
| 157 |
|
|
set special="ogl" |
| 158 |
|
|
set esuffix=".exe" |
| 159 |
|
|
breaksw |
| 160 |
greg |
1.24 |
case 6: # Other |
| 161 |
greg |
1.1 |
set opt="-O" |
| 162 |
greg |
1.29 |
set compat="erf.o strcmp.o strlcpy.o" |
| 163 |
greg |
1.1 |
echo -n "Are you using the GNU C compiler [n]? " |
| 164 |
|
|
if ( "$<" =~ [yY]* ) then |
| 165 |
|
|
set extras="CC=gcc" |
| 166 |
greg |
1.25 |
else |
| 167 |
|
|
set compat="$compat timegm.o" |
| 168 |
greg |
1.1 |
endif |
| 169 |
greg |
1.6 |
set arch=other |
| 170 |
greg |
1.1 |
breaksw |
| 171 |
|
|
default: |
| 172 |
|
|
echo "Illegal choice\!" |
| 173 |
|
|
echo "Installation aborted." |
| 174 |
|
|
exit 1 |
| 175 |
|
|
breaksw |
| 176 |
|
|
endsw |
| 177 |
|
|
source installib |
| 178 |
|
|
sed 's/[ ]*$//' > $rmake << _EOF_ |
| 179 |
|
|
#!/bin/sh |
| 180 |
|
|
exec make "SPECIAL=$special" \ |
| 181 |
|
|
"OPT=$opt" \ |
| 182 |
|
|
"MACH=$mach" \ |
| 183 |
|
|
ARCH=$arch "COMPAT=$compat" \ |
| 184 |
|
|
INSTDIR=$idir \ |
| 185 |
|
|
LIBDIR=$ldir \ |
| 186 |
schorsch |
1.9 |
ESUFFIX=$esuffix \ |
| 187 |
greg |
1.1 |
$extras "\$@" -f Rmakefile |
| 188 |
|
|
_EOF_ |
| 189 |
|
|
chmod 755 $rmake |
| 190 |
|
|
chmod 644 src/*/Rmakefile src/rt/devtable.c |
| 191 |
|
|
gotrmake: |
| 192 |
|
|
echo "Current rmake command is:" |
| 193 |
|
|
cat $rmake |
| 194 |
|
|
echo -n "Do you want to change it? " |
| 195 |
|
|
set ans="$<" |
| 196 |
|
|
if ( "$ans" =~ [yY]* ) then |
| 197 |
|
|
cp $rmake /tmp/rmake$$ |
| 198 |
|
|
$EDITOR $rmake |
| 199 |
|
|
if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake |
| 200 |
|
|
rm -f /tmp/rmake$$ |
| 201 |
|
|
endif |
| 202 |
|
|
if ( ! -d src/lib ) then |
| 203 |
|
|
mkdir src/lib |
| 204 |
|
|
endif |
| 205 |
|
|
if ( $?newrmake ) then |
| 206 |
|
|
echo 'New rmake command -- running "makeall clean"...' |
| 207 |
|
|
csh -f $0 clean |
| 208 |
|
|
endif |
| 209 |
|
|
cd src |
| 210 |
|
|
echo "Making programs..." |
| 211 |
|
|
set errs=0 |
| 212 |
|
|
foreach i ( $srcdirs ) |
| 213 |
|
|
pushd $i |
| 214 |
|
|
echo "In directory $i..." |
| 215 |
|
|
$rmake -k $* |
| 216 |
|
|
@ errs += $status |
| 217 |
|
|
popd |
| 218 |
|
|
end |
| 219 |
|
|
if ( $errs ) then |
| 220 |
|
|
echo "There were some errors." |
| 221 |
|
|
else |
| 222 |
|
|
echo "Done." |
| 223 |
|
|
endif |
| 224 |
|
|
cd .. |
| 225 |
greg |
1.10 |
if (! $inpath ) then |
| 226 |
|
|
echo "" |
| 227 |
|
|
echo "Add $idir to the beginning of your execution path:" |
| 228 |
|
|
echo 'For C-shell users, put the following into ~/.cshrc' |
| 229 |
|
|
echo " set path=( $idir "'$path )' |
| 230 |
greg |
1.19 |
echo 'For Bourne shell users, put the following into $HOME/.profile' |
| 231 |
greg |
1.10 |
echo " PATH=$idir"':$PATH' |
| 232 |
|
|
echo " export PATH" |
| 233 |
|
|
endif |
| 234 |
greg |
1.1 |
else |
| 235 |
|
|
cd src |
| 236 |
|
|
foreach i ( $srcdirs ) |
| 237 |
|
|
pushd $i |
| 238 |
|
|
echo "In directory $i..." |
| 239 |
|
|
make -f Rmakefile $* |
| 240 |
|
|
popd |
| 241 |
|
|
end |
| 242 |
|
|
cd .. |
| 243 |
|
|
foreach i ( $* ) |
| 244 |
|
|
if ( "$i" == clean ) then |
| 245 |
|
|
echo "Removing library archives..." |
| 246 |
greg |
1.17 |
rm -f src/lib/*.{a,o,la} |
| 247 |
greg |
1.1 |
endif |
| 248 |
|
|
end |
| 249 |
greg |
1.10 |
echo "Done." |
| 250 |
|
|
endif |
| 251 |
greg |
1.1 |
exit 0 |