]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | # Copyright Brian Kuhl 2017. |
2 | # Distributed under the Boost Software License, Version 1.0. | |
3 | # (See accompanying file LICENSE_1_0.txt | |
4 | # or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | import clang ; | |
7 | import feature : feature get-values ; | |
8 | import os ; | |
9 | import toolset ; | |
10 | import toolset : flags ; | |
11 | import gcc ; | |
12 | import common ; | |
13 | import errors ; | |
14 | import generators ; | |
15 | ||
16 | ||
17 | feature.extend-subfeature toolset clang : platform : vxworks ; | |
18 | ||
19 | toolset.inherit-generators clang-vxworks | |
20 | <toolset>clang <toolset-clang:platform>vxworks | |
21 | : gcc | |
22 | # Don't inherit PCH generators. They were not tested, and probably | |
23 | # don't work for this compiler. | |
24 | : gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch | |
25 | ; | |
26 | ||
27 | generators.override clang-vxworks.prebuilt : builtin.lib-generator ; | |
28 | generators.override clang-vxworks.prebuilt : builtin.prebuilt ; | |
29 | generators.override clang-vxworks.searched-lib-generator : searched-lib-generator ; | |
30 | ||
31 | ||
32 | toolset.inherit-rules clang-vxworks : gcc ; | |
33 | toolset.inherit-flags clang-vxworks : gcc | |
11fdf7f2 | 34 | : <inlining>full |
b32b8144 FG |
35 | <architecture>x86/<address-model>32 |
36 | <architecture>x86/<address-model>64 | |
37 | ; | |
38 | ||
39 | if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] | |
40 | { | |
41 | .debug-configuration = true ; | |
42 | } | |
b32b8144 FG |
43 | # Initializes the clang-vxworks toolset |
44 | # version in optional | |
45 | # compile and link options allow you to specify addition command line options for each version | |
46 | rule init ( version ? : command * : options * ) | |
47 | { | |
48 | command = [ common.get-invocation-command clang-vxworks : ccllvm | |
49 | : $(command) ] ; | |
50 | ||
51 | linker = [ get-values <linker> : $(options) ] ; | |
52 | linker ?= ld ; | |
53 | ||
54 | # Determine the version | |
55 | local command-string = $(command:J=" ") ; | |
56 | if $(command) | |
57 | { | |
58 | version ?= [ MATCH "^([0-9.]+)" | |
59 | : [ SHELL "$(command-string) -dumpversion" ] ] ; | |
60 | } | |
61 | ||
62 | local condition = [ common.check-init-parameters clang-vxworks | |
63 | : version $(version) ] ; | |
64 | ||
65 | common.handle-options clang-vxworks : $(condition) : $(command) : $(options) ; | |
66 | ||
b32b8144 | 67 | toolset.flags clang-vxworks.link .LD : $(linker) ; |
11fdf7f2 TL |
68 | |
69 | # - Archive builder. | |
70 | local archiver = [ feature.get-values <archiver> : $(options) ] ; | |
71 | toolset.flags clang-vxworks.archive .AR $(condition) : $(archiver[1]) ; | |
b32b8144 FG |
72 | } |
73 | ||
74 | SPACE = " " ; | |
75 | ||
76 | toolset.flags clang-vxworks.compile OPTIONS <cflags> ; | |
77 | toolset.flags clang-vxworks.compile.c++ OPTIONS <cxxflags> ; | |
78 | toolset.flags clang-vxworks.compile INCLUDES <include> ; | |
79 | ||
b32b8144 | 80 | # For clang, 'on' and 'full' are identical |
b32b8144 FG |
81 | toolset.flags clang-vxworks.compile OPTIONS <inlining>full : -Wno-inline ; |
82 | ||
b32b8144 FG |
83 | toolset.flags clang-vxworks.compile OPTIONS <flags> ; |
84 | ||
85 | ||
86 | actions compile.c | |
87 | { | |
20effc67 | 88 | "$(CONFIG_COMMAND)" -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -include"$(FORCE_INCLUDES)" -c -o "$(<)" "$(>)" |
b32b8144 FG |
89 | } |
90 | ||
91 | actions compile.c++ | |
92 | { | |
20effc67 | 93 | "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -include"$(FORCE_INCLUDES)" -c -o "$(<)" "$(>)" |
b32b8144 FG |
94 | } |
95 | ||
96 | ||
97 | ||
b32b8144 FG |
98 | # Default value. Mostly for the sake of clang-linux |
99 | # that inherits from gcc, but does not has the same | |
100 | # logic to set the .AR variable. We can put the same | |
101 | # logic in clang-linux, but that's hardly worth the trouble | |
102 | # as on Linux, 'ar' is always available. | |
103 | .AR = ar ; | |
104 | ||
105 | ||
106 | actions piecemeal archive | |
107 | { | |
108 | "$(.AR)" $(AROPTIONS) rcu "$(<)" "$(>)" | |
109 | } | |
110 | ||
b32b8144 FG |
111 | # Declare actions for linking |
112 | rule link ( targets * : sources * : properties * ) | |
113 | { | |
114 | SPACE on $(targets) = " " ; | |
115 | # Serialize execution of the 'link' action, since | |
116 | # running N links in parallel is just slower. | |
117 | JAM_SEMAPHORE on $(targets) = <s>clang-vxworks-link-semaphore ; | |
118 | } | |
119 | ||
120 | actions link bind LIBRARIES | |
121 | { | |
122 | "$(.LD)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) | |
123 | } | |
124 | ||
125 | actions link.dll bind LIBRARIES | |
126 | { | |
127 | "$(.LD)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) -fpic -shared -non-static | |
128 | } |