Jamfile 9.5 KB

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