2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 13:22:11 +00:00
Files
build/gcc.jam
Vladimir Prus aff4d03e33 Work on BB5. Mininal version of toolset initialization implemented.
* new/gcc.jam (init): New rule. Allows to specify alternative
    gcc versions.

* new/toolset.jam
    (using): New rule.
    (set-target-variables): Bufgix. I was making indirect call
        via variable with multiple values.

* new/build-request.jam
   (looks-like-implicit-value): New rule.
   (from-command-line): Use the above.
   (convert-command-line-element): Don't validate
      elements with dashes (this probably must be fixed).


[SVN r16468]
2002-12-02 07:20:37 +00:00

84 lines
2.8 KiB
Plaintext

import property ;
import generators ;
import os ;
feature.extend toolset : gcc ;
feature.subfeature toolset gcc : version : : optional ;
# Initializes the gcc toolset
# Each argument has the form:
# version binary-name [path]
# And specifies the name / path that should be used to invoke
# the specified gcc version. The default version will be always called
# with 'g++'.
rule init ( a1 * : a2 * : a3 * )
{
if $(a1)
{
local version = $(a1[1]) ;
local name = $(a1[2]) ;
local path = $(a1[3]) ;
feature.extend-subfeature toolset gcc : version : $(version) ;
# NOTE: this should be collapsed in one line once
# 'toolset.flags' supports specifying module name.
toolset.flags gcc.compile NAME <toolset>gcc/<toolset-version>$(version) : $(name) ;
toolset.flags gcc.link NAME <toolset>gcc/<toolset-version>$(version) : $(name) ;
toolset.flags gcc.link-dll NAME <toolset>gcc/<toolset-version>$(version) : $(name) ;
# TODO: set path accordingly.
}
}
# Declare generators
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 ;
# Declare flags and action for compilation
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
{
$(NAME:E=g++) -ftemplate-depth-100 $(OPTIONS) -D$(DEFINES) -I$(INCLUDES) -c -o $(<) $(>)
}
# Declare flags and action for linking
toolset.flags gcc.link OPTIONS <debug-symbols>on : -g ;
toolset.flags gcc.link LINKPATH <library-path> ;
toolset.flags gcc.link FINDLIBS <find-library> ;
toolset.flags gcc.link LIBRARIES <library-file> ;
toolset.flags gcc.link LIBRARIES <library> ;
actions link bind LIBRARIES
{
$(NAME:E=g++) $(OPTIONS) -L$(LINKPATH) -o $(<) $(>) $(LIBRARIES) -l$(FINDLIBS)
}
# Declare action for creating static libraries
actions archive
{
ar ur $(<) $(>)
}
# Declare flags and action for linking shared libraries
toolset.flags gcc.link-dll OPTIONS <debug-symbols>on : -g ;
toolset.flags gcc.link-dll LINKPATH <library-path> ;
toolset.flags gcc.link-dll FINDLIBS <find-library> ;
toolset.flags gcc.link-dll LIBRARIES <library-file> ;
toolset.flags gcc.link-dll LIBRARIES <library> ;
actions link-dll bind LIBS
{
$(NAME:E=g++) $(OPTIONS) -o $(<) -Wl,-soname,$(<[1]:D=) -shared $(>) $(LIBS) $(FINDLIBS)
}