Jamfile 7.3 KB

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