Set a default target in wrapper scripts and executables

This commit is contained in:
Martin Storsjö committed 2018-10-10 23:33:19 +03:00
1 parent 1bc3d75a41
commit b5deb9fc1f
7 files changed
+33 -1

No files matched your search

+5
View File
@@ -23,6 +23,9 @@
#ifndef CLANG
#define CLANG "clang"
#endif
#ifndef DEFAULT_TARGET
#define DEFAULT_TARGET "x86_64-w64-mingw32"
#endif
#include <stdio.h>
#include <string.h>
@@ -114,6 +117,8 @@ int _tmain(int argc, TCHAR* argv[]) {
if (dash) {
*dash = '\0';
exe = dash + 1;
} else {
target = _T(DEFAULT_TARGET);
}
TCHAR *arch = _tcsdup(target);
dash = _tcschr(arch, '-');
+4
View File
@@ -3,6 +3,10 @@ DIR="$(cd "$(dirname "$0")" && pwd)"
BASENAME="$(basename "$0")"
TARGET="${BASENAME%-*}"
EXE="${BASENAME##*-}"
DEFAULT_TARGET=x86_64-w64-mingw32
if [ "$TARGET" = "$BASENAME" ]; then
TARGET=$DEFAULT_TARGET
fi
ARCH="${TARGET%%-*}"
# Allow setting e.g. CCACHE=1 to wrap all building in ccache.
+4
View File
@@ -5,6 +5,10 @@ export PATH=$DIR:$PATH
BASENAME="$(basename "$0")"
TARGET="${BASENAME%-*}"
DEFAULT_TARGET=x86_64-w64-mingw32
if [ "$TARGET" = "$BASENAME" ]; then
TARGET=$DEFAULT_TARGET
fi
ARCH="${TARGET%%-*}"
case $ARCH in
i686) M=i386 ;;
+4
View File
@@ -21,6 +21,10 @@ fi
BASENAME="$(basename "$0")"
TARGET="${BASENAME%-*}"
DEFAULT_TARGET=x86_64-w64-mingw32
if [ "$TARGET" = "$BASENAME" ]; then
TARGET=$DEFAULT_TARGET
fi
ARCH="${TARGET%%-*}"
case $ARCH in
i686) M=i386pe ;;
+4
View File
@@ -5,6 +5,10 @@ set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
BASENAME="$(basename "$0")"
TARGET="${BASENAME%-*}"
DEFAULT_TARGET=x86_64-w64-mingw32
if [ "$TARGET" = "$BASENAME" ]; then
TARGET=$DEFAULT_TARGET
fi
EXE="${BASENAME##*-}"
ARCH="${TARGET%%-*}"
+4
View File
@@ -88,6 +88,10 @@ CODEPAGE=1252
CPP_OPTIONS=
BASENAME="$(basename "$0")"
TARGET="${BASENAME%-*}"
DEFAULT_TARGET=x86_64-w64-mingw32
if [ "$TARGET" = "$BASENAME" ]; then
TARGET=$DEFAULT_TARGET
fi
PROG="$BASENAME"
while [ $# != 0 ]; do