📄 build.jam
字号:
}}if $(--duma){ --defs += OPT_DUMA ;}if ( $(OS) = NT || $(NT) ) && ! NT in $(--defs){ --defs += NT ;}if $(VMS){ --defs += VMS ;}--defs += YYSTACKSIZE=5000 ;if $(with-python){ --defs += HAVE_PYTHON ;}if $(debug){ --defs += BJAM_NEWSTR_NO_ALLOCATE ;}# The basic symbolic targets...NOTFILE all clean dist ;ALWAYS clean ;# Utility rules and actions...rule .clean{ [DELETE] clean : $(<) ;}if $(NT) { actions piecemeal together existing [DELETE] { del /F /Q $(>)} }if $(UNIX) { actions piecemeal together existing [DELETE] { rm -f $(>)} }if $(VMS) { actions piecemeal together existing [DELETE] { DELETE $(>[--2]:J=";*, ") $(>[-1]);*} }if $(NT) { --chmod+w = "attrib -r " ;}if $(UNIX) { --chmod+w = "chmod +w " ;}if $(VMS) { --chmod+w = "SET FILE/PROT=(S:RWED) " ;}rule .mkdir{ NOUPDATE $(<) ; if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; } if ! $(md<$(<)>) { [MKDIR] $(<) ; md<$(<)> = - ; }}if $(NT) { actions [MKDIR] { md $(<)} }if $(UNIX) { actions [MKDIR] { mkdir $(<)} }if $(VMS) { actions [MKDIR] { CREATE/DIR $(<J=", ")} }rule .exe{ local exe = $(<) ; if $(NT) || ( $(UNIX) && $(OS) = CYGWIN ) || $(VMS) { exe = $(exe:S=.exe) ; } LOCATE on $(exe) = $(locate-target) ; DEPENDS all : $(exe) ; .mkdir $(locate-target) ; if $(--link) { local objs = ; for local s in $(>) { # Translate any subdir elements into a simple file name. local o = [ MATCH "([^/]+)[/]?(.+)" : $(s) ] ; o = $(o:J=_) ; o = $(o:S=.o) ; objs += $(o) ; LOCATE on $(o) = $(locate-target) ; DEPENDS $(exe) : $(o) ; DEPENDS $(o) : $(s) ; DEPENDS $(o) : $(locate-target) ; [COMPILE] $(o) : $(s) ; .clean $(o) ; } DEPENDS $(exe) : $(objs) ; DEPENDS $(exe) : $(locate-target) ; [COMPILE.LINK] $(exe) : $(objs) ; .clean $(exe) ; } else { DEPENDS $(exe) : $(>) ; DEPENDS $(exe) : $(locate-target) ; [COMPILE] $(exe) : $(>) ; .clean $(exe) ; } return $(exe) ;}if ! $(--def[2]) { actions [COMPILE] { "$(--cc)" $(--bin)$(<:D=) $(--dir)$(<:D)$(./) $(--out)$(<) $(--def)$(--defs) $(--flags) "$(--libs)" $(>)} }else { actions [COMPILE] { "$(--cc)" $(--bin)$(<:D=) $(--dir)$(<:D)$(./) $(--out)$(<) $(--def[1])$(--defs:J=$(--def[2]))$(--def[3]) $(--flags) "$(--libs)" $(>)} }if $(VMS) { actions [COMPILE.LINK] { "$(--link)" $(--link-bin)$(<:D=) $(--link-dir)$(<:D)$(./) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>J=", ")} }else { actions [COMPILE.LINK] { "$(--link)" $(--link-bin)$(<:D=) $(--link-dir)$(<:D)$(./) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>)} }rule .link{ DEPENDS all : $(<) ; DEPENDS $(<) : $(>) ; [LINK] $(<) : $(>) ; .clean $(<) ;}if $(NT) { actions [LINK] { copy $(>) $(<)} }if $(UNIX) { actions [LINK] { ln -fs $(>) $(<)} }if $(VMS) { actions [LINK] { COPY/REPLACE $(>) $(<)} }rule .move{ DEPENDS $(<) : $(>) ; [MOVE] $(<) : $(>) ;}if $(NT) { actions [MOVE] { del /f $(<) rename $(>) $(<)} }if $(UNIX) { actions [MOVE] { mv -f $(>) $(<)} }if $(VMS) { actions [MOVE] { RENAME $(>) $(<)} }# Generate the grammar tokens table, and the real yacc grammar.rule .yyacc{ local exe = [ .exe yyacc : yyacc.c ] ; NOUPDATE $(exe) ; DEPENDS $(<) : $(exe) $(>) ; LEAVES $(<) ; yyacc.exe on $(<) = $(exe:R=$(locate-target)) ; [YYACC] $(<) : $(>) ;}actions [YYACC] { $(--chmod+w)$(<[1]) $(--chmod+w)$(<[2]) "$(yyacc.exe)" $(<) $(>)}if $(grammar){ .yyacc jamgram.y jamgramtab.h : jamgram.yy ;}else if $(debug){ .exe yyacc : yyacc.c ;}# How to build the grammar.if $(NT){ SUFEXE = .exe ; # try some other likely spellings... PATH ?= $(Path) ; PATH ?= $(path) ;}SUFEXE ?= "" ;yacc ?= [ GLOB $(PATH) : yacc$(SUFEXE) ] ;yacc ?= [ GLOB $(PATH) : bison$(SUFEXE) ] ;yacc ?= [ GLOB "$(ProgramFiles:J= )\\GnuWin32\\bin" "C:\\Program Files\\GnuWin32\\bin" : bison$(SUFEXE) ] ;yacc = $(yacc[1]) ;switch $(yacc:D=:S=){ case bison : yacc += -d --yacc ; case yacc : yacc += -d ;}if $(debug) && $(yacc){ yacc += -t -v ;}yacc += $(YACCFLAGS) ;rule .yacc{ DEPENDS $(<) : $(>) ; LEAVES $(<) ; [YACC] $(<) : $(>) ;}if $(NT) { actions [YACC] { "$(yacc)" $(>) if not errorlevel 1 ( del /f $(<[1]) rename y.tab$(<[1]:S) $(<[1]) del /f $(<[2]) rename y.tab$(<[2]:S) $(<[2]) ) else set _error_ =} }if $(UNIX) { actions [YACC] { if ` "$(yacc)" $(>) ` ; then mv -f y.tab$(<[1]:S) $(<[1]) mv -f y.tab$(<[2]:S) $(<[2]) else exit 1 fi} }if $(VMS) { actions [YACC] { IF "$(yacc)" $(>) THEN RENAME y_tab$(<[1]:S) $(<[1]) RENAME y_tab$(<[2]:S) $(<[2]) ENDIF} }if $(grammar) && ! $(yacc){ EXIT "Could not find the 'yacc' tool, and therefore can not build the grammar." ;}if $(grammar) && $(yacc){ .yacc jamgram.c jamgram.h : jamgram.y ;}# How to build the compiled in jambase.rule .mkjambase{ local exe = [ .exe mkjambase : mkjambase.c ] ; DEPENDS $(<) : $(exe) $(>) ; LEAVES $(<) ; mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ; [MKJAMBASE] $(<) : $(>) ;}actions [MKJAMBASE] { $(--chmod+w)$(<) $(mkjambase.exe) $(<) $(>)}if $(debug){ .mkjambase jambase.c : Jambase ;}# How to build Jam.rule .jam{ $(>).exe = [ .exe $(>) : $(jam.source) ] ; DEPENDS all : $($(>).exe) ; if $(debug) { $(<).exe = $(<:S=$($(>).exe:S)) ; LOCATE on $($(<).exe) = $(locate-target) ; .link $($(<).exe) : $($(>).exe) ; DEPENDS all : $($(<).exe) ; }}.jam jam : bjam ;# Scan sources for header dependencies.# WARNING: Yes those are *REAL TABS* below. DO NOT CHANGE,# under any circumstances, to spaces!! And the tabs# indenting this are so that if someone is in the mood to# replace tabs they hit this comment, and hopefully notice# their error.rule .scan{ HDRRULE on $(<:D=) = .hdr.scan ; HDRSCAN on $(<:D=) = "^[ ]*#[ ]*include[ ]*([<\"][^\">]*[\">]).*$" ;}rule .hdr.scan{ local hdrs = [ GLOB . : $(>:D=) ] ; INCLUDES $(<:D=) : $(hdrs:D=) ; HDRRULE on $(>:D=) = .hdr.scan ; HDRSCAN on $(>:D=) = "^[ ]*#[ ]*include[ ]*([<\"][^\">]*[\">]).*$" ;}.scan [ GLOB . : *.c ] ;# Distribution making from here on out. Assumes that# the docs are already built as html at ../doc/html. If# they aren't, then the docs are not included in the dist# archive.dist.license = [ GLOB . : $(LICENSE).txt ] ;dist.license = $(dist.license:D=) [ GLOB [ .path .. .. .. ] : $(LICENSE).txt ] [ GLOB [ .path .. boost ] : $(LICENSE).txt ] ;dist.docs = [ GLOB . : *.png *.css *.html ] ;dist.docs = $(dist.docs:D=) [ GLOB [ .path images ] : *.png ] [ GLOB [ .path jam ] : *.html ] ;dist.source = [ GLOB . : *.c *.h ] ;dist.source = $(dist.source:D=) $(dist.license[1]) $(dist.docs) build.jam build.bat build.sh build_vms.com Jambase jamgram.y jamgram.yy [ .path modules set.c ] [ .path modules path.c ] [ .path modules regex.c ] [ .path modules property-set.c ] [ .path modules sequence.c ] [ .path modules order.c ] [ GLOB [ .path boehm_gc ] : * ] [ GLOB [ .path boehm_gc include ] : * ] [ GLOB [ .path boehm_gc include private ] : * ] [ GLOB [ .path boehm_gc cord ] : * ] [ GLOB [ .path boehm_gc Mac_files ] : * ] [ GLOB [ .path boehm_gc tests ] : * ] [ GLOB [ .path boehm_gc doc ] : * ] ;dist.bin = bjam ;dist.bin = $(dist.license[1]) $(dist.bin:S=$(bjam.exe:S)) ;if $(NT){ zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7z.exe" ] ; zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7zn.exe" ] ; zip ?= [ GLOB $(PATH) : zip.exe ] ; zip ?= zip ; zip = $(zip[1]) ; switch $(zip:D=:S=) { case 7z* : zip += a -r -tzip -mx=9 ; case zip : zip += -9r ; } actions piecemeal [PACK] { "$(zip)" "$(<)" "$(>)" } actions piecemeal [ZIP] { "$(zip)" "$(<)" "$(>)" } actions piecemeal [COPY] { copy /Y "$(>)" "$(<)" >NUL: }}if $(UNIX){ tar ?= [ GLOB $(PATH) : star bsdtar tar ] ; tar = $(tar[1]) ; switch $(tar:D=:S=) { case star : tar += -c artype=pax -D -d -to-stdout ; case * : tar += -c -f - ; } actions [PACK] { "$(tar)" "$(>)" | gzip -c9 > "$(<)" } #~ actions [PACK] { #~ tar cf "$(<:S=.tar)" "$(>)" #~ } actions [ZIP] { gzip -c9 "$(>)" > "$(<)" } actions [COPY] { cp -Rpf "$(>)" "$(<)" }}# The single binary, compressed.rule .binary{ local zip = ; if $(NT) { zip = $($(<).exe:S=.zip) ; } if $(UNIX) { zip = $($(<).exe:S=.tgz) ; } zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ; DEPENDS $(zip) : $($(<).exe) ; DEPENDS dist : $(zip) ; #~ LOCATE on $(zip) = $(locate-target) ; if $(NT) { [ZIP] $(zip) : $($(<).exe) ; } if $(UNIX) { [PACK] $(zip) : $($(<).exe) ; } .clean $(zip) ;}# Package some file.rule .package ( dst-dir : src-files + ){ local dst-files ; local src-files-actual ; for local src-path in $(src-files) { if ! [ GLOB $(src-path:P) : $(src-path:B) ] || [ CHECK_IF_FILE $(src-path) ] { local src-subdir = $(src-path:D) ; local src-file = $(src-path) ; while $(src-subdir:D) { src-subdir = $(src-subdir:D) ; } if $(src-subdir) = ".." { src-file = $(src-file:D=) ; } dst-files += $(src-file:R=$(dst-dir)) ; src-files-actual += $(src-path) ; } } local pack = ; if $(NT) { pack = $(dst-dir).zip ; } if $(UNIX) { pack = $(dst-dir).tgz ; } DEPENDS dist : $(pack) ; DEPENDS $(pack) : $(dst-files) ; local dst-files-queue = $(dst-files) ; for local src-path in $(src-files-actual) { local dst-file = $(dst-files-queue[1]) ; dst-files-queue = $(dst-files-queue[2-]) ; DEPENDS $(dst-file) : $(src-path) $(dst-file:D) ; .mkdir $(dst-file:D) ; [COPY] $(dst-file) : $(src-path) ; .clean $(dst-file) ; } [PACK] $(pack) : $(dst-files) ; .clean $(pack) ;}# RPM distro file.rpm-tool = [ GLOB $(PATH) : "rpmbuild" ] ;rpm-tool ?= [ GLOB $(PATH) : "rpm" ] ;rpm-tool = $(rpm-tool[1]) ;rule .rpm ( name : source ){ local rpm-arch = ; switch $(OSPLAT) { case X86 : rpm-arch ?= i386 ; case PPC : rpm-arch ?= ppc ; case AXP : rpm-arch ?= alpha ; # no guaranty for these: case IA64 : rpm-arch ?= ia64 ; case ARM : rpm-arch ?= arm ; case SPARC : rpm-arch ?= sparc ; case * : rpm-arch ?= other ; } local target = $(name)-rpm ; NOTFILE $(target) ; DEPENDS dist : $(target) ; DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ; DEPENDS $(name).$(rpm-arch).rpm : $(source) ; DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ; docs on $(target) = $(dist.docs:J=" ") ; arch on $(target) = $(rpm-arch) ; if $(rpm-arch) = ppc { target-opt on $(target) = --target= ; } else { target-opt on $(target) = "--target " ; } [RPM] $(target) : $(source) ; .clean $(name).$(rpm-arch).rpm $(name).src.rpm ;}actions [RPM] { set -e export BOOST_JAM_TOOLSET="$(toolset)" $(rpm-tool) -ta $(target-opt)$(arch) $(>) | tee rpm.out cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` . rm -f rpm.out}# The distribution targets. Don't bother with the targets if# distribution build not requested.if dist in $(ARGV){ #~ .binary bjam ; .package $(NAME)-$(VERSION) : $(dist.source) ; .package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ; if $(rpm-tool) { #~ .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -