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