]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | # Copyright 2015, Wind River Inc. |
2 | # Distributed under the Boost Software License, Version 1.0. | |
3 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) | |
4 | ||
5 | # | |
6 | # Diab C++ Compiler | |
7 | # | |
8 | ||
9 | import feature generators common ; | |
10 | import toolset : flags ; | |
11 | import os ; | |
12 | ||
13 | feature.extend toolset : diab ; | |
14 | ||
15 | # Inherit from Unix toolset to get library ordering magic. | |
16 | toolset.inherit diab : unix ; | |
17 | ||
18 | generators.override diab.prebuilt : builtin.lib-generator ; | |
19 | generators.override diab.prebuilt : builtin.prebuilt ; | |
20 | generators.override diab.searched-lib-generator : searched-lib-generator ; | |
21 | ||
22 | ||
23 | rule init ( version ? : command * : options * ) | |
24 | { | |
25 | local condition = [ common.check-init-parameters diab : version $(version) ] ; | |
26 | ||
27 | local command = [ common.get-invocation-command diab : dcc : $(command) ] ; | |
28 | ||
29 | if $(command) | |
30 | { | |
31 | local root = [ common.get-absolute-tool-path $(command[-1]) ] ; | |
32 | ||
33 | if $(root) | |
34 | { | |
35 | flags diab .root <host-os>linux : "\"$(root)\"/" ; | |
36 | flags diab .root <host-os>windows : $(root:T)/ ; | |
37 | } | |
38 | } | |
39 | # If we can't find 'CC' anyway, at least show 'CC' in the commands | |
40 | command ?= CC ; | |
41 | ||
42 | common.handle-options diab : $(condition) : $(command) : $(options) ; | |
43 | } | |
44 | ||
45 | generators.register-c-compiler diab.compile.c++ : CPP : OBJ : <toolset>diab ; | |
46 | generators.register-c-compiler diab.compile.c : C : OBJ : <toolset>diab ; | |
47 | ||
48 | ||
92f5a8d4 | 49 | # unlike most compilers, Diab defaults to static linking. |
b32b8144 FG |
50 | # flags cxx LINKFLAGS <runtime-link>static : ; |
51 | flags diab.compile OPTIONS <debug-symbols>on : -g ; | |
52 | flags diab.link OPTIONS <debug-symbols>on : -g ; | |
53 | ||
54 | flags diab.compile OPTIONS <optimization>off : ; | |
55 | flags diab.compile OPTIONS <optimization>speed : -speed ; | |
56 | flags diab.compile OPTIONS <optimization>space : -size ; | |
57 | ||
58 | # flags diab.compile OPTIONS <inlining>off : -Xinline=0 ; | |
59 | # flags diab.compile OPTIONS <inlining>on : -Xinline=10 ; | |
60 | # flags diab.compile OPTIONS <inlining>full : -Xinline=50 ; | |
61 | ||
62 | flags diab.compile OPTIONS <cflags> ; | |
63 | flags diab.compile.c++ OPTIONS <cxxflags> ; | |
64 | flags diab.compile DEFINES <define> ; | |
65 | ||
11fdf7f2 | 66 | flags diab.compile.c++ OPTIONS <exception-handling>off : -Xno-exceptions ; |
b32b8144 | 67 | # So Dinkum STL knows when exceptions are disabled |
11fdf7f2 TL |
68 | flags diab.compile.c++ DEFINES <exception-handling>off : _NO_EX=1 ; |
69 | flags diab.compile.c++ DEFINES <rtti>off : _NO_RTTI ; | |
b32b8144 FG |
70 | flags diab.compile INCLUDES <include> ; |
71 | flags diab.link OPTIONS <linkflags> ; | |
72 | ||
73 | flags diab.compile OPTIONS <link>shared : -Xpic ; | |
74 | #flags diab.compile OPTIONS <link>static : ; | |
92f5a8d4 | 75 | # get VxWorks link options from shell environment |
b32b8144 FG |
76 | flags diab.link OPTIONS <link>static : [ os.environ LDFLAGS_STATIC ] ; |
77 | flags diab.link.dll OPTIONS : [ os.environ LDFLAGS_SO ] ; | |
78 | flags diab.link OPTIONS <link>shared : [ os.environ LDFLAGS_DYNAMIC ] ; | |
79 | ||
80 | flags diab.link LOPTIONS <link>shared : -Xdynamic -Xshared -Xpic ; | |
81 | ||
82 | flags diab.link LIBPATH <library-path> ; | |
83 | flags diab.link LIBRARIES <library-file> ; | |
84 | flags diab.link FINDLIBS-ST <find-static-library> ; | |
85 | flags diab.link FINDLIBS-SA <find-shared-library> ; | |
86 | ||
87 | actions link bind LIBRARIES | |
88 | { | |
89 | $(CONFIG_COMMAND) $(OPTIONS) $(LOPTIONS) -o "$(<)" -L$(LIBPATH) "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) | |
90 | } | |
91 | ||
92 | # When creating dynamic libraries, we don't want to be warned about unresolved | |
93 | # symbols, therefore all unresolved symbols are marked as expected by | |
94 | # '-expect_unresolved *'. This also mirrors the behaviour of the GNU tool | |
95 | # chain. | |
96 | ||
97 | actions link.dll bind LIBRARIES | |
98 | { | |
99 | $(.root:E=)dplus $(OPTIONS) $(LOPTIONS) "$(LIBRARIES)" -o "$(<[1])" -L$(LIBPATH) "$(>)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) | |
100 | } | |
101 | ||
102 | #rule compile.asm ( targets * : sources * : properties * ) | |
103 | #{ | |
104 | # setup-fpic $(targets) : $(sources) : $(properties) ; | |
105 | # setup-address-model $(targets) : $(sources) : $(properties) ; | |
106 | #} | |
107 | ||
108 | actions compile.asm | |
109 | { | |
110 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
111 | } | |
112 | ||
113 | ||
114 | ||
115 | actions compile.c | |
116 | { | |
117 | $(.root:E=)dcc -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)" | |
118 | } | |
119 | ||
120 | actions compile.c++ | |
121 | { | |
122 | $(.root:E=)dplus -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)" | |
123 | } | |
124 | ||
125 | # Always create archive from scratch. See the gcc toolet for rationale. | |
126 | RM = [ common.rm-command ] ; | |
127 | actions together piecemeal archive | |
128 | { | |
129 | $(RM) "$(<)" | |
130 | dar rc $(<) $(>) | |
131 | } |