1 | #! /bin/bash |
---|
2 | |
---|
3 | libname="" |
---|
4 | src="" |
---|
5 | header="" |
---|
6 | all_dep="" |
---|
7 | |
---|
8 | # current makefile: |
---|
9 | out="" |
---|
10 | # temporary file: |
---|
11 | tout="" |
---|
12 | # install target temp file: |
---|
13 | iout="" |
---|
14 | # debug flag: |
---|
15 | debug="no" |
---|
16 | # compile options: |
---|
17 | opts="" |
---|
18 | # main output sub-directory: |
---|
19 | subdir="" |
---|
20 | |
---|
21 | ####################################################################### |
---|
22 | # |
---|
23 | # section for C++ Builder |
---|
24 | # |
---|
25 | ####################################################################### |
---|
26 | |
---|
27 | function bcb_gen_lib() |
---|
28 | { |
---|
29 | all_dep="$all_dep $subdir\\$libname $subdir\\$libname.lib $subdir\\$libname.exe" |
---|
30 | echo " copy $subdir\\$libname.lib \$(BCROOT)\\lib" >> $iout |
---|
31 | # |
---|
32 | # set up section comments: |
---|
33 | cat >> $tout << EOF |
---|
34 | ######################################################## |
---|
35 | # |
---|
36 | # section for $libname.lib |
---|
37 | # |
---|
38 | ######################################################## |
---|
39 | EOF |
---|
40 | # |
---|
41 | # process source files: |
---|
42 | all_obj="" |
---|
43 | all_lib_obj="" |
---|
44 | for file in $src |
---|
45 | do |
---|
46 | obj=`echo "$file" | sed 's/\(.*\)cpp/\1obj/g'` |
---|
47 | obj="$subdir\\$libname\\$obj" |
---|
48 | all_obj="$all_obj $obj" |
---|
49 | all_lib_obj="$all_lib_obj \"$obj\"" |
---|
50 | echo "$obj: $file \$(ALL_HEADER)" >> $tout |
---|
51 | echo " bcc32 @&&|" >> $tout |
---|
52 | echo "-c \$(INCLUDES) $opts \$(CXXFLAGS) -o$obj $file" >> $tout |
---|
53 | echo "|" >> $tout |
---|
54 | echo "" >> $tout |
---|
55 | done |
---|
56 | # |
---|
57 | # now for the directories for this library: |
---|
58 | echo "$subdir\\$libname : " >> $tout |
---|
59 | echo " -@mkdir $subdir\\$libname" >> $tout |
---|
60 | echo "" >> $tout |
---|
61 | # |
---|
62 | # now for the clean options for this library: |
---|
63 | all_clean="$all_clean $libname""_clean" |
---|
64 | echo "$libname"_clean : >> $tout |
---|
65 | echo " del $subdir\\$libname\\"'*.obj' >> $tout |
---|
66 | echo " del $subdir\\$libname\\"'*.il?' >> $tout |
---|
67 | echo " del $subdir\\$libname\\"'*.csm' >> $tout |
---|
68 | echo " del $subdir\\$libname\\"'*.tds' >> $tout |
---|
69 | echo "" >> $tout |
---|
70 | # |
---|
71 | # now for the main target for this library: |
---|
72 | echo $subdir\\$libname.lib : $all_obj >> $tout |
---|
73 | echo " tlib @&&|" >> $tout |
---|
74 | echo "/P128 /C /u /a \$(XSFLAGS) \"$subdir\\$libname.lib\" $all_lib_obj" >> $tout |
---|
75 | echo "|" >> $tout |
---|
76 | echo "" >> $tout |
---|
77 | # now the test program: |
---|
78 | echo "$subdir\\$libname.exe : main.cpp $subdir\\$libname.lib" >> $tout |
---|
79 | echo " bcc32 \$(INCLUDES) $opts /DBOOST_LIB_DIAGNOSTIC=1 \$(CXXFLAGS) -L./$subdir -e./$subdir/$libname.exe main.cpp" >> $tout |
---|
80 | echo " echo running test progam $subdir"'\'"$libname.exe" >> $tout |
---|
81 | echo " $subdir"'\'"$libname.exe" >> $tout |
---|
82 | echo "" >> $tout |
---|
83 | } |
---|
84 | |
---|
85 | function bcb_gen_dll() |
---|
86 | { |
---|
87 | all_dep="$all_dep $subdir\\$libname $subdir\\$libname.lib $subdir\\$libname.exe" |
---|
88 | echo " copy $subdir\\$libname.lib \$(BCROOT)\\lib" >> $iout |
---|
89 | echo " copy $subdir\\$libname.dll \$(BCROOT)\\bin" >> $iout |
---|
90 | echo " copy $subdir\\$libname.tds \$(BCROOT)\\bin" >> $iout |
---|
91 | # |
---|
92 | # set up section comments: |
---|
93 | cat >> $tout << EOF |
---|
94 | ######################################################## |
---|
95 | # |
---|
96 | # section for $libname.lib |
---|
97 | # |
---|
98 | ######################################################## |
---|
99 | EOF |
---|
100 | # |
---|
101 | # process source files: |
---|
102 | all_obj="" |
---|
103 | for file in $src |
---|
104 | do |
---|
105 | obj=`echo "$file" | sed 's/\(.*\)cpp/\1obj/g'` |
---|
106 | obj="$subdir\\$libname\\$obj" |
---|
107 | all_obj="$all_obj $obj" |
---|
108 | echo "$obj: $file \$(ALL_HEADER)" >> $tout |
---|
109 | echo " bcc32 @&&|" >> $tout |
---|
110 | echo "-c \$(INCLUDES) $opts \$(CXXFLAGS) -DBOOST_DYN_LINK -o$obj $file" >> $tout |
---|
111 | echo "|" >> $tout |
---|
112 | echo "" >> $tout |
---|
113 | done |
---|
114 | # |
---|
115 | # now for the directories for this library: |
---|
116 | echo "$subdir\\$libname :" >> $tout |
---|
117 | echo " -@mkdir $subdir\\$libname" >> $tout |
---|
118 | echo "" >> $tout |
---|
119 | # |
---|
120 | # now for the clean options for this library: |
---|
121 | all_clean="$all_clean $libname""_clean" |
---|
122 | echo "$libname"_clean : >> $tout |
---|
123 | echo " del $subdir\\$libname\\"'*.obj' >> $tout |
---|
124 | echo " del $subdir\\$libname\\"'*.il?' >> $tout |
---|
125 | echo " del $subdir\\$libname\\"'*.csm' >> $tout |
---|
126 | echo " del $subdir\\$libname\\"'*.tds' >> $tout |
---|
127 | echo " del $subdir\\"'*.tds' >> $tout |
---|
128 | echo "" >> $tout |
---|
129 | # |
---|
130 | # now for the main target for this library: |
---|
131 | echo $subdir\\$libname.lib : $all_obj >> $tout |
---|
132 | echo " bcc32 @&&|" >> $tout |
---|
133 | echo "-lw-dup -lw-dpl $opts -e$subdir\\$libname.dll \$(XLFLAGS) $all_obj \$(LIBS)" >> $tout |
---|
134 | echo "|" >> $tout |
---|
135 | echo " implib -w $subdir\\$libname.lib $subdir\\$libname.dll" >> $tout |
---|
136 | echo "" >> $tout |
---|
137 | # now the test program: |
---|
138 | echo "$subdir\\$libname.exe : main.cpp $subdir\\$libname.lib" >> $tout |
---|
139 | echo " bcc32 \$(INCLUDES) $opts /DBOOST_LIB_DIAGNOSTIC=1 \$(CXXFLAGS) -DBOOST_DYN_LINK -L./$subdir -e./$subdir/$libname.exe main.cpp" >> $tout |
---|
140 | echo " echo running test program $subdir"'\'"$libname.exe" >> $tout |
---|
141 | echo " $subdir"'\'"$libname.exe" >> $tout |
---|
142 | echo "" >> $tout |
---|
143 | } |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | function bcb_gen() |
---|
148 | { |
---|
149 | tout="temp" |
---|
150 | iout="temp_install" |
---|
151 | all_dep="$subdir" |
---|
152 | all_clean="" |
---|
153 | echo > $out |
---|
154 | echo > $tout |
---|
155 | rm -f $iout |
---|
156 | |
---|
157 | libname="liblink_test-${subdir}-s-${boost_version}" |
---|
158 | opts="-tWM- -D_NO_VCL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../../" |
---|
159 | bcb_gen_lib |
---|
160 | |
---|
161 | libname="liblink_test-${subdir}-mt-s-${boost_version}" |
---|
162 | opts="-tWM -D_NO_VCL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../" |
---|
163 | bcb_gen_lib |
---|
164 | |
---|
165 | libname="link_test-${subdir}-mt-${boost_version}" |
---|
166 | opts="-tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" |
---|
167 | bcb_gen_dll |
---|
168 | |
---|
169 | libname="link_test-${subdir}-${boost_version}" |
---|
170 | opts="-tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" |
---|
171 | bcb_gen_dll |
---|
172 | |
---|
173 | libname="liblink_test-${subdir}-mt-${boost_version}" |
---|
174 | opts="-tWD -tWM -tWR -DBOOST_REGEX_STATIC_LINK -D_NO_VCL -D_RTLDLL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" |
---|
175 | bcb_gen_lib |
---|
176 | |
---|
177 | libname="liblink_test-${subdir}-${boost_version}" |
---|
178 | opts="-tWD -tWR -tWM- -DBOOST_REGEX_STATIC_LINK -D_NO_VCL -D_RTLDLL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" |
---|
179 | bcb_gen_lib |
---|
180 | # |
---|
181 | # debug versions: |
---|
182 | libname="liblink_test-${subdir}-sd-${boost_version}" |
---|
183 | opts="-tWM- -D_NO_VCL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../../" |
---|
184 | bcb_gen_lib |
---|
185 | |
---|
186 | libname="liblink_test-${subdir}-mt-sd-${boost_version}" |
---|
187 | opts="-tWM -D_NO_VCL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../" |
---|
188 | bcb_gen_lib |
---|
189 | |
---|
190 | libname="link_test-${subdir}-mt-d-${boost_version}" |
---|
191 | opts="-tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" |
---|
192 | bcb_gen_dll |
---|
193 | |
---|
194 | libname="link_test-${subdir}-d-${boost_version}" |
---|
195 | opts="-tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" |
---|
196 | bcb_gen_dll |
---|
197 | |
---|
198 | libname="liblink_test-${subdir}-mt-d-${boost_version}" |
---|
199 | opts="-tWD -tWM -tWR -DBOOST_REGEX_STATIC_LINK -D_NO_VCL -D_RTLDLL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" |
---|
200 | bcb_gen_lib |
---|
201 | |
---|
202 | libname="liblink_test-${subdir}-d-${boost_version}" |
---|
203 | opts="-tWD -tWR -tWM- -DBOOST_REGEX_STATIC_LINK -D_NO_VCL -D_RTLDLL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../ -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" |
---|
204 | bcb_gen_lib |
---|
205 | |
---|
206 | |
---|
207 | cat > $out << EOF |
---|
208 | # |
---|
209 | # auto generated makefile for C++ Builder |
---|
210 | # |
---|
211 | # usage: |
---|
212 | # make |
---|
213 | # brings libraries up to date |
---|
214 | # make install |
---|
215 | # brings libraries up to date and copies binaries to your C++ Builder /lib and /bin directories (recomended) |
---|
216 | # make clean |
---|
217 | # removes all temporary files. |
---|
218 | |
---|
219 | # |
---|
220 | # Add additional compiler options here: |
---|
221 | # |
---|
222 | CXXFLAGS= |
---|
223 | # |
---|
224 | # Add additional include directories here: |
---|
225 | # |
---|
226 | INCLUDES= |
---|
227 | # |
---|
228 | # add additional linker flags here: |
---|
229 | # |
---|
230 | XLFLAGS= |
---|
231 | # |
---|
232 | # add additional libraries to link to here: |
---|
233 | # |
---|
234 | LIBS= |
---|
235 | # |
---|
236 | # add additional static-library creation flags here: |
---|
237 | # |
---|
238 | XSFLAGS= |
---|
239 | |
---|
240 | !ifndef BCROOT |
---|
241 | BCROOT=\$(MAKEDIR)\\.. |
---|
242 | !endif |
---|
243 | |
---|
244 | EOF |
---|
245 | echo "" >> $out |
---|
246 | echo "ALL_HEADER=$header" >> $out |
---|
247 | echo "" >> $out |
---|
248 | echo "all : $all_dep" >> $out |
---|
249 | echo >> $out |
---|
250 | echo "clean : $all_clean" >> $out |
---|
251 | echo >> $out |
---|
252 | echo "install : all" >> $out |
---|
253 | cat $iout >> $out |
---|
254 | echo >> $out |
---|
255 | echo $subdir : >> $out |
---|
256 | echo " -@mkdir $subdir" >> $out |
---|
257 | echo "" >> $out |
---|
258 | |
---|
259 | cat $tout >> $out |
---|
260 | } |
---|
261 | |
---|
262 | . common.sh |
---|
263 | |
---|
264 | # |
---|
265 | # generate C++ Builder 6 files: |
---|
266 | out="borland.mak" |
---|
267 | subdir="borland" |
---|
268 | has_stlport="yes" |
---|
269 | bcb_gen |
---|
270 | |
---|
271 | |
---|
272 | |
---|
273 | |
---|
274 | |
---|