43 lines
		
	
	
		
			986 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			986 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh
 | |
| # PROJECT:     XTchain
 | |
| # LICENSE:     See the COPYING.md in the top level directory
 | |
| # FILE:        scripts/clang-target-wrapper
 | |
| # DESCRIPTION: CLANG Wrapper
 | |
| # DEVELOPERS:  Martin Storsjo <martin@martin.st>
 | |
| #              Rafal Kupiec <belliash@codingworkshop.eu.org>
 | |
| 
 | |
| 
 | |
| # Set basic variables
 | |
| DIR="$(cd $(dirname $0) && pwd)"
 | |
| CLANG="$DIR/clang"
 | |
| BASENAME="$(basename $0)"
 | |
| TARGET="${BASENAME%-*}"
 | |
| EXECUTABLE="${BASENAME##*-}"
 | |
| DEFAULT_TARGET="x86_64-w64-mingw32"
 | |
| ARCH="${TARGET%%-*}"
 | |
| 
 | |
| # Set proper target
 | |
| if [ "${TARGET}" = "${BASENAME}" ]; then
 | |
|     TARGET="${DEFAULT_TARGET}"
 | |
| fi
 | |
| 
 | |
| # Set lang-specific flags
 | |
| case ${EXECUTABLE} in
 | |
|     "clang++"|"g++"|"c++")
 | |
|         FLAGS="$FLAGS --driver-mode=g++"
 | |
|         ;;
 | |
|     *)
 | |
|         FLAGS=""
 | |
|         ;;
 | |
| esac
 | |
| 
 | |
| # Set compiler flags
 | |
| FLAGS="${FLAGS} -target ${TARGET}"
 | |
| FLAGS="${FLAGS} -rtlib=compiler-rt"
 | |
| FLAGS="${FLAGS} -stdlib=libc++"
 | |
| FLAGS="${FLAGS} -fuse-ld=lld"
 | |
| FLAGS="${FLAGS} -Qunused-arguments"
 | |
| 
 | |
| # Launch the compiler
 | |
| $CLANG $FLAGS "$@"
 |