Imported Upstream version 1.51.0
[platform/upstream/boost.git] / tools / build / v2 / tools / cray.jam
1 # Copyright 2001 David Abrahams.
2 # Copyright 2004, 2005 Markus Schoepflin.
3 # Copyright 2011, John Maddock
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7 #
8 # Cray C++ Compiler
9 # See http://docs.cray.com/books/S-2179-50/html-S-2179-50/S-2179-50-toc.html
10 #
11
12 import feature generators common ;
13 import toolset : flags ;
14
15 feature.extend toolset : cray ;
16
17 # Inherit from Unix toolset to get library ordering magic.
18 toolset.inherit  cray : unix ;
19
20 generators.override cray.prebuilt : builtin.lib-generator ;
21 generators.override cray.prebuilt : builtin.prebuilt ;
22 generators.override cray.searched-lib-generator : searched-lib-generator ;
23
24
25 rule init ( version ? : command * : options * )
26 {
27     local condition = [ common.check-init-parameters cray : version $(version) ] ;
28     
29     local command = [ common.get-invocation-command cray : CC : $(command) ] ;
30     
31     if $(command)
32     {
33         local root = [ common.get-absolute-tool-path $(command[-1]) ] ;
34
35         if $(root)
36         {
37             flags cray .root $(condition) : "\"$(root)\"/" ;
38         }        
39     }      
40     # If we can't find 'CC' anyway, at least show 'CC' in the commands
41     command ?= CC ;
42         
43     common.handle-options cray : $(condition) : $(command) : $(options) ;               
44 }
45
46 generators.register-c-compiler cray.compile.c++ : CPP : OBJ : <toolset>cray ;
47 generators.register-c-compiler cray.compile.c : C : OBJ : <toolset>cray ;
48
49
50
51 # No static linking as far as I can tell.
52 # flags cxx LINKFLAGS <runtime-link>static : -bstatic ;
53 flags cray.compile OPTIONS <debug-symbols>on : -Gn ;
54 flags cray.link OPTIONS <debug-symbols>on : -Gn ;
55
56 flags cray.compile OPTIONS <optimization>off : -O0 ;
57 flags cray.compile OPTIONS <optimization>speed : -O3 ;
58 flags cray.compile OPTIONS <optimization>space : -O1 ;
59
60 flags cray.compile OPTIONS <cflags> ;
61 flags cray.compile.c++ OPTIONS <cxxflags> ;
62 flags cray.compile DEFINES <define> ;
63 flags cray.compile INCLUDES <include> ;
64 flags cray.link OPTIONS <linkflags> ;
65
66 flags cray.link LIBPATH <library-path> ;
67 flags cray.link LIBRARIES <library-file> ;
68 flags cray.link FINDLIBS-ST <find-static-library> ;
69 flags cray.link FINDLIBS-SA <find-shared-library> ;
70
71 actions link bind LIBRARIES
72 {
73     $(CONFIG_COMMAND) $(OPTIONS) -o "$(<)" -L$(LIBPATH) "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA)
74 }
75
76 # When creating dynamic libraries, we don't want to be warned about unresolved
77 # symbols, therefore all unresolved symbols are marked as expected by
78 # '-expect_unresolved *'. This also mirrors the behaviour of the GNU tool
79 # chain.
80
81 actions link.dll bind LIBRARIES
82 {
83     $(CONFIG_COMMAND) -shared $(OPTIONS) -o "$(<[1])" -L$(LIBPATH)  "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA)
84 }
85
86
87 # Note: Relaxed ANSI mode (-std) is used for compilation because in strict ANSI
88 # C89 mode (-std1) the compiler doesn't accept C++ comments in C files. As -std
89 # is the default, no special flag is needed.
90 actions compile.c
91 {
92     $(.root:E=)cc -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
93 }
94
95 # Note: The compiler is forced to compile the files as C++ (-x cxx) because
96 # otherwise it will silently ignore files with no file extension.
97 #
98 # Note: We deliberately don't suppress any warnings on the compiler command
99 # line, the user can always do this in a customized toolset later on.
100
101 actions compile.c++
102 {
103     $(CONFIG_COMMAND) -c -h gnu $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
104 }
105
106 # Always create archive from scratch. See the gcc toolet for rationale.
107 RM = [ common.rm-command ] ;
108 actions together piecemeal archive
109 {
110   $(RM) "$(<)"
111   ar rc $(<) $(>)
112 }