bc_gen.sh 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. libname=""
  7. src=""
  8. header=""
  9. all_dep=""
  10. # current makefile:
  11. out=""
  12. # temporary file:
  13. tout=""
  14. # install target temp file:
  15. iout=""
  16. # debug flag:
  17. debug="no"
  18. # compile options:
  19. opts=""
  20. # main output sub-directory:
  21. subdir=""
  22. #######################################################################
  23. #
  24. # section for C++ Builder
  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. function bcb_gen_dll()
  85. {
  86. all_dep="$all_dep $subdir\\$libname $subdir\\$libname.lib $subdir\\$libname.exe"
  87. echo " copy $subdir\\$libname.lib \$(BCROOT)\\lib" >> $iout
  88. echo " copy $subdir\\$libname.dll \$(BCROOT)\\bin" >> $iout
  89. echo " copy $subdir\\$libname.tds \$(BCROOT)\\bin" >> $iout
  90. #
  91. # set up section comments:
  92. cat >> $tout << EOF
  93. ########################################################
  94. #
  95. # section for $libname.lib
  96. #
  97. ########################################################
  98. EOF
  99. #
  100. # process source files:
  101. all_obj=""
  102. for file in $src
  103. do
  104. obj=`echo "$file" | sed 's/\(.*\)cpp/\1obj/g'`
  105. obj="$subdir\\$libname\\$obj"
  106. all_obj="$all_obj $obj"
  107. echo "$obj: $file \$(ALL_HEADER)" >> $tout
  108. echo " bcc32 @&&|" >> $tout
  109. echo "-c \$(INCLUDES) $opts \$(CXXFLAGS) -DBOOST_DYN_LINK -o$obj $file" >> $tout
  110. echo "|" >> $tout
  111. echo "" >> $tout
  112. done
  113. #
  114. # now for the directories for this library:
  115. echo "$subdir\\$libname :" >> $tout
  116. echo " -@mkdir $subdir\\$libname" >> $tout
  117. echo "" >> $tout
  118. #
  119. # now for the clean options for this library:
  120. all_clean="$all_clean $libname""_clean"
  121. echo "$libname"_clean : >> $tout
  122. echo " del $subdir\\$libname\\"'*.obj' >> $tout
  123. echo " del $subdir\\$libname\\"'*.il?' >> $tout
  124. echo " del $subdir\\$libname\\"'*.csm' >> $tout
  125. echo " del $subdir\\$libname\\"'*.tds' >> $tout
  126. echo " del $subdir\\"'*.tds' >> $tout
  127. echo "" >> $tout
  128. #
  129. # now for the main target for this library:
  130. echo $subdir\\$libname.lib : $all_obj >> $tout
  131. echo " bcc32 @&&|" >> $tout
  132. echo "-lw-dup -lw-dpl $opts -e$subdir\\$libname.dll \$(XLFLAGS) $all_obj \$(LIBS)" >> $tout
  133. echo "|" >> $tout
  134. echo " implib -w $subdir\\$libname.lib $subdir\\$libname.dll" >> $tout
  135. echo "" >> $tout
  136. # now the test program:
  137. echo "$subdir\\$libname.exe : main.cpp $subdir\\$libname.lib" >> $tout
  138. echo " bcc32 \$(INCLUDES) $opts /DBOOST_LIB_DIAGNOSTIC=1 \$(CXXFLAGS) -DBOOST_DYN_LINK -L./$subdir -e./$subdir/$libname.exe main.cpp" >> $tout
  139. echo " echo running test program $subdir"'\'"$libname.exe" >> $tout
  140. echo " $subdir"'\'"$libname.exe" >> $tout
  141. echo "" >> $tout
  142. }
  143. function bcb_gen()
  144. {
  145. tout="temp"
  146. iout="temp_install"
  147. all_dep="$subdir"
  148. all_clean=""
  149. echo > $out
  150. echo > $tout
  151. rm -f $iout
  152. libname="liblink_test-${subdir}-s-${boost_version}"
  153. opts="-tWM- -D_NO_VCL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../../"
  154. bcb_gen_lib
  155. libname="liblink_test-${subdir}-mt-s-${boost_version}"
  156. opts="-tWM -D_NO_VCL -O2 -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../"
  157. bcb_gen_lib
  158. libname="link_test-${subdir}-mt-${boost_version}"
  159. 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;"
  160. bcb_gen_dll
  161. libname="link_test-${subdir}-${boost_version}"
  162. 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;"
  163. bcb_gen_dll
  164. libname="liblink_test-${subdir}-mt-${boost_version}"
  165. 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;"
  166. bcb_gen_lib
  167. libname="liblink_test-${subdir}-${boost_version}"
  168. 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;"
  169. bcb_gen_lib
  170. #
  171. # debug versions:
  172. libname="liblink_test-${subdir}-sd-${boost_version}"
  173. opts="-tWM- -D_NO_VCL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../../"
  174. bcb_gen_lib
  175. libname="liblink_test-${subdir}-mt-sd-${boost_version}"
  176. opts="-tWM -D_NO_VCL -v -Ve -Vx -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../../"
  177. bcb_gen_lib
  178. libname="link_test-${subdir}-mt-d-${boost_version}"
  179. 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;"
  180. bcb_gen_dll
  181. libname="link_test-${subdir}-d-${boost_version}"
  182. 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;"
  183. bcb_gen_dll
  184. libname="liblink_test-${subdir}-mt-d-${boost_version}"
  185. 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;"
  186. bcb_gen_lib
  187. libname="liblink_test-${subdir}-d-${boost_version}"
  188. 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;"
  189. bcb_gen_lib
  190. cat > $out << EOF
  191. # copyright John Maddock 2005
  192. # Use, modification and distribution are subject to the
  193. # Boost Software License, Version 1.0. (See accompanying file
  194. # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  195. #
  196. # auto generated makefile for C++ Builder
  197. #
  198. # usage:
  199. # make
  200. # brings libraries up to date
  201. # make install
  202. # brings libraries up to date and copies binaries to your C++ Builder /lib and /bin directories (recomended)
  203. # make clean
  204. # removes all temporary files.
  205. #
  206. # Add additional compiler options here:
  207. #
  208. CXXFLAGS=
  209. #
  210. # Add additional include directories here:
  211. #
  212. INCLUDES=
  213. #
  214. # add additional linker flags here:
  215. #
  216. XLFLAGS=
  217. #
  218. # add additional libraries to link to here:
  219. #
  220. LIBS=
  221. #
  222. # add additional static-library creation flags here:
  223. #
  224. XSFLAGS=
  225. !ifndef BCROOT
  226. BCROOT=\$(MAKEDIR)\\..
  227. !endif
  228. EOF
  229. echo "" >> $out
  230. echo "ALL_HEADER=$header" >> $out
  231. echo "" >> $out
  232. echo "all : $all_dep" >> $out
  233. echo >> $out
  234. echo "clean : $all_clean" >> $out
  235. echo >> $out
  236. echo "install : all" >> $out
  237. cat $iout >> $out
  238. echo >> $out
  239. echo $subdir : >> $out
  240. echo " -@mkdir $subdir" >> $out
  241. echo "" >> $out
  242. cat $tout >> $out
  243. }
  244. . common.sh
  245. #
  246. # generate C++ Builder 6 files:
  247. out="borland.mak"
  248. subdir="borland"
  249. has_stlport="yes"
  250. bcb_gen