ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/makeall
Revision: 1.26
Committed: Tue Oct 25 22:53:14 2011 UTC (12 years, 5 months ago) by greg
Branch: MAIN
CVS Tags: rad4R1
Changes since 1.25: +2 -2 lines
Log Message:
Added files needed by cmake

File Contents

# User Rev Content
1 greg 1.1 #!/bin/csh -f
2 greg 1.26 # RCSid $Id: makeall,v 1.25 2010/11/29 17:22:44 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.26 more License.txt
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.25 set compat="strcmp.o timegm.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 greg 1.25 else
156     set compat="$compat timegm.o"
157 greg 1.1 endif
158 greg 1.6 set arch=other
159 greg 1.1 breaksw
160     default:
161     echo "Illegal choice\!"
162     echo "Installation aborted."
163     exit 1
164     breaksw
165     endsw
166     source installib
167     sed 's/[ ]*$//' > $rmake << _EOF_
168     #!/bin/sh
169     exec make "SPECIAL=$special" \
170     "OPT=$opt" \
171     "MACH=$mach" \
172     ARCH=$arch "COMPAT=$compat" \
173     INSTDIR=$idir \
174     LIBDIR=$ldir \
175 schorsch 1.9 ESUFFIX=$esuffix \
176 greg 1.1 $extras "\$@" -f Rmakefile
177     _EOF_
178     chmod 755 $rmake
179     chmod 644 src/*/Rmakefile src/rt/devtable.c
180     gotrmake:
181     echo "Current rmake command is:"
182     cat $rmake
183     echo -n "Do you want to change it? "
184     set ans="$<"
185     if ( "$ans" =~ [yY]* ) then
186     cp $rmake /tmp/rmake$$
187     $EDITOR $rmake
188     if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake
189     rm -f /tmp/rmake$$
190     endif
191     if ( ! -d src/lib ) then
192     mkdir src/lib
193     endif
194     if ( $?newrmake ) then
195     echo 'New rmake command -- running "makeall clean"...'
196     csh -f $0 clean
197     endif
198     cd src
199     echo "Making programs..."
200     set errs=0
201     foreach i ( $srcdirs )
202     pushd $i
203     echo "In directory $i..."
204     $rmake -k $*
205     @ errs += $status
206     popd
207     end
208     if ( $errs ) then
209     echo "There were some errors."
210     else
211     echo "Done."
212     endif
213     cd ..
214 greg 1.10 if (! $inpath ) then
215     echo ""
216     echo "Add $idir to the beginning of your execution path:"
217     echo 'For C-shell users, put the following into ~/.cshrc'
218     echo " set path=( $idir "'$path )'
219 greg 1.19 echo 'For Bourne shell users, put the following into $HOME/.profile'
220 greg 1.10 echo " PATH=$idir"':$PATH'
221     echo " export PATH"
222     endif
223 greg 1.1 else
224     cd src
225     foreach i ( $srcdirs )
226     pushd $i
227     echo "In directory $i..."
228     make -f Rmakefile $*
229     popd
230     end
231     cd ..
232     foreach i ( $* )
233     if ( "$i" == clean ) then
234     echo "Removing library archives..."
235 greg 1.17 rm -f src/lib/*.{a,o,la}
236 greg 1.1 endif
237     end
238 greg 1.10 echo "Done."
239     endif
240 greg 1.1 exit 0