ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/makeall
Revision: 1.28
Committed: Fri Jun 29 16:18:02 2012 UTC (11 years, 7 months ago) by greg
Branch: MAIN
CVS Tags: rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R2P1
Changes since 1.27: +2 -2 lines
Log Message:
Added suffix to copy Perez files in "makeall library"

File Contents

# Content
1 #!/bin/csh -f
2 # RCSid $Id: makeall,v 1.27 2012/04/25 22:21:06 greg Exp $
3 #
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 cp -f src/*/*.{cal,tab,hex,dat} $ldir
15 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 rt meta cv gen ot 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 if ( $status ) then
52 goto again1
53 endif
54 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 set inpath=0
69 foreach i ( $path )
70 if ( "$i" == "$idir" ) then
71 set inpath=1
72 break
73 endif
74 end
75 set rmake=$idir/rmake
76 if ( "`ls -tL $rmake $0 |& head -1`" == $rmake ) then
77 goto gotrmake
78 endif
79 set newrmake
80 more License.txt
81 echo -n "Do you understand and accept the terms of this agreement [n]? "
82 set ans="$<"
83 if ( "$ans" !~ [yY]* ) exit
84 set special=
85 set arch=
86 set opt=
87 set mach=
88 set compat=
89 set extras=
90 set esuffix=
91 cat << _EOF_
92
93 Please select your system type from the following list:
94
95 1) Sun Solaris
96 2) Linux
97 3) MacOS X
98 4) FreeBSD
99 5) Cygwin
100 6) Other
101
102 _EOF_
103 echo -n "Choice? "
104 set arch="$<"
105 switch ("$arch")
106 case 1: # SPARC Station
107 set arch=sun
108 set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO"
109 set opt="-O"
110 set compat="strcmp.o timegm.o"
111 breaksw
112 case 2: # Linux
113 set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO"
114 set opt="-O2"
115 set arch=IBMPC
116 set compat="erf.o"
117 set extras=CC=gcc
118 breaksw
119 case 3: # MacOS X
120 set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
121 set opt="-O2"
122 set arch=Intel
123 set extras="CC=cc CONFIGURE_ARCH=i386"
124 set special="ogl"
125 breaksw
126 case 4: # FreeBSD
127 set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
128 set opt="-O"
129 set compat="erf.o"
130 set extras='CC=cc MLIB="-lcompat -lm"'
131 set arch=IBMPC
132 breaksw
133 case 5: # Cygwin
134 set mach="-Dfreebsd -L/usr/lib -L/usr/X11R6/lib -I/usr/include/X11 -I/usr/X11R6/include -DNOSTEREO"
135 set opt="-O2"
136 set arch=IBMPC
137 set compat="erf.o"
138 set extras="CC=gcc"
139 set special="ogl"
140 set esuffix=".exe"
141 breaksw
142 case 6: # Other
143 set opt="-O"
144 set compat="erf.o strcmp.o"
145 echo -n "Are you using the GNU C compiler [n]? "
146 if ( "$<" =~ [yY]* ) then
147 set extras="CC=gcc"
148 else
149 set compat="$compat timegm.o"
150 endif
151 set arch=other
152 breaksw
153 default:
154 echo "Illegal choice\!"
155 echo "Installation aborted."
156 exit 1
157 breaksw
158 endsw
159 source installib
160 sed 's/[ ]*$//' > $rmake << _EOF_
161 #!/bin/sh
162 exec make "SPECIAL=$special" \
163 "OPT=$opt" \
164 "MACH=$mach" \
165 ARCH=$arch "COMPAT=$compat" \
166 INSTDIR=$idir \
167 LIBDIR=$ldir \
168 ESUFFIX=$esuffix \
169 $extras "\$@" -f Rmakefile
170 _EOF_
171 chmod 755 $rmake
172 chmod 644 src/*/Rmakefile src/rt/devtable.c
173 gotrmake:
174 echo "Current rmake command is:"
175 cat $rmake
176 echo -n "Do you want to change it? "
177 set ans="$<"
178 if ( "$ans" =~ [yY]* ) then
179 cp $rmake /tmp/rmake$$
180 $EDITOR $rmake
181 if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake
182 rm -f /tmp/rmake$$
183 endif
184 if ( ! -d src/lib ) then
185 mkdir src/lib
186 endif
187 if ( $?newrmake ) then
188 echo 'New rmake command -- running "makeall clean"...'
189 csh -f $0 clean
190 endif
191 cd src
192 echo "Making programs..."
193 set errs=0
194 foreach i ( $srcdirs )
195 pushd $i
196 echo "In directory $i..."
197 $rmake -k $*
198 @ errs += $status
199 popd
200 end
201 if ( $errs ) then
202 echo "There were some errors."
203 else
204 echo "Done."
205 endif
206 cd ..
207 if (! $inpath ) then
208 echo ""
209 echo "Add $idir to the beginning of your execution path:"
210 echo 'For C-shell users, put the following into ~/.cshrc'
211 echo " set path=( $idir "'$path )'
212 echo 'For Bourne shell users, put the following into $HOME/.profile'
213 echo " PATH=$idir"':$PATH'
214 echo " export PATH"
215 endif
216 else
217 cd src
218 foreach i ( $srcdirs )
219 pushd $i
220 echo "In directory $i..."
221 make -f Rmakefile $*
222 popd
223 end
224 cd ..
225 foreach i ( $* )
226 if ( "$i" == clean ) then
227 echo "Removing library archives..."
228 rm -f src/lib/*.{a,o,la}
229 endif
230 end
231 echo "Done."
232 endif
233 exit 0