|
Last change
on this file since 7e53c37 was 7e53c37, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 4 years ago |
|
Update files with /bin/bash shebang
|
-
Property mode
set to
100755
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 | # SPDX-FileCopyrightText: 2018 Jiri Svoboda
|
|---|
| 4 | #
|
|---|
| 5 | # SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 6 | #
|
|---|
| 7 | # C Compiler (cc) wrapper
|
|---|
| 8 | # HelenOS Cross Compiler Wrapper (XCW)
|
|---|
| 9 | # Facilitate cross-compiling external software to HelenOS
|
|---|
| 10 | #
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | XCW="$(dirname "$0")"
|
|---|
| 15 | BUILD_ROOT="$(dirname "$(dirname "$(dirname "$XCW")")")"
|
|---|
| 16 | if [ -z "$EXPORT_DIR" ]; then
|
|---|
| 17 | EXPORT_DIR="$BUILD_ROOT/export"
|
|---|
| 18 | fi
|
|---|
| 19 |
|
|---|
| 20 | HELENOS_EXPORT_ROOT="$EXPORT_DIR"
|
|---|
| 21 |
|
|---|
| 22 | source "${EXPORT_DIR}/config.sh"
|
|---|
| 23 |
|
|---|
| 24 | # CC is a compilation driver, so we should check which stage of compilation
|
|---|
| 25 | # is actually running and select which flags to provide. This makes no
|
|---|
| 26 | # difference for GCC, but e.g. clang warns when a flag is provided that is
|
|---|
| 27 | # unused
|
|---|
| 28 |
|
|---|
| 29 | needs_cflags=true
|
|---|
| 30 | needs_ldflags=true
|
|---|
| 31 |
|
|---|
| 32 | for flag in "$@"; do
|
|---|
| 33 | case "$flag" in
|
|---|
| 34 | -E)
|
|---|
| 35 | needs_cflags=false
|
|---|
| 36 | needs_ldflags=false
|
|---|
| 37 | break
|
|---|
| 38 | ;;
|
|---|
| 39 | -c|-S)
|
|---|
| 40 | needs_ldflags=false
|
|---|
| 41 | break
|
|---|
| 42 | ;;
|
|---|
| 43 | esac
|
|---|
| 44 | done
|
|---|
| 45 |
|
|---|
| 46 | flags="-fwide-exec-charset=UTF-32LE -finput-charset=UTF-8 -fexec-charset=UTF-8"
|
|---|
| 47 | flags="$flags -isystem ${HELENOS_EXPORT_ROOT}/include/libc -idirafter ${HELENOS_EXPORT_ROOT}/include"
|
|---|
| 48 |
|
|---|
| 49 | if $needs_cflags; then
|
|---|
| 50 | flags="$flags -O3 \
|
|---|
| 51 | -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
|
|---|
| 52 | -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings -ggdb"
|
|---|
| 53 |
|
|---|
| 54 | flags="$flags $HELENOS_CFLAGS"
|
|---|
| 55 | fi
|
|---|
| 56 |
|
|---|
| 57 | if $needs_ldflags; then
|
|---|
| 58 | flags="$flags $HELENOS_LDFLAGS"
|
|---|
| 59 | fi
|
|---|
| 60 |
|
|---|
| 61 | flags="$flags $@"
|
|---|
| 62 |
|
|---|
| 63 | if $needs_ldflags; then
|
|---|
| 64 | flags="$flags $HELENOS_LDLIBS"
|
|---|
| 65 | fi
|
|---|
| 66 |
|
|---|
| 67 | echo "helenos-cc" "$@"
|
|---|
| 68 | PATH="$HELENOS_CROSS_PATH:$PATH" "${HELENOS_TARGET}-gcc" $flags
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.