1 # Copyright 2006 Noel Belcourt
2 # Distributed under the Boost Software License, Version 1.0.
3 # (See accompanying file LICENSE_1_0.txt or copy at
4 # http://www.boost.org/LICENSE_1_0.txt)
8 import toolset : flags ;
15 feature.extend toolset : pathscale ;
16 toolset.inherit pathscale : unix ;
17 generators.override pathscale.prebuilt : builtin.prebuilt ;
18 generators.override pathscale.searched-lib-generator : searched-lib-generator ;
20 # Documentation and toolchain description located
21 # http://www.pathscale.com/docs.html
23 rule init ( version ? : command * : options * )
25 command = [ common.get-invocation-command pathscale : pathCC : $(command)
26 : /opt/ekopath/bin ] ;
28 # Determine the version
29 local command-string = $(command:J=" ") ;
32 version ?= [ MATCH "^([0-9.]+)"
33 : [ SHELL "$(command-string) -dumpversion" ] ] ;
36 local condition = [ common.check-init-parameters pathscale
37 : version $(version) ] ;
39 common.handle-options pathscale : $(condition) : $(command) : $(options) ;
41 toolset.flags pathscale.compile.fortran90 OPTIONS $(condition) :
42 [ feature.get-values <fflags> : $(options) ] : unchecked ;
44 command_c = $(command_c[1--2]) $(command[-1]:B=pathcc) ;
46 toolset.flags pathscale CONFIG_C_COMMAND $(condition) : $(command_c) ;
49 local f-command = [ common.get-invocation-command pathscale : pathf90 : $(command) ] ;
50 local command_f = $(command_f[1--2]) $(f-command[-1]:B=pathf90) ;
51 local command_f90 = $(command_f[1--2]) $(f-command[-1]:B=pathf90) ;
53 toolset.flags pathscale CONFIG_F_COMMAND $(condition) : $(command_f) ;
54 toolset.flags pathscale CONFIG_F90_COMMAND $(condition) : $(command_f90) ;
56 # always link lib rt to resolve clock_gettime()
57 flags pathscale.link FINDLIBS-SA : rt : unchecked ;
62 toolset.flags pathscale.link RPATH_OPTION $(condition) : -Wl,-R, -Wl, : unchecked ;
65 toolset.flags pathscale.link RPATH_OPTION $(condition) : -Wl,-rpath= : unchecked ;
70 generators.register-c-compiler pathscale.compile.c : C : OBJ : <toolset>pathscale ;
71 generators.register-c-compiler pathscale.compile.c++ : CPP : OBJ : <toolset>pathscale ;
72 generators.register-fortran-compiler pathscale.compile.fortran : FORTRAN : OBJ : <toolset>pathscale ;
73 generators.register-fortran90-compiler pathscale.compile.fortran90 : FORTRAN90 : OBJ : <toolset>pathscale ;
75 # Declare flags and actions for compilation
76 flags pathscale.compile OPTIONS <optimization>off : -O0 ;
77 flags pathscale.compile OPTIONS <optimization>speed : -O3 ;
78 flags pathscale.compile OPTIONS <optimization>space : -Os ;
80 flags pathscale.compile OPTIONS <inlining>off : -noinline ;
81 flags pathscale.compile OPTIONS <inlining>on : -inline ;
82 flags pathscale.compile OPTIONS <inlining>full : -inline ;
84 flags pathscale.compile OPTIONS <warnings>off : -woffall ;
85 flags pathscale.compile OPTIONS <warnings>on : -Wall ;
86 flags pathscale.compile OPTIONS <warnings>all : -Wall -pedantic ;
87 flags pathscale.compile OPTIONS <warnings-as-errors>on : -Werror ;
89 flags pathscale.compile OPTIONS <debug-symbols>on : -ggdb ;
90 flags pathscale.compile OPTIONS <profiling>on : -pg ;
91 flags pathscale.compile OPTIONS <link>shared : -fPIC ;
92 flags pathscale.compile OPTIONS <address-model>32 : -m32 ;
93 flags pathscale.compile OPTIONS <address-model>64 : -m64 ;
95 flags pathscale.compile USER_OPTIONS <cflags> ;
96 flags pathscale.compile.c++ USER_OPTIONS <cxxflags> ;
97 flags pathscale.compile DEFINES <define> ;
98 flags pathscale.compile INCLUDES <include> ;
100 flags pathscale.compile.fortran USER_OPTIONS <fflags> ;
101 flags pathscale.compile.fortran90 USER_OPTIONS <fflags> ;
105 "$(CONFIG_C_COMMAND)" $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
110 "$(CONFIG_COMMAND)" $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
113 actions compile.fortran
115 "$(CONFIG_F_COMMAND)" $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
118 rule compile.fortran90 ( targets * : sources * : properties * )
120 # the space rule inserts spaces between targets and it's necessary
121 SPACE on $(targets) = " " ;
122 # Serialize execution of the compile.fortran90 action
123 # F90 source must be compiled in a particular order so we
124 # serialize the build as a parallel F90 compile might fail
125 JAM_SEMAPHORE on $(targets) = <s>pathscale-f90-semaphore ;
128 actions compile.fortran90
130 "$(CONFIG_F90_COMMAND)" $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -module $(<[1]:D) -c -o "$(<)" "$(>)"
133 # Declare flags and actions for linking
134 flags pathscale.link OPTIONS <debug-symbols>on : -ggdb -rdynamic ;
135 # Strip the binary when no debugging is needed
136 flags pathscale.link OPTIONS <debug-symbols>off : -g0 ;
137 flags pathscale.link OPTIONS <profiling>on : -pg ;
138 flags pathscale.link USER_OPTIONS <linkflags> ;
139 flags pathscale.link LINKPATH <library-path> ;
140 flags pathscale.link FINDLIBS-ST <find-static-library> ;
141 flags pathscale.link FINDLIBS-SA <find-shared-library> ;
142 flags pathscale.link FINDLIBS-SA <threading>multi : pthread ;
143 flags pathscale.link LIBRARIES <library-file> ;
144 flags pathscale.link LINK-RUNTIME <runtime-link>static : static ;
145 flags pathscale.link LINK-RUNTIME <runtime-link>shared : dynamic ;
146 flags pathscale.link RPATH <dll-path> ;
147 # On gcc, there are separate options for dll path at runtime and
148 # link time. On Solaris, there's only one: -R, so we have to use
149 # it, even though it's bad idea.
150 flags pathscale.link RPATH <xdll-path> ;
152 rule link ( targets * : sources * : properties * )
154 SPACE on $(targets) = " " ;
157 actions link bind LIBRARIES
159 "$(CONFIG_COMMAND)" $(OPTIONS) $(USER_OPTIONS) -L"$(LINKPATH)" $(RPATH_OPTION:E=-Wl,-rpath=)"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST)
162 # Slight mods for dlls
163 rule link.dll ( targets * : sources * : properties * )
165 SPACE on $(targets) = " " ;
168 actions link.dll bind LIBRARIES
170 "$(CONFIG_COMMAND)" $(OPTIONS) $(USER_OPTIONS) -L"$(LINKPATH)" $(RPATH_OPTION:E=-Wl,-rpath=)"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST)
173 # Declare action for creating static libraries
174 # "$(CONFIG_COMMAND)" -ar -o "$(<)" "$(>)"
175 actions piecemeal archive
177 ar $(ARFLAGS) ru "$(<)" "$(>)"