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 6import clang ; 7import feature : feature get-values ; 8import os ; 9import toolset ; 10import toolset : flags ; 11import gcc ; 12import common ; 13import errors ; 14import generators ; 15 16 17feature.extend-subfeature toolset clang : platform : vxworks ; 18 19toolset.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 27generators.override clang-vxworks.prebuilt : builtin.lib-generator ; 28generators.override clang-vxworks.prebuilt : builtin.prebuilt ; 29generators.override clang-vxworks.searched-lib-generator : searched-lib-generator ; 30 31 32toolset.inherit-rules clang-vxworks : gcc ; 33toolset.inherit-flags clang-vxworks : gcc 34 : <inlining>full 35 <architecture>x86/<address-model>32 36 <architecture>x86/<address-model>64 37 ; 38 39if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] 40{ 41 .debug-configuration = true ; 42} 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 46rule 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 67 toolset.flags clang-vxworks.link .LD : $(linker) ; 68 69 # - Archive builder. 70 local archiver = [ feature.get-values <archiver> : $(options) ] ; 71 toolset.flags clang-vxworks.archive .AR $(condition) : $(archiver[1]) ; 72} 73 74SPACE = " " ; 75 76toolset.flags clang-vxworks.compile OPTIONS <cflags> ; 77toolset.flags clang-vxworks.compile.c++ OPTIONS <cxxflags> ; 78toolset.flags clang-vxworks.compile INCLUDES <include> ; 79 80# For clang, 'on' and 'full' are identical 81toolset.flags clang-vxworks.compile OPTIONS <inlining>full : -Wno-inline ; 82 83toolset.flags clang-vxworks.compile OPTIONS <flags> ; 84 85 86actions compile.c 87{ 88 "$(CONFIG_COMMAND)" -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 89} 90 91actions compile.c++ 92{ 93 "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 94} 95 96 97 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 106actions piecemeal archive 107{ 108 "$(.AR)" $(AROPTIONS) rcu "$(<)" "$(>)" 109} 110 111# Declare actions for linking 112rule 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 120actions 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 125actions 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} 129