mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 13:22:11 +00:00
66 lines
2.1 KiB
Plaintext
66 lines
2.1 KiB
Plaintext
# Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
|
|
# distribute this software is granted provided this copyright notice appears in
|
|
# all copies. This software is provided "as is" without express or implied
|
|
# warranty, and with no claim as to its suitability for any purpose.
|
|
|
|
# This module defines the 'alias' rule and associated class.
|
|
#
|
|
# Alias is just a main target which returns its source targets without any
|
|
# processing. For example::
|
|
#
|
|
# alias bin : hello test_hello ;
|
|
# alias lib : helpers xml_parser ;
|
|
#
|
|
# Another important use of 'alias' is to conveniently group source files::
|
|
#
|
|
# alias platform-src : win.cpp : <os>NT ;
|
|
# alias platform-src : linux.cpp : <os>LINUX ;
|
|
# exe main : main.cpp platform-src ;
|
|
#
|
|
# Lastly, it's possible to create local alias for some target, with different
|
|
# properties::
|
|
#
|
|
# alias big_lib : : @/external_project/big_lib/<link>static ;
|
|
#
|
|
|
|
import targets ;
|
|
import "class" : new ;
|
|
import property ;
|
|
import errors : error ;
|
|
import type : type ;
|
|
import regex ;
|
|
|
|
class alias-target-class : basic-target
|
|
{
|
|
rule __init__ ( name : project : sources * : requirements *
|
|
: default-build * : usage-requirements * )
|
|
{
|
|
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
|
|
: $(default-build) : $(usage-requirements) ;
|
|
}
|
|
|
|
rule construct ( source-targets * : property-set )
|
|
{
|
|
return $(source-targets) ;
|
|
}
|
|
}
|
|
|
|
# Declares the 'alias' target. It will build sources, and return them unaltered.
|
|
rule alias ( name : sources * : requirements * : default-build * : usage-requirements * )
|
|
{
|
|
local project = [ CALLER_MODULE ] ;
|
|
|
|
targets.main-target-alternative
|
|
[ new alias-target-class $(name) : $(project)
|
|
: [ targets.main-target-sources $(sources) : $(name) ]
|
|
: [ targets.main-target-requirements $(requirements) : $(project) ]
|
|
: [ targets.main-target-default-build $(default-build) : $(project) ]
|
|
: [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
|
|
] ;
|
|
}
|
|
|
|
IMPORT $(__name__) : alias : : alias ;
|
|
|
|
|
|
|