diff --git a/Jamrules b/Jamrules index 764cb88d06..88f148f20e 100644 --- a/Jamrules +++ b/Jamrules @@ -1240,12 +1240,25 @@ rule PrependObjectHdrs rule SymLink { - # SymLink : ; + # SymLink : : ; # Links to . # is the exact link contents. No binding is done. - LINKCONTENTS on $(1) = $(2) ; - SymLink1 $(1) ; - LocalDepends all : $(target) ; + # If true, will be made a dependency + # of the `all' pseudo target, i.e. it will be made by default, and removed + # on `jam clean'. + + local target = $(1) ; + local source = $(2) ; + local makeDefaultDependencies = $(3) ; + if ! $(makeDefaultDependencies) { + makeDefaultDependencies = true ; + } + LINKCONTENTS on $(target) = $(source) ; + SymLink1 $(target) ; + if $(makeDefaultDependencies) = true { + LocalDepends files : $(target) ; + LocalClean clean : $(target) ; + } } actions SymLink1 @@ -1255,14 +1268,18 @@ actions SymLink1 rule RelSymLink { - # RelSymLink : + # RelSymLink : : ; # Creates a relative symbolic link from to . # and can be usual targets. They may have a grist # and don't need to have any dirname. Their LOCATE variables are used to # find their locations. + # If true (which is the default), will be + # made a dependency of the `files' pseudo target, i.e. it will be made by + # default, and removed on `jam clean'. local target = $(1) ; local source = $(2) ; + local makeDefaultDependencies = $(3) ; local targetDir = [ on $(target) FDirName $(LOCATE[1]) $(target:D) ] ; local sourceDir = [ on $(source) FDirName $(LOCATE[1]) $(source:D) ] ; local sourcePath = $(source:G=) ; @@ -1271,26 +1288,37 @@ rule RelSymLink local sourceComponents = [ SplitPath $(sourcePath) ] ; SymLink $(target) - : [ FRelPath $(targetDirComponents) : $(sourceComponents) ] ; + : [ FRelPath $(targetDirComponents) : $(sourceComponents) ] + : $(makeDefaultDependencies) ; NOUPDATE $(target) ; Depends $(target) : $(source) ; - LocalClean clean : $(target) ; } rule AbsSymLink { - # AbsSymLink : : + # AbsSymLink : : + # : ; # Creates an absolute symbolic link from to . # and must be usual targets. If is # given, then it is set as LOCATE directory on . + # If true (which is the default), will be + # made a dependency of the `files' pseudo target, i.e. it will be made by + # default, and removed on `jam clean'. + + local makeDefaultDependencies = $(4) ; + if ! $(makeDefaultDependencies) { + makeDefaultDependencies = true ; + } - LocalDepends files : $(1) ; Depends $(1) : $(2) ; if $(3) { MakeLocate $(1) : $(3) ; } SEARCH on $(2) += $(SEARCH_SOURCE) ; - LocalClean clean : $(1) ; + if $(makeDefaultDependencies) = true { + LocalDepends files : $(1) ; + LocalClean clean : $(1) ; + } } actions AbsSymLink @@ -1349,12 +1377,21 @@ rule OBOSInstall } } +rule InstallAbsSymLinkAdapter +{ + # InstallAbsSymLinkAdapter : + if ! [ on $(2) return $(TARGET) ] { + TARGET on $(2) = [ on $(2) return $(SEARCH) ] ; + } + AbsSymLink $(1) : $(2) : : false ; +} + rule OBOSInstallAbsSymLink { # Usage: OBOSInstallAbsSymLink <[ install [ and uninstall ] pseudotarget ]> # : : # : [ ] ; - OBOSInstall $(1) : $(2) : $(3) : $(4) : AbsSymLink ; + OBOSInstall $(1) : $(2) : $(3) : $(4) : InstallAbsSymLinkAdapter ; } rule InstallRelSymLinkAdapter @@ -1363,7 +1400,7 @@ rule InstallRelSymLinkAdapter if ! [ on $(2) return $(TARGET) ] { TARGET on $(2) = [ on $(2) return $(SEARCH) ] ; } - RelSymLink $(1) : $(2) ; + RelSymLink $(1) : $(2) : false ; } rule OBOSInstallRelSymLink