ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/makeall
Revision: 1.27
Committed: Wed Apr 25 22:21:06 2012 UTC (11 years, 11 months ago) by greg
Branch: MAIN
Changes since 1.26: +1 -8 lines
Log Message:
Changes to support new Cmake build system

File Contents

# User Rev Content
1 greg 1.1 #!/bin/csh -f
2 greg 1.27 # RCSid $Id: makeall,v 1.26 2011/10/25 22:53:14 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 greg 1.10 set inpath=0
69     foreach i ( $path )
70     if ( "$i" == "$idir" ) then
71     set inpath=1
72     break
73     endif
74     end
75 greg 1.1 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 greg 1.26 more License.txt
81 greg 1.1 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 schorsch 1.9 set esuffix=
91 greg 1.1 cat << _EOF_
92    
93     Please select your system type from the following list:
94    
95     1) Sun Solaris
96 greg 1.24 2) Linux
97     3) MacOS X
98     4) FreeBSD
99     5) Cygwin
100     6) Other
101 greg 1.1
102     _EOF_
103     echo -n "Choice? "
104     set arch="$<"
105     switch ("$arch")
106     case 1: # SPARC Station
107     set arch=sun
108 greg 1.4 set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO"
109 greg 1.20 set opt="-O"
110 greg 1.25 set compat="strcmp.o timegm.o"
111 greg 1.1 breaksw
112 greg 1.24 case 2: # Linux
113 greg 1.22 set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO"
114 greg 1.20 set opt="-O2"
115 greg 1.1 set arch=IBMPC
116 greg 1.15 set compat="erf.o"
117 greg 1.1 set extras=CC=gcc
118     breaksw
119 greg 1.24 case 3: # MacOS X
120 schorsch 1.9 set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
121 greg 1.20 set opt="-O2"
122 greg 1.24 set arch=Intel
123     set extras="CC=cc CONFIGURE_ARCH=i386"
124 greg 1.1 set special="ogl"
125 schorsch 1.9 breaksw
126 greg 1.24 case 4: # FreeBSD
127 schorsch 1.9 set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
128 greg 1.20 set opt="-O"
129 greg 1.15 set compat="erf.o"
130 greg 1.18 set extras='CC=cc MLIB="-lcompat -lm"'
131 greg 1.1 set arch=IBMPC
132 schorsch 1.9 breaksw
133 greg 1.24 case 5: # Cygwin
134 schorsch 1.9 set mach="-Dfreebsd -L/usr/lib -L/usr/X11R6/lib -I/usr/include/X11 -I/usr/X11R6/include -DNOSTEREO"
135 greg 1.20 set opt="-O2"
136 schorsch 1.9 set arch=IBMPC
137 greg 1.15 set compat="erf.o"
138 schorsch 1.9 set extras="CC=gcc"
139     set special="ogl"
140     set esuffix=".exe"
141     breaksw
142 greg 1.24 case 6: # Other
143 greg 1.1 set opt="-O"
144 greg 1.15 set compat="erf.o strcmp.o"
145 greg 1.1 echo -n "Are you using the GNU C compiler [n]? "
146     if ( "$<" =~ [yY]* ) then
147     set extras="CC=gcc"
148 greg 1.25 else
149     set compat="$compat timegm.o"
150 greg 1.1 endif
151 greg 1.6 set arch=other
152 greg 1.1 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 schorsch 1.9 ESUFFIX=$esuffix \
169 greg 1.1 $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 greg 1.10 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 greg 1.19 echo 'For Bourne shell users, put the following into $HOME/.profile'
213 greg 1.10 echo " PATH=$idir"':$PATH'
214     echo " export PATH"
215     endif
216 greg 1.1 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 greg 1.17 rm -f src/lib/*.{a,o,la}
229 greg 1.1 endif
230     end
231 greg 1.10 echo "Done."
232     endif
233 greg 1.1 exit 0