92 lines
2.1 KiB
Plaintext
92 lines
2.1 KiB
Plaintext
|
|
import property ;
|
|
import generators ;
|
|
import os ;
|
|
|
|
generators.register-composing gcc.link : LIB OBJ : EXE : <toolset>gcc ;
|
|
generators.register-composing gcc.archive : OBJ : STATIC_LIB : <toolset>gcc ;
|
|
generators.register-composing gcc.link-dll : OBJ : SHARED_LIB : <toolset>gcc ;
|
|
generators.register-c-compiler gcc.compile : CPP : OBJ : <toolset>gcc ;
|
|
generators.register-c-compiler gcc.compile : C : OBJ : <toolset>gcc ;
|
|
|
|
|
|
rule compile ( target : sources * : property-set * )
|
|
{
|
|
}
|
|
|
|
toolset.flags gcc.compile OPTIONS <optimization>on : -O2 ;
|
|
toolset.flags gcc.compile OPTIONS <debug-symbols>on : -g ;
|
|
toolset.flags gcc.compile OPTIONS <cxxflags> ;
|
|
toolset.flags gcc.compile DEFINES <define> ;
|
|
toolset.flags gcc.compile INCLUDES <include> ;
|
|
|
|
actions compile
|
|
{
|
|
g++ -ftemplate-depth-100 $(OPTIONS) -D$(DEFINES) -I$(INCLUDES) -c -o $(<) $(>)
|
|
}
|
|
|
|
local rule link-options ( target : sources * : property-set * )
|
|
{
|
|
local options ;
|
|
local libs ;
|
|
local findlibs ;
|
|
for local p in $(property-set)
|
|
{
|
|
if $(p) = <debug-symbols>on
|
|
{
|
|
options += -g ;
|
|
}
|
|
else if $(p:G) = <library-path>
|
|
{
|
|
options += -L$(p:G=) ;
|
|
}
|
|
else if $(p:G) = <find-library>
|
|
{
|
|
findlibs += -l$(p:G=) ;
|
|
}
|
|
else if $(p:G) = <library-file>
|
|
{
|
|
libs += $(p:G=) ;
|
|
}
|
|
else if $(p:G) = <library>
|
|
{
|
|
libs += [ $(p:G=).actualize ] ;
|
|
}
|
|
}
|
|
|
|
DEPENDS $(target) : $(LIBS) ;
|
|
|
|
OPTIONS on $(target) = $(options) ;
|
|
LIBS on $(target) = $(libs) ;
|
|
FINDLIBS on $(target) = $(findlibs) ;
|
|
}
|
|
|
|
rule link ( target : sources * : property-set * )
|
|
{
|
|
link-options $(target) : $(sources) : $(property-set) ;
|
|
}
|
|
|
|
actions link bind LIBS
|
|
{
|
|
g++ $(OPTIONS) -o $(<) $(>) $(LIBS) $(FINDLIBS)
|
|
}
|
|
|
|
rule archive ( target : sources * : property-set * )
|
|
{
|
|
}
|
|
|
|
actions archive
|
|
{
|
|
ar ur $(<) $(>)
|
|
}
|
|
|
|
rule link-dll ( target : sources * : property-set * )
|
|
{
|
|
link-options $(target) : $(sources) : $(property-set) ;
|
|
}
|
|
|
|
actions link-dll bind LIBS
|
|
{
|
|
g++ $(OPTIONS) -o $(<) -Wl,-soname,$(<[1]:D=) -shared $(>) $(LIBS) $(FINDLIBS)
|
|
}
|