1#! /usr/bin/env bash 2# copyright John Maddock 2005 3# Use, modification and distribution are subject to the 4# Boost Software License, Version 1.0. (See accompanying file 5# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7libname="" 8src="" 9header="" 10all_dep="" 11 12# current makefile: 13out="" 14# temporary file: 15tout="" 16# install target temp file: 17iout="" 18# debug flag: 19debug="no" 20# compile options: 21opts="" 22# main output sub-directory: 23subdir="" 24# extra debug /RTc options: 25debug_extra="" 26 27function vc6_gen_lib() 28{ 29 all_dep="$all_dep $libname""_dir ./$subdir/$libname.lib ./$subdir/$libname.exe" 30 echo " copy $subdir\\$libname.lib "'"$'"(MSVCDIR)\\lib"'"' >> $iout 31 if test $debug == "yes"; then 32 echo " copy $subdir\\$libname.pdb "'"$'"(MSVCDIR)\\lib"'"' >> $iout 33 fi 34# 35# set up section comments: 36 cat >> $tout << EOF 37######################################################## 38# 39# section for $libname.lib 40# 41######################################################## 42EOF 43# 44# process source files: 45 all_obj="" 46 for file in $src 47 do 48 obj=`echo "$file" | sed 's/\(.*\)cpp/\1obj/g'` 49 obj="$subdir/$libname/$obj" 50 all_obj="$all_obj $obj" 51 echo "$obj: $file \$(ALL_HEADER)" >> $tout 52 echo " cl /c \$(INCLUDES) $opts \$(CXXFLAGS) -Y- -Fo./$subdir/$libname/ -Fd$subdir/$libname.pdb $file" >> $tout 53 echo "" >> $tout 54 done 55# 56# now for the directories for this library: 57 echo "$libname"_dir : >> $tout 58 echo " @if not exist \"$subdir\\$libname\\\$(NULL)\" mkdir $subdir\\$libname" >> $tout 59 echo "" >> $tout 60# 61# now for the clean options for this library: 62 all_clean="$all_clean $libname""_clean" 63 echo "$libname"_clean : >> $tout 64 echo " del $subdir\\$libname\\"'*.obj' >> $tout 65 echo " del $subdir\\$libname\\"'*.idb' >> $tout 66 echo " del $subdir\\$libname\\"'*.exp' >> $tout 67 echo " del $subdir\\$libname\\"'*.pch' >> $tout 68 echo "" >> $tout 69# 70# now for the main target for this library: 71 echo ./$subdir/$libname.lib : $all_obj >> $tout 72 echo " link -lib /nologo /out:$subdir/$libname.lib \$(XSFLAGS) $all_obj" >> $tout 73 echo "" >> $tout 74# now the test program: 75 echo ./$subdir/$libname.exe : main.cpp ./$subdir/$libname.lib >> $tout 76 echo " cl \$(INCLUDES) $opts /DBOOST_LIB_DIAGNOSTIC=1 \$(CXXFLAGS) -o ./$subdir/$libname.exe main.cpp /link /LIBPATH:./$subdir" >> $tout 77 echo " $subdir"'\'"$libname.exe" >> $tout 78 echo "" >> $tout 79} 80 81function vc6_gen_dll() 82{ 83 all_dep="$all_dep $libname""_dir ./$subdir/$libname.lib ./$subdir/$libname.exe" 84 echo " copy $subdir\\$libname.lib "'"$'"(MSVCDIR)\\lib"'"' >> $iout 85 echo " copy $subdir\\$libname.dll "'"$'"(MSVCDIR)\\bin"'"' >> $iout 86 if test $debug == "yes"; then 87 echo " copy $subdir\\$libname.pdb "'"$'"(MSVCDIR)\\lib"'"' >> $iout 88 fi 89# 90# set up section comments: 91 cat >> $tout << EOF 92######################################################## 93# 94# section for $libname.lib 95# 96######################################################## 97EOF 98# 99# process source files: 100 all_obj="" 101 for file in $src 102 do 103 obj=`echo "$file" | sed 's/\(.*\)cpp/\1obj/g'` 104 obj="$subdir/$libname/$obj" 105 all_obj="$all_obj $obj" 106 echo "$obj: $file \$(ALL_HEADER)" >> $tout 107 echo " cl /c \$(INCLUDES) $opts \$(CXXFLAGS) -Y- -Fo./$subdir/$libname/ -Fd$subdir/$libname.pdb $file" >> $tout 108 echo "" >> $tout 109 done 110# 111# now for the directories for this library: 112 echo "$libname"_dir : >> $tout 113 echo " @if not exist \"$subdir\\$libname\\\$(NULL)\" mkdir $subdir\\$libname" >> $tout 114 echo "" >> $tout 115# 116# now for the clean options for this library: 117 all_clean="$all_clean $libname""_clean" 118 echo "$libname"_clean : >> $tout 119 echo " del $subdir\\$libname\\"'*.obj' >> $tout 120 echo " del $subdir\\$libname\\"'*.idb' >> $tout 121 echo " del $subdir\\$libname\\"'*.exp' >> $tout 122 echo " del $subdir\\$libname\\"'*.pch' >> $tout 123 echo "" >> $tout 124# 125# now for the main target for this library: 126 echo ./$subdir/$libname.lib : $all_obj >> $tout 127 echo " link kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:\"$subdir/$libname.pdb\" /debug /machine:I386 /out:\"$subdir/$libname.dll\" /implib:\"$subdir/$libname.lib\" /LIBPATH:\$(STLPORT_PATH)\\lib \$(XLFLAGS) $all_obj" >> $tout 128 echo "" >> $tout 129# now the test program: 130 echo ./$subdir/$libname.exe : main.cpp ./$subdir/$libname.lib >> $tout 131 echo " cl \$(INCLUDES) $opts /DBOOST_LIB_DIAGNOSTIC=1 \$(CXXFLAGS) -o ./$subdir/$libname.exe main.cpp /link /LIBPATH:./$subdir" >> $tout 132 echo " $subdir"'\'"$libname.exe" >> $tout 133 echo "" >> $tout 134} 135 136is_stlport="no" 137 138function vc6_gen() 139{ 140 debug="no" 141 tout="temp" 142 iout="temp_install" 143 all_dep="main_dir" 144 all_clean="" 145 echo > $out 146 echo > $tout 147 rm -f $iout 148 149 libname="liblink_test-${subdir}-s-${boost_version}" 150 opts='/nologo /ML /W3 /GX /O2 /GB /GF /Gy /I..\..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /FD' 151 vc6_gen_lib 152 153 libname="liblink_test-${subdir}-mt-s-${boost_version}" 154 opts='/nologo /MT /W3 /GX /O2 /GB /GF /Gy /I..\..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /FD ' 155 vc6_gen_lib 156 157 debug="yes" 158 libname="liblink_test-${subdir}-sgd-${boost_version}" 159 opts='/nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /FD '"$debug_extra"' ' 160 vc6_gen_lib 161 162 libname="liblink_test-${subdir}-mt-sgd-${boost_version}" 163 opts='/nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /FD '"$debug_extra"' ' 164 vc6_gen_lib 165 166 libname="link_test-${subdir}-mt-gd-${boost_version}" 167 opts='/nologo /MDd /W3 /Gm /GX /Zi /Od /I..\..\..\..\ /D_DEBUG /DBOOST_DYN_LINK /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD '"$debug_extra"' ' 168 vc6_gen_dll 169 170 debug="no" 171 opts='/nologo /MD /W3 /GX /O2 /GB /GF /Gy /I..\..\..\..\ /DBOOST_DYN_LINK /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /FD ' 172 libname="link_test-${subdir}-mt-${boost_version}" 173 vc6_gen_dll 174 175 debug="no" 176 opts='/nologo /MD /W3 /GX /O2 /GB /GF /Gy /I..\..\..\..\ /DBOOST_REGEX_STATIC_LINK /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /FD ' 177 libname="liblink_test-${subdir}-mt-${boost_version}" 178 vc6_gen_lib 179 180 debug="yes" 181 libname="liblink_test-${subdir}-mt-gd-${boost_version}" 182 opts='/nologo /MDd /W3 /Gm /GX /Zi /Od /I..\..\..\..\ /DBOOST_REGEX_STATIC_LINK /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD '"$debug_extra"' ' 183 vc6_gen_lib 184 185 cat > $out << EOF 186# copyright John Maddock 2005 187# Use, modification and distribution are subject to the 188# Boost Software License, Version 1.0. (See accompanying file 189# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 190# 191# auto generated makefile for VC6 compiler 192# 193# usage: 194# make 195# brings libraries up to date 196# make install 197# brings libraries up to date and copies binaries to your VC6 /lib and /bin directories (recomended) 198# 199 200# 201# Add additional compiler options here: 202# 203CXXFLAGS= 204# 205# Add additional include directories here: 206# 207INCLUDES= 208# 209# add additional linker flags here: 210# 211XLFLAGS= 212# 213# add additional static-library creation flags here: 214# 215XSFLAGS= 216 217!IF "\$(OS)" == "Windows_NT" 218NULL= 219!ELSE 220NULL=nul 221!ENDIF 222 223!IF "\$(MSVCDIR)" == "" 224!ERROR Variable MSVCDIR not set. 225!ENDIF 226 227EOF 228 echo "" >> $out 229 echo "ALL_HEADER=$header" >> $out 230 echo "" >> $out 231 echo "all : $all_dep" >> $out 232 echo >> $out 233 echo "clean : $all_clean" >> $out 234 echo >> $out 235 echo "install : all" >> $out 236 cat $iout >> $out 237 echo >> $out 238 echo main_dir : >> $out 239 echo " @if not exist \"$subdir\\\$(NULL)\" mkdir $subdir" >> $out 240 echo "" >> $out 241 242 cat $tout >> $out 243} 244 245function vc6_stlp_gen() 246{ 247 debug="no" 248 tout="temp" 249 iout="temp_install" 250 all_dep="main_dir" 251 all_clean="" 252 echo > $out 253 echo > $tout 254 rm -f $iout 255 256 libname="liblink_test-${subdir}-mt-s-${boost_version}" 257 opts='/nologo /MT /W3 /GX /O2 /GB /GF /Gy /I$(STLPORT_PATH)\stlport /I..\..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB ' 258 vc6_gen_lib 259 260 debug="true" 261 libname="liblink_test-${subdir}-mt-sgd-${boost_version}" 262 opts='/nologo /MTd /W3 /Gm /GX /Zi /Od /I$(STLPORT_PATH)\stlport /I..\..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB '"$debug_extra"' ' 263 vc6_gen_lib 264 265 libname="link_test-${subdir}-mt-gd-${boost_version}" 266 opts='/nologo /MDd /W3 /Gm /GX /Zi /Od /I$(STLPORT_PATH)\stlport /I..\..\..\..\ /DBOOST_DYN_LINK /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL '"$debug_extra"' ' 267 vc6_gen_dll 268 269 debug="no" 270 opts='/nologo /MD /W3 /GX /O2 /GB /GF /I$(STLPORT_PATH)\stlport /Gy /I..\..\..\..\ /DBOOST_DYN_LINK /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL ' 271 libname="link_test-${subdir}-mt-${boost_version}" 272 vc6_gen_dll 273 274 debug="no" 275 opts='/nologo /MD /W3 /GX /O2 /GB /GF /Gy /I$(STLPORT_PATH)\stlport /I..\..\..\..\ /DBOOST_REGEX_STATIC_LINK /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL ' 276 libname="liblink_test-${subdir}-mt-${boost_version}" 277 vc6_gen_lib 278 279 debug="true" 280 libname="liblink_test-${subdir}-mt-gd-${boost_version}" 281 opts='/nologo /MDd /W3 /Gm /GX /Zi /Od /I$(STLPORT_PATH)\stlport /I..\..\..\..\ /DBOOST_REGEX_STATIC_LINK /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL '"$debug_extra"' ' 282 vc6_gen_lib 283 284# debug STLPort mode: 285# not yet supported by bjam? 286 debug="yes" 287 opts='/nologo /MDd /W3 /Gm /GX /Zi /Od /I$(STLPORT_PATH)\stlport /I..\..\..\..\ /DBOOST_DYN_LINK /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL '"$debug_extra"' ' 288 libname="link_test-${subdir}-mt-pgd-${boost_version}" 289 vc6_gen_dll 290 libname="liblink_test-${subdir}-mt-spgd-${boost_version}" 291 opts='/nologo /MTd /W3 /Gm /GX /Zi /Od /I$(STLPORT_PATH)\stlport /I..\..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB '"$debug_extra"' ' 292 vc6_gen_lib 293 opts='/nologo /MDd /W3 /Gm /GX /Zi /Od /I$(STLPORT_PATH)\stlport /I..\..\..\..\ /DBOOST_REGEX_STATIC_LINK /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL '"$debug_extra"' ' 294 libname="liblink_test-${subdir}-mt-pgd-${boost_version}" 295 vc6_gen_lib 296 297 cat > $out << EOF 298# copyright John Maddock 2005 299# Use, modification and distribution are subject to the 300# Boost Software License, Version 1.0. (See accompanying file 301# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 302# 303# auto generated makefile for VC6+STLPort 304# 305# usage: 306# make 307# brings libraries up to date 308# make install 309# brings libraries up to date and copies binaries to your VC6 /lib and /bin directories (recomended) 310# 311 312# 313# Add additional compiler options here: 314# 315CXXFLAGS= 316# 317# Add additional include directories here: 318# 319INCLUDES= 320# 321# add additional linker flags here: 322# 323XLFLAGS= 324# 325# add additional static-library creation flags here: 326# 327XSFLAGS= 328 329!IF "\$(OS)" == "Windows_NT" 330NULL= 331!ELSE 332NULL=nul 333!ENDIF 334 335!IF "\$(MSVCDIR)" == "" 336!ERROR Variable MSVCDIR not set. 337!ENDIF 338 339!IF "\$(STLPORT_PATH)" == "" 340!ERROR Variable STLPORT_PATH not set. 341!ENDIF 342 343EOF 344 echo "" >> $out 345 echo "ALL_HEADER=$header" >> $out 346 echo "" >> $out 347 echo "all : $all_dep" >> $out 348 echo >> $out 349 echo "clean : $all_clean" >> $out 350 echo >> $out 351 echo "install : stlport_check all" >> $out 352 cat $iout >> $out 353 echo >> $out 354 echo main_dir : >> $out 355 echo " @if not exist \"$subdir\\\$(NULL)\" mkdir $subdir" >> $out 356 echo "" >> $out 357 echo 'stlport_check : $(STLPORT_PATH)\stlport\string' >> $out 358 echo " echo" >> $out 359 echo "" >> $out 360 361 cat $tout >> $out 362} 363 364 365. common.sh 366 367# 368# generate vc6 makefile: 369debug_extra="/GX" 370out="vc6.mak" 371subdir="vc6" 372vc6_gen 373# 374# generate vc6-stlport makefile: 375is_stlport="yes" 376out="vc6-stlport.mak" 377no_single="yes" 378subdir="vc6-stlport" 379vc6_stlp_gen 380# 381# generate vc7 makefile: 382debug_extra="/GX /RTC1" 383is_stlport="no" 384out="vc7.mak" 385no_single="no" 386subdir="vc7" 387vc6_gen 388# 389# generate vc7-stlport makefile: 390is_stlport="yes" 391out="vc7-stlport.mak" 392no_single="yes" 393subdir="vc7-stlport" 394vc6_stlp_gen 395# 396# generate vc71 makefile: 397is_stlport="no" 398out="vc71.mak" 399no_single="no" 400subdir="vc71" 401vc6_gen 402# 403# generate vc71-stlport makefile: 404is_stlport="yes" 405out="vc71-stlport.mak" 406no_single="yes" 407subdir="vc71-stlport" 408vc6_stlp_gen 409 410 411# 412# remove tmep files; 413rm -f $tout $iout 414 415 416 417 418 419 420 421 422 423 424 425