3 echo "/*-------------------------------------------------------------------------"
4 echo " sdccbuild.sh - installation & build script for SDCC"
6 echo " Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999)"
8 echo " This program is free software; you can redistribute it and/or modify it"
9 echo " under the terms of the GNU General Public License as published by the"
10 echo " Free Software Foundation; either version 2, or (at your option) any"
11 echo " later version."
13 echo " This program is distributed in the hope that it will be useful,"
14 echo " but WITHOUT ANY WARRANTY; without even the implied warranty of"
15 echo " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
16 echo " GNU General Public License for more details."
18 echo " You should have received a copy of the GNU General Public License"
19 echo " along with this program; if not, write to the Free Software"
20 echo " Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
22 echo " In other words, you are welcome to use, share and improve this program."
23 echo " You are forbidden to forbid anyone else to use, share and improve"
24 echo " what you give them. Help stamp out software-hoarding! "
25 echo "-------------------------------------------------------------------------*/"
28 echo "This script will compile and build sdcc compiler system. Executables will"
29 echo "be placed in the directory '" $sdccdir"/bin' . Make sure you add this"
30 echo " directory to your PATH environment variable."
32 echo "Hit Enter to start the build process"
34 echo "----------------------------------------------------------" ;
35 echo " Building 'gc - a conservative garbage collector'" ;
36 echo "----------------------------------------------------------" ;
38 if test -d $sdccdir/gc;
40 # make -f Makefile clean
42 echo "----------------------------------------------------------" ;
43 echo " directory " $sdccdir/gc "not found . Script terminated";
44 echo "----------------------------------------------------------" ;
48 if make -f Makefile CC=gcc ;
50 echo "----------------------------------------------------------" ;
51 echo " gc - build successful" ;
52 echo "----------------------------------------------------------" ;
55 echo "----------------------------------------------------------" ;
56 echo " gc - build failed . Script terminated";
57 echo "----------------------------------------------------------" ;
61 echo "----------------------------------------------------------" ;
62 echo " Building 'cpp - c-preprocessor'" ;
63 echo "----------------------------------------------------------" ;
65 if test -d $sdccdir/cpp ;
66 then cd $sdccdir/cpp ;
69 echo "----------------------------------------------------------" ;
70 echo " directory " $sdccdir/cpp "not found . Script terminated";
71 echo "----------------------------------------------------------" ;
75 if make -f Makefile SDCCDIR=$sdccdir;
77 echo "----------------------------------------------------------" ;
78 echo " cpp - build successful" ;
79 echo "----------------------------------------------------------" ;
82 echo "----------------------------------------------------------" ;
83 echo " cpp - build failed . Script terminated";
84 echo "----------------------------------------------------------" ;
88 echo "----------------------------------------------------------" ;
89 echo " Building 'asx8051 - assembler'" ;
90 echo "----------------------------------------------------------" ;
92 if test -d $sdccdir/asxxxx ;
93 then cd $sdccdir/asxxxx ;
96 echo "----------------------------------------------------------" ;
97 echo " directory " $sdccdir/asxxxx "not found . Script terminated";
98 echo "----------------------------------------------------------" ;
102 if make -f Makefile.asx8051 SDCCDIR=$sdccdir ;
104 echo "----------------------------------------------------------" ;
105 echo " asx8051 - build successful" ;
106 echo "----------------------------------------------------------" ;
109 echo "----------------------------------------------------------" ;
110 echo " asx8051 - build failed . Script terminated";
111 echo "----------------------------------------------------------" ;
115 echo "----------------------------------------------------------" ;
116 echo " Building 'aslink - linkage editor' " ;
117 echo "----------------------------------------------------------" ;
119 if test -d $sdccdir/asxxxx ;
120 then cd $sdccdir/asxxxx ;
123 echo "----------------------------------------------------------" ;
124 echo " directory " $sdccdir/asxxxx "not found . Script terminated";
125 echo "----------------------------------------------------------" ;
129 if make -f Makefile.aslink SDCCDIR=$sdccdir ;
131 echo "----------------------------------------------------------" ;
132 echo " aslink - build successful" ;
133 echo "----------------------------------------------------------" ;
136 echo "----------------------------------------------------------" ;
137 echo " aslink - build failed . Script terminated";
138 echo "----------------------------------------------------------" ;
142 echo "----------------------------------------------------------" ;
143 echo " Building 'sdcc' "
144 echo "----------------------------------------------------------" ;
147 if test `uname` = "Linux";
149 ldflag="-Wl,-defsym,_DYNAMIC=0" ;
152 #make -f Makefile clean
153 if make -f Makefile SDCCDIR=$sdccdir STD_LIB="libsdcc" STD_INT_LIB="libint" STD_LONG_LIB="liblong" STD_FP_LIB="libfloat" LDXFLAGS=$ldflag
155 echo "----------------------------------------------------------" ;
156 echo " sdcc - build successful" ;
157 echo "----------------------------------------------------------" ;
159 echo "----------------------------------------------------------" ;
160 echo " sdcc - build failed . Script terminated";
161 echo "----------------------------------------------------------" ;
165 echo "----------------------------------------------------------" ;
166 echo " GREAT!! now we will use SDCC to compile the support rtns"
167 echo "----------------------------------------------------------" ;
169 echo "To compile the support routines type 'Large' or 'Small' or Control-c to quit"
172 lowersize=`echo $size | awk '{ printf("%s", tolower($0)) }'`
174 cd $sdccdir/sdcc51lib
177 if test `uname` = "MS-DOS";
182 PATH=$PATH$PATH_SEPARATOR$sdccdir/bin
184 if test $lowersize = "large";
186 echo "Compiling with the Large Model"
187 model="--model-large"
189 echo "Compiling with the Small Model"
190 model="--model-small"
195 echo "Compiling file " $i ;
196 sdcc -c $model -I$sdccdir/sdcc51inc $i ;
199 echo "Compiling file malloc.c"
200 sdcc -c $model malloc.c
202 echo "Compiling file serial.c"
203 sdcc -c $model serial.c
206 echo "----------------------------------------------------------" ;
207 echo " Important Directories & files"
208 echo " Header <...h> files directory " $sdccdir"/sdcc51inc"
209 echo " Library .lib files directory " $sdccdir"/sdcc51lib"
210 echo " SDCC support libraries are :-"
211 echo " " $sdccdir"/sdcc51lib/libsdcc.lib - basic support routines"
212 echo " " $sdccdir"/sdcc51lib/libint.lib - (16 bit) arithmetic "
213 echo " " $sdccdir"/sdcc51lib/liblong.lib - (32 bit) arithmetic "
214 echo " " $sdccdir"/sdcc51lib/libfloat.lib- floating point routines"
215 echo " DON'T FORGET to add " $sdccdir"/bin to your PATH environment"
216 echo "----------------------------------------------------------" ;