Jamfile 9.0 KB

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