ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/makeall
Revision: 1.24
Committed: Sat Oct 31 22:29:06 2009 UTC (15 years ago) by greg
Branch: MAIN
CVS Tags: rad4R0
Changes since 1.23: +13 -61 lines
Log Message:
Removed outdated operating systems and updated OS X entry

File Contents

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