📄 allyourbase.jam
字号:
{
local reverse-path = [ reverse $(<) ] ;
local dotdots ;
local result ;
local token ;
for token in $(reverse-path)
{
if $(token) = $(DOT)
{
}
else if $(token) = $(DOTDOT)
{
dotdots += $(token) ;
}
else if $(dotdots)
{
dotdots = $(dotdots[2-]) ;
}
else
{
result = $(token) $(result) ;
}
}
result = $(dotdots) $(result) ;
result = [ strip-initial $($(gTOP)_TOKENS) $(gINVOCATION_SUBDIR_TOKENS) : $(result) ] ;
result ?= $(>) ;
return $(result) ;
}
rule tokens-to-simple-path
{
return [ FDirName [ simplify-path-tokens $(<) ] ] ;
}
rule SubDirCcFlags
{
SUBDIRCCFLAGS += $(<) ;
}
rule SubDirC++Flags
{
SUBDIRC++FLAGS += $(<) ;
}
rule SubDirHdrs
{
SUBDIRHDRS += $(<) ;
}
rule SubInclude
{
local _s ;
# That's
# SubInclude TOP d1 [ d2 [ d3 [ d4 ] ] ]
#
# to include a subdirectory's Jamfile.
if ! $($(<[1]))
{
EXIT Top level of source tree has not been set with $(<[1]) ;
}
_s = [ FDirName $(<[2-]) ] ;
# protect variables from being permanently set by SubDir invocations
# in included files.
local project = $(PROJECT) ;
local [ protect-subdir ] ;
PROJECT = $(project) ;
local jamfile-path
= [ tokens-to-simple-path
[ split-path $(JAMFILE:D=$(_s):R=$($(<[1]))) ] ] ;
load-jamfiles $(jamfile-path) ;
}
# Load a user's Jamfile(s).
#
rule load-jamfiles ( jamfiles * )
{
# First we load the Jamfiles without generation of main targets so that
# dependencies are preloaded. Then we reload the files with target
# generation enabled.
local jamfile ;
local as-dependant = $(gIN_LIB_INCLUDE) ;
local gIN_LIB_INCLUDE ;
gIN_LIB_INCLUDE = TRUE ;
for jamfile-path in $(jamfiles)
{
if ! $(gINCLUDED_AS_DEPENDANT($(jamfile-path)))
{
gINCLUDED_AS_DEPENDANT($(jamfile-path)) = TRUE ;
include $(jamfile-path) ;
}
}
if ! $(as-dependant)
{
gIN_LIB_INCLUDE = ;
for jamfile-path in $(jamfiles)
{
if ! $(gINCLUDED($(jamfile-path)))
{
gINCLUDED($(jamfile-path)) = TRUE ;
include $(jamfile-path) ;
}
}
}
}
rule Undefines
{
UNDEFS on [ FAppendSuffix $(<) : $(SUFEXE) ] += $(UNDEFFLAG)$(>) ;
}
rule UserObject
{
EXIT "Unknown suffix on" $(>) "- see UserObject rule in Jamfile(5)." ;
}
# dwa 6/4/01 - modified for boost
rule Yacc
{
local _h ;
# Can't just replace .cpp with .h, because bison seems to generate a .cpp.h file
_h = $(<).h ;
# Some places don't have a yacc.
MakeLocate $(<) $(_h) : $(LOCATE_SOURCE) ;
SEARCH on $(<) $(_h) = $(LOCATE_SOURCE) ;
if $(YACC)
{
DEPENDS $(<) $(_h) : $(>) ;
# if YACC can accept an output file, we'll just generate the file there.
YACCFILES on $(<) $(_h) = [ join-path $(LOCATE_SOURCE) $(<[1]) ] ;
Yacc1 $(<) $(_h) : $(>) ;
if ! $(YACC_OUTPUT)
{
YaccMv $(<) $(_h) : $(>) ;
}
Clean clean : $(<) $(_h) ;
}
# make sure someone includes $(_h) else it will be
# a deadly independent target
INCLUDES $(<) : $(_h) ;
}
rule remember-binding ( target : bound-path ) {
gBINDING($(target)) = $(bound-path) ;
}
rule subst-list ( list + : pattern ) {
local result ;
for local i in $(list) {
result += [ MATCH "($(pattern))" : $(i) ] ;
}
return $(result) ;
}
#
# Utility rules; no side effects on these
#
rule FGrist
{
# Turn individual elements in $(<) into grist.
local _g _i ;
_g = $(<[1]) ;
for _i in $(<[2-])
{
_g = $(_g)!$(_i) ;
}
return $(_g) ;
}
rule FGristFiles
{
if ! $(SOURCE_GRIST)
{
return $(<) ;
}
else
{
return $(<:G=$(SOURCE_GRIST)) ;
}
}
# dwa 6/4/01 - modified for boost
rule FGristSourceFiles
{
# Produce source file name name with grist in it,
# if SOURCE_GRIST is set.
# Leave header files alone, because they have a global
# visibility.
if ! $(SOURCE_GRIST)
{
return $(<) ;
}
else
{
local _i _o ;
for _i in $(<)
{
switch $(_i)
{
case *.h : _o += $(_i) ;
case *.hpp : _o += $(_i) ;
case * : _o += $(_i:G=$(SOURCE_GRIST)) ;
}
}
return $(_o) ;
}
}
# dwa 6/4/01 - modified for boost
# join values... : [separator]
#
# Pastes values together into a single list element, separated by an optional separator.
rule join ( values * : sep ? )
{
sep ?= "" ;
return $(values:J=$(sep)) ;
}
# Given $(<), the tokens comprising a relative path from D1 to a subdirectory
# D2, return the relative path from D2 to D1, using ../../ etc.
rule FSubDir
{
local _d ;
if ! $(<[1])
{
_d = $(DOT) ;
}
else
{
_d = $(DOTDOT) ;
local _i ;
for _i in $(<[2-])
{
_d = $(_d:R=$(DOTDOT)) ;
}
}
return $(_d) ;
}
# dwa 6/4/01 - added for boost
# Turn individual elements in $(<) into a usable path. If $(<) is empty, $(>) is
# returned.
rule join-path
{
local _s _i ;
if ! $(<)
{
_s = $(>) ;
}
else if $(VMS)
{
# This handles the following cases:
# a -> [.a]
# a b c -> [.a.b.c]
# x: -> x:
# x: a -> x:[a]
# x:[a] b -> x:[a.b]
switch $(<[1])
{
case *:* : _s = $(<[1]) ;
case \\[*\\] : _s = $(<[1]) ;
case * : _s = [.$(<[1])] ;
}
for _i in [.$(<[2-])]
{
_s = $(_i:R=$(_s)) ;
}
}
else if $(MAC)
{
_s = $(DOT) ;
for _i in $(<)
{
_s = $(_i:R=$(_s)) ;
}
}
else
{
_s = $(<[1]) ;
local _r = $(<[2-]) ;
# Jam doesn't handle the root directory properly
if $(_s) in / $(SLASH)
{
_s = $(_s)$(_r[1]) ;
_r = $(_r[2-]) ;
}
for _i in $(_r)
{
_s = $(_i:R=$(_s)) ;
}
}
return $(_s) ;
}
# dwa 6/4/01 - modified for boost
rule FDirName
{
# Turn individual elements in $(<) into a usable path.
return [ join-path $(<) : $(DOT) ] ;
}
rule _makeCommon
{
# strip common initial elements
if $($(<)[1]) && $($(<)[1]) = $($(>)[1])
{
$(<) = $($(<)[2-]) ;
$(>) = $($(>)[2-]) ;
_makeCommon $(<) : $(>) ;
}
}
rule FRelPath
{
local _l _r ;
# first strip off common parts
_l = $(<) ;
_r = $(>) ;
_makeCommon _l : _r ;
# now make path to root and path down
_l = [ FSubDir $(_l) ] ;
_r = [ FDirName $(_r) ] ;
# Concatenate and save
# XXX This should be better
if $(_r) = $(DOT) {
return $(_l) ;
} else {
return $(_r:R=$(_l)) ;
}
}
# dwa 6/17/01 - modified for boost to handle multiple suffixes
rule FAppendSuffix
{
# E.g., "FAppendSuffix yacc lex foo.bat : $(SUFEXE) ;"
# returns (yacc,lex,foo.bat) on Unix and
# (yacc.exe,lex.exe,foo.bat) on NT.
if $(>)
{
local _i _o ;
for _i in $(<)
{
if $(_i:S)
{
_o += $(_i) $(_i:S=$(>[2-])) ;
}
else
{
_o += $(_i:S=$(>)) ;
}
}
return $(_o) ;
}
else
{
return $(<) ;
}
}
rule unmakeDir
{
if $(>[1]:D) && $(>[1]:D) != $(>[1]) && $(>[1]:D) != \\\\
{
unmakeDir $(<) : $(>[1]:D) $(>[1]:BS) $(>[2-]) ;
}
else
{
$(<) = $(>) ;
}
}
#
# Actions
#
#
# First the defaults
#
actions As
{
$(AS) $(ASFLAGS) -I$(HDRS) -o $(<) $(>)
}
actions Chgrp
{
chgrp $(GROUP) $(<)
}
actions Chmod1
{
$(CHMOD) $(MODE) "$(<)"
}
actions Chown
{
chown $(OWNER) $(<)
}
actions piecemeal together existing Clean
{
$(RM) "$(>)"
}
actions File
{
$(CP) "$(>)" "$(<)"
}
actions FileClone
{
$(CLONE) "$(>)" "$(<)"
}
actions GenFile1
{
$(>[1]) $(<) $(>[2-])
}
actions Fortran
{
$(FORTRAN) $(FORTRANFLAGS) -o $(<) $(>)
}
actions HardLink
{
$(RM) $(<) && $(LN) $(>) $(<)
}
actions Install
{
$(CP) $(>) $(<)
}
# dwa 6/4/01 - modified for boost
actions together Lex
{
$(LEX) $(LEXFLAGS) $(LEX_OUTPUT)$(<) $(>)
}
# dwa 6/4/01 - modified for boost
actions together LexMv
{
$(MV) lex.yy.c $(<)
}
actions MkDir1
{
$(MKDIR) "$(<)"
}
actions together Ranlib
{
$(RANLIB) $(<)
}
actions quietly updated piecemeal together RmTemps
{
$(RM) $(>)
}
actions Shell
{
$(AWK) '
NR == 1 { print "$(SHELLHEADER)" }
NR == 1 && /^[#:]/ { next }
/^##/ { next }
{ print }
' < $(>) > $(<)
}
# dwa 6/4/01 - modified for boost
actions together Yacc1
{
$(YACC) $(YACCFLAGS) $(YACC_OUTPUT)$(<[1]) $(>)
}
# dwa 6/4/01 - modified for boost
actions together YaccMv
{
$(MV) $(YACCFILES).c $(<[1])
$(MV) $(YACCFILES).h $(<[2])
}
# dwa 6/4/01 - killed all platform-specific actions for boost
# dwa 6/4/01 - modified for boost
actions together Yacc-fix-line-directives
{
$(YACC_FIX_LINES) $(<) > $(<)
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -