more precise noOverLap
[fw/sdcc] / sdccbuild.sh
1 #
2 sdccdir=$PWD
3 echo "/*-------------------------------------------------------------------------"
4 echo "  sdccbuild.sh - installation & build script for SDCC"
5 echo
6 echo "            Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1999)"
7 echo 
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."
12 echo   
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."
17 echo   
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."
21 echo   
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 "-------------------------------------------------------------------------*/"
26 echo
27 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."
31 echo 
32 echo "Hit Enter to start the build process"
33 read junk
34 echo "----------------------------------------------------------" ;
35 echo "      Building 'gc - a conservative garbage collector'"     ;
36 echo "----------------------------------------------------------" ;
37
38 if test -d $sdccdir/gc; 
39     then cd $sdccdir/gc ;
40 #        make -f Makefile clean
41     else
42         echo "----------------------------------------------------------" ;
43         echo "  directory " $sdccdir/gc "not found . Script terminated";
44         echo "----------------------------------------------------------" ;
45         exit 1;
46 fi
47
48 if make -f Makefile CC=gcc ;
49     then
50         echo "----------------------------------------------------------" ;
51         echo "               gc - build successful" ;
52         echo "----------------------------------------------------------" ;
53
54     else
55         echo "----------------------------------------------------------" ;    
56         echo "        gc - build failed . Script terminated";
57         echo "----------------------------------------------------------" ;
58         exit 1;
59 fi
60
61 echo "----------------------------------------------------------" ;
62 echo "                Building 'cpp - c-preprocessor'" ;
63 echo "----------------------------------------------------------" ;
64
65 if test -d $sdccdir/cpp ;
66     then cd $sdccdir/cpp ;
67 #         rm *.o ;
68     else
69         echo "----------------------------------------------------------" ;
70         echo "  directory " $sdccdir/cpp "not found . Script terminated";
71         echo "----------------------------------------------------------" ;
72         exit 1;
73 fi        
74
75 if make -f Makefile SDCCDIR=$sdccdir; 
76     then
77         echo "----------------------------------------------------------" ;
78         echo "               cpp - build successful" ;
79         echo "----------------------------------------------------------" ;
80
81     else
82         echo "----------------------------------------------------------" ;    
83         echo "        cpp - build failed . Script terminated";
84         echo "----------------------------------------------------------" ;
85         exit 1;
86 fi
87
88 echo "----------------------------------------------------------" ;
89 echo "               Building 'asx8051 - assembler'" ;
90 echo "----------------------------------------------------------" ;
91
92 if test -d $sdccdir/asxxxx ;
93     then cd $sdccdir/asxxxx ;
94 #         rm *.o ;
95     else
96         echo "----------------------------------------------------------" ;
97         echo "  directory " $sdccdir/asxxxx "not found . Script terminated";
98         echo "----------------------------------------------------------" ;
99         exit 1;
100 fi
101
102 if make -f Makefile.asx8051 SDCCDIR=$sdccdir ;
103     then
104         echo "----------------------------------------------------------" ;
105         echo "               asx8051 - build successful" ;
106         echo "----------------------------------------------------------" ;
107
108     else
109         echo "----------------------------------------------------------" ;    
110         echo "        asx8051 - build failed . Script terminated";
111         echo "----------------------------------------------------------" ;
112         exit 1;
113 fi
114
115 echo "----------------------------------------------------------" ;
116 echo "           Building 'aslink - linkage editor' " ;
117 echo "----------------------------------------------------------" ;
118
119 if test -d $sdccdir/asxxxx ;
120     then cd $sdccdir/asxxxx ;
121 #         rm *.o ;
122     else
123         echo "----------------------------------------------------------" ;
124         echo "  directory " $sdccdir/asxxxx "not found . Script terminated";
125         echo "----------------------------------------------------------" ;
126         exit 1;
127 fi
128
129 if make -f Makefile.aslink SDCCDIR=$sdccdir ;
130     then
131         echo "----------------------------------------------------------" ;
132         echo "               aslink - build successful" ;
133         echo "----------------------------------------------------------" ;
134
135     else
136         echo "----------------------------------------------------------" ;    
137         echo "        aslink - build failed . Script terminated";
138         echo "----------------------------------------------------------" ;
139         exit 1;
140 fi
141
142 echo "----------------------------------------------------------" ;
143 echo "                      Building 'sdcc' " 
144 echo "----------------------------------------------------------" ;
145
146 cd $sdccdir
147 if test `uname` = "Linux"; 
148     then
149         ldflag="-Wl,-defsym,_DYNAMIC=0" ;
150 fi
151
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
154     then 
155         echo "----------------------------------------------------------" ;
156         echo "               sdcc - build successful" ;
157         echo "----------------------------------------------------------" ;
158     else
159         echo "----------------------------------------------------------" ;    
160         echo "        sdcc - build failed . Script terminated";
161         echo "----------------------------------------------------------" ;
162         exit 1;
163 fi
164
165 echo "----------------------------------------------------------" ;    
166 echo " GREAT!! now we will use SDCC to compile the support rtns"
167 echo "----------------------------------------------------------" ;    
168
169 echo "To compile the support routines type 'Large' or 'Small' or Control-c to quit"
170 read size
171
172 lowersize=`echo $size | awk '{ printf("%s", tolower($0)) }'`
173
174 cd $sdccdir/sdcc51lib
175
176 PATH_SEPARATOR=":"
177 if test `uname` = "MS-DOS";
178     then
179         PATH_SEPARATOR=";"
180 fi
181
182 PATH=$PATH$PATH_SEPARATOR$sdccdir/bin
183
184 if test $lowersize = "large"; 
185 then 
186   echo "Compiling with the Large Model"
187   model="--model-large"
188 else
189   echo "Compiling with the Small Model"
190   model="--model-small"
191 fi
192
193 for i in _*.c ; 
194     do
195         echo "Compiling file " $i ;
196         sdcc -c $model -I$sdccdir/sdcc51inc $i ;
197     done;       
198
199 echo "Compiling file malloc.c"
200 sdcc -c $model malloc.c
201
202 echo "Compiling file serial.c"
203 sdcc -c $model serial.c
204
205
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 "----------------------------------------------------------" ;