ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/makeall
Revision: 1.9
Committed: Sat Aug 30 08:22:47 2003 UTC (20 years, 7 months ago) by schorsch
Branch: MAIN
Changes since 1.8: +28 -16 lines
Log Message:
Added Cygwin build configuration (not fully functional yet).

File Contents

# User Rev Content
1 greg 1.1 #!/bin/csh -f
2 schorsch 1.9 # RCSid $Id: makeall,v 1.8 2003/07/17 15:31:26 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     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 schorsch 1.9 set esuffix=
125 greg 1.1 cat << _EOF_
126    
127     Please select your system type from the following list:
128    
129     1) Sun Solaris
130     2) HP workstation
131     3) Silicon Graphics
132     4) AIX (RS/6000)
133     5) BSDI BSD/386
134     6) Linux
135 schorsch 1.9 7) MacOS X
136 greg 1.1 8) FreeBSD
137 schorsch 1.9 9) Cygwin
138     10) Other
139 greg 1.1
140     _EOF_
141     echo -n "Choice? "
142     set arch="$<"
143     switch ("$arch")
144     case 1: # SPARC Station
145     set arch=sun
146 greg 1.4 set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO"
147     set opt="-O -DSPEED=80"
148     set compat="bmalloc.o strcmp.o getpagesize.o"
149 greg 1.1 breaksw
150     case 2: # HP workstation
151     set mach=""
152     set opt="-O -DSPEED=80 -Aa -D_HPUX_SOURCE"
153 greg 1.3 set compat="bmalloc.o getpagesize.o strcmp.o"
154 greg 1.1 set arch=hpux
155     breaksw
156     case 3: # Silicon Graphics
157     set arch=sgi
158     switch (`uname -r`)
159     case 3.*:
160     set mach="-noprototypes"
161     set opt="-O -DSPEED=80"
162     set special="sgi"
163     set compat="malloc.o strcmp.o"
164     breaksw
165     case 4.*:
166     set mach=""
167     set opt="-O2 -DSPEED=100"
168     set compat="malloc.o strcmp.o"
169     set extras='"MLIB=-lfastm -lm"'
170     breaksw
171     default: # 5.x or later
172     ln -s `which wish` $idir/wish4.0
173     set path=($idir $path)
174     set mach="-w"
175     set opt="-O2 -DSPEED=200"
176     set special="ogl"
177 greg 1.3 set compat="bmalloc.o strcmp.o"
178 greg 1.1 breaksw
179     endsw
180     breaksw
181     case 4: # AIX
182     set opt="-O"
183 greg 1.6 set compat="bmalloc.o erf.o strcmp.o"
184     set arch=PowerPC
185 greg 1.1 breaksw
186     case 5: # BSDI BSD/386
187     set mach="-DBSD -L/usr/X11/lib -I/usr/X11/include"
188     set opt="-O -DSPEED=100"
189     set arch=IBMPC
190     set compat="malloc.o erf.o strcmp.o"
191     breaksw
192     case 6: # Linux
193 schorsch 1.7 set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO"
194 greg 1.1 set opt="-O2 -DSPEED=200"
195     set arch=IBMPC
196     set compat="bmalloc.o erf.o getpagesize.o"
197     set extras=CC=gcc
198     breaksw
199 schorsch 1.9 case 7: # MacOS X
200     set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
201     set opt="-O2 -DSPEED=200"
202     set arch=PowerPC
203     set compat="bmalloc.o"
204     set extras="CC=cc CONFIGURE_ARCH=powerpc"
205 greg 1.1 set special="ogl"
206 schorsch 1.9 breaksw
207 greg 1.1 case 8: # FreeBSD
208 schorsch 1.9 set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
209     set opt="-O -DSPEED=200"
210     set compat="bmalloc.o erf.o"
211     set extras="CC=cc"
212 greg 1.1 set arch=IBMPC
213 schorsch 1.9 breaksw
214     case 9: # Cygwin
215     set mach="-Dfreebsd -L/usr/lib -L/usr/X11R6/lib -I/usr/include/X11 -I/usr/X11R6/include -DNOSTEREO"
216     set opt="-O2 -DSPEED=200"
217     set arch=IBMPC
218     set compat="bmalloc.o erf.o getpagesize.o"
219     set extras="CC=gcc"
220     set special="ogl"
221     set esuffix=".exe"
222     breaksw
223     case 10: # Other
224 greg 1.1 set opt="-O"
225     set compat="bmalloc.o erf.o strcmp.o"
226     echo -n "Are you using the GNU C compiler [n]? "
227     if ( "$<" =~ [yY]* ) then
228     set extras="CC=gcc"
229     endif
230 greg 1.6 set arch=other
231 greg 1.1 breaksw
232     default:
233     echo "Illegal choice\!"
234     echo "Installation aborted."
235     exit 1
236     breaksw
237     endsw
238     source installib
239     sed 's/[ ]*$//' > $rmake << _EOF_
240     #!/bin/sh
241     exec make "SPECIAL=$special" \
242     "OPT=$opt" \
243     "MACH=$mach" \
244     ARCH=$arch "COMPAT=$compat" \
245     INSTDIR=$idir \
246     LIBDIR=$ldir \
247 schorsch 1.9 ESUFFIX=$esuffix \
248 greg 1.1 $extras "\$@" -f Rmakefile
249     _EOF_
250     chmod 755 $rmake
251     chmod 644 src/*/Rmakefile src/rt/devtable.c
252     gotrmake:
253     echo "Current rmake command is:"
254     cat $rmake
255     echo -n "Do you want to change it? "
256     set ans="$<"
257     if ( "$ans" =~ [yY]* ) then
258     cp $rmake /tmp/rmake$$
259     $EDITOR $rmake
260     if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake
261     rm -f /tmp/rmake$$
262     endif
263     if ( ! -d src/lib ) then
264     mkdir src/lib
265     endif
266     if ( $?newrmake ) then
267     echo 'New rmake command -- running "makeall clean"...'
268     csh -f $0 clean
269     endif
270     cd src
271     echo "Making programs..."
272     set errs=0
273     foreach i ( $srcdirs )
274     pushd $i
275     echo "In directory $i..."
276     $rmake -k $*
277     @ errs += $status
278     popd
279     end
280     if ( $errs ) then
281     echo "There were some errors."
282     else
283     echo "Done."
284     endif
285     cd ..
286     if (! -d /usr/tmp) then
287     ln -s /tmp /usr/tmp
288     if ($status) then
289     echo ""
290     echo "IMPORTANT: Execute 'sudo ln -s /tmp /usr/tmp'"
291     echo ""
292     endif
293     endif
294     else
295     cd src
296     foreach i ( $srcdirs )
297     pushd $i
298     echo "In directory $i..."
299     make -f Rmakefile $*
300     popd
301     end
302     echo "Done."
303     cd ..
304     endif
305     foreach i ( $* )
306     if ( "$i" == clean ) then
307     echo "Removing library archives..."
308 greg 1.3 rm -f src/lib/*.[ao]
309 greg 1.1 endif
310     end
311     exit 0