]>
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 | ||
49 | # unlike most compliers, Diab defaults to static linking. | |
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 | ||
66 | flags diab.compile.c++ OPTIONS <exception-handling>off : -Xno-exceptions ; | |
67 | # So Dinkum STL knows when exceptions are disabled | |
68 | flags diab.compile DEFINES <exception-handling>off : _NO_EX=1 ; | |
69 | flags diab.compile INCLUDES <include> ; | |
70 | flags diab.link OPTIONS <linkflags> ; | |
71 | ||
72 | flags diab.compile OPTIONS <link>shared : -Xpic ; | |
73 | #flags diab.compile OPTIONS <link>static : ; | |
74 | # get VxWorks link options from shell enviorment | |
75 | flags diab.link OPTIONS <link>static : [ os.environ LDFLAGS_STATIC ] ; | |
76 | flags diab.link.dll OPTIONS : [ os.environ LDFLAGS_SO ] ; | |
77 | flags diab.link OPTIONS <link>shared : [ os.environ LDFLAGS_DYNAMIC ] ; | |
78 | ||
79 | flags diab.link LOPTIONS <link>shared : -Xdynamic -Xshared -Xpic ; | |
80 | ||
81 | flags diab.link LIBPATH <library-path> ; | |
82 | flags diab.link LIBRARIES <library-file> ; | |
83 | flags diab.link FINDLIBS-ST <find-static-library> ; | |
84 | flags diab.link FINDLIBS-SA <find-shared-library> ; | |
85 | ||
86 | actions link bind LIBRARIES | |
87 | { | |
88 | $(CONFIG_COMMAND) $(OPTIONS) $(LOPTIONS) -o "$(<)" -L$(LIBPATH) "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) | |
89 | } | |
90 | ||
91 | # When creating dynamic libraries, we don't want to be warned about unresolved | |
92 | # symbols, therefore all unresolved symbols are marked as expected by | |
93 | # '-expect_unresolved *'. This also mirrors the behaviour of the GNU tool | |
94 | # chain. | |
95 | ||
96 | actions link.dll bind LIBRARIES | |
97 | { | |
98 | $(.root:E=)dplus $(OPTIONS) $(LOPTIONS) "$(LIBRARIES)" -o "$(<[1])" -L$(LIBPATH) "$(>)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) | |
99 | } | |
100 | ||
101 | #rule compile.asm ( targets * : sources * : properties * ) | |
102 | #{ | |
103 | # setup-fpic $(targets) : $(sources) : $(properties) ; | |
104 | # setup-address-model $(targets) : $(sources) : $(properties) ; | |
105 | #} | |
106 | ||
107 | actions compile.asm | |
108 | { | |
109 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
110 | } | |
111 | ||
112 | ||
113 | ||
114 | actions compile.c | |
115 | { | |
116 | $(.root:E=)dcc -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)" | |
117 | } | |
118 | ||
119 | actions compile.c++ | |
120 | { | |
121 | $(.root:E=)dplus -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)" | |
122 | } | |
123 | ||
124 | # Always create archive from scratch. See the gcc toolet for rationale. | |
125 | RM = [ common.rm-command ] ; | |
126 | actions together piecemeal archive | |
127 | { | |
128 | $(RM) "$(<)" | |
129 | dar rc $(<) $(>) | |
130 | } |