Jamfile 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. #~ Copyright 2003-2004, Rene Rivera.
  2. #~ Distributed under the Boost Software License, Version 1.0.
  3. #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  4. if --help in $(ARGV)
  5. {
  6. ECHO "
  7. Usage:
  8. bjam [options] [install|stage]
  9. * install Installs to the configured location(s).
  10. * stage Stages the build products only to common stage location.
  11. Options:
  12. --help This message.
  13. -sTOOLS=<toolsets> Indicates the tools to build with.
  14. --layout=<layout> Determines what kind of build layout to use. This
  15. allows one to control the naming of the resulting
  16. libraries, and the locations of the installed
  17. files. Default is 'versioned'. Possible values:
  18. versioned - Uses the Boost standard names
  19. which include version number for Boost the
  20. release and version and name of the
  21. compiler as part of the library names. Also
  22. installs the includes to a versioned
  23. sub-directory.
  24. system - Builds an install without the
  25. Boost standard names, and does not install
  26. includes to a versioned sub-directory. This
  27. is intended for system integrators to build
  28. for packaging of distributions.
  29. Locations:
  30. --prefix=PREFIX Install architecture independent files here.
  31. Default; C:\\Boost on Win32
  32. Default; /usr/local on Unix. Linux, etc.
  33. --exec-prefix=EPREFIX Install architecture dependent files here.
  34. Default; PREFIX
  35. --libdir=DIR Install libraries here.
  36. Default; EPREFIX/lib
  37. --includedir=DIR Install source headers here.
  38. Default; PREFIX/include
  39. --builddir=DIR Build in this location instead of building
  40. within the distribution tree. Recomended!
  41. --stagedir=DIR When staging only, stage to the location.
  42. Default; ./stage
  43. Features:
  44. --with-<library> Build, stage, or install the specified <library>
  45. If used, teh default becomes to only build
  46. indicated libraries.
  47. --without-<library> Do not build, stage, or install the specified
  48. <library>. By default all libraries attempt to build.
  49. --with-python-root[=PYTHON_ROOT]
  50. Build Boost.Python libraries with the Python
  51. devel packages located at PYTHON_ROOT.
  52. Default PYTHON_ROOT; C:\\tools\\python on Win32.
  53. Default PYTHON_ROOT; /usr/local on Unix, Linux, etc.
  54. Default PYTHON_ROOT; /usr on Cygwin.
  55. --with-pydebug Build Boost.Python libraries using the
  56. Python debug runtime.
  57. " ;
  58. EXIT "" ;
  59. }
  60. local with-install = ;
  61. local with-stage = ;
  62. # build only, or build+install
  63. if install in $(ARGV)
  64. {
  65. with-install = install ;
  66. with-stage = ;
  67. }
  68. # stage only? (no install, only build and stage to a common dir)
  69. if stage in $(ARGV)
  70. {
  71. with-stage = stage ;
  72. with-install = ;
  73. }
  74. # what kind of layout are we doing?
  75. local layout = [ MATCH "^--layout=(.*)" : $(ARGV) ] ;
  76. layout ?= versioned ;
  77. layout-$(layout) = true ;
  78. # possible stage only location
  79. local stage-locate = [ MATCH "^--stagedir=(.*)" : $(ARGV) ] ;
  80. stage-locate ?= stage ;
  81. # architecture independent files
  82. local boost-locate = [ unless $(with-stage) : [ MATCH "^--prefix=(.*)" : $(ARGV) ] : $(stage-locate) ] ;
  83. if $(NT) { boost-locate ?= C:\\Boost ; }
  84. else if $(UNIX) { boost-locate ?= /usr/local ; }
  85. # architecture dependent files
  86. local exec-locate = [ MATCH "^--exec-prefix=(.*)" : $(ARGV) ] ;
  87. exec-locate ?= $(boost-locate) ;
  88. # object code libraries
  89. local lib-locate = [ MATCH "^--libdir=(.*)" : $(ARGV) ] ;
  90. lib-locate ?= $(exec-locate)/lib ;
  91. # where to build
  92. local all-locate = [ MATCH "^--builddir=(.*)" : $(ARGV) ] ;
  93. ALL_LOCATE_TARGET ?= $(all-locate) ;
  94. # source header files
  95. local include-locate = [ MATCH "^--includedir=(.*)" : $(ARGV) ] ;
  96. include-locate ?= $(boost-locate)/include ;
  97. # location of python
  98. local python-root = [ MATCH "^--with-python-root=(.*)" : $(ARGV) ] ;
  99. PYTHON_ROOT ?= $(python-root) ;
  100. # variant for pydebug build
  101. local with-debug-python ;
  102. if --with-pydebug in $(ARGV)
  103. {
  104. with-debug-python = debug-python ;
  105. }
  106. # libraries to disable building, etc.
  107. local without-libraries = [ MATCH "^--without-(.*)" : $(ARGV) ] ;
  108. # libraries to enable
  109. local with-libraries ;
  110. for local arg in $(ARGV)
  111. {
  112. switch $(arg)
  113. {
  114. case --with-python-root=* : local _ ;
  115. case --with-pydebug : local _ ;
  116. case --with-* :
  117. with-libraries += [ MATCH "^--with-(.*)" : $(arg) ] ;
  118. }
  119. }
  120. #
  121. project-root ;
  122. # bring in the rules for python
  123. import python ;
  124. #
  125. local version-tag = [ MATCH "^([^.]+).([^.]+)" : $(BOOST_VERSION) ] ;
  126. version-tag = $(version-tag:J="_") ;
  127. #
  128. install-subinclude
  129. [ MATCH ^(.*build[/\\:]$(JAMFILE))$ : [ glob-tree $(BOOST_ROOT)/libs : $(JAMFILE) ] ]
  130. : <exclude>$(without-libraries) <include>$(with-libraries) ;
  131. local lib-sources = [ install-sources lib ] ;
  132. if $(lib-sources)
  133. {
  134. local gNOWARN_INCOMPATIBLE_BUILDS = TRUE ;
  135. local gUNVERSIONED_VARIANT_TAG = [ cond $(layout-system) : TRUE ] ;
  136. local lib-build =
  137. debug release
  138. [ cond $(with-debug-python) : debug-python ]
  139. [ cond $(NT) : <runtime-link>static/dynamic ]
  140. <threading>single/multi
  141. ;
  142. local lib-target =
  143. [ cond $(with-install) : install : all ]
  144. [ cond $(with-stage) : stage : all ]
  145. ;
  146. local lib-dest-files = [
  147. stage $(lib-locate:D=)
  148. :
  149. $(lib-sources)
  150. :
  151. <locate>$(lib-locate:D)
  152. common-variant-tag
  153. <target>$(lib-target)
  154. :
  155. $(lib-build)
  156. [ unless $(with-install) $(with-stage) : <suppress>true ]
  157. ] ;
  158. if ! $(gIN_LIB_INCLUDE) && $(layout-versioned)
  159. {
  160. local unversioned-files ;
  161. if $(with-install) || $(with-stage)
  162. {
  163. if $(NT)
  164. {
  165. local version-files = [ MATCH "(.*[.]lib)" : $(lib-dest-files) ] ;
  166. local noversion-files ;
  167. for local version-file in $(version-files)
  168. {
  169. local noversion-file =
  170. [ MATCH "(.*)-[0-9_]+([.]lib)" : $(version-file) ] ;
  171. noversion-file = $(noversion-file[1])$(noversion-file[2]) ;
  172. MakeLocate $(noversion-file) : [ FDirName [ split-path $(lib-locate) ] ] ;
  173. HardLink $(noversion-file) : $(version-file) ;
  174. noversion-files += $(noversion-file) ;
  175. }
  176. declare-fake-targets $(lib-target) : $(noversion-files) ;
  177. }
  178. else if $(UNIX)
  179. {
  180. local so-version-files = [ MATCH "(.*[.]so[.0-9]+)" : $(lib-dest-files) ] ;
  181. so-version-files ?= [ MATCH "(.*[.]so)" : $(lib-dest-files) ] ;
  182. local version-files = $(so-version-files) [ MATCH "(.*[.]a)" : $(lib-dest-files) ] ;
  183. local noversion-files ;
  184. for local version-file in $(version-files)
  185. {
  186. local noversion-file =
  187. [ MATCH "(.*)-[0-9_]+([.]so)[.0-9]*" : $(version-file) ]
  188. [ MATCH "(.*)-[0-9_]+([.]a)" : $(version-file) ] ;
  189. noversion-file = $(noversion-file[1])$(noversion-file[2]) ;
  190. MakeLocate $(noversion-file) : [ FDirName [ split-path $(lib-locate) ] ] ;
  191. HardLink $(noversion-file) : $(version-file) ;
  192. noversion-files += $(noversion-file) ;
  193. }
  194. declare-fake-targets $(lib-target) : $(noversion-files) ;
  195. }
  196. }
  197. }
  198. }
  199. stage [ cond $(layout-versioned) : $(include-locate:D=)/boost-$(version-tag) : $(include-locate:D=) ]
  200. :
  201. [ glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* ]
  202. [ glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc ]
  203. :
  204. <locate>$(include-locate:D)
  205. <tree-subdirs>$(BOOST_ROOT)
  206. [ cond $(with-install) : <target>install : <target>all ]
  207. :
  208. [ unless $(with-install) : <suppress>true ]
  209. ;
粤ICP备19079148号