keep user-provided CFLAGS/LDFLAGS separate from those added by configure
[musl.git] / tools / musl-clang.in
blob623de6f64f52e55f3ee9a98ddfa777530989a7a7
1 #!/bin/sh
2 cc="@CC@"
3 libc="@PREFIX@"
4 libc_inc="@INCDIR@"
5 libc_lib="@LIBDIR@"
6 thisdir="`cd "$(dirname "$0")"; pwd`"
8 # prevent clang from running the linker (and erroring) on no input.
9 sflags=
10 eflags=
11 for x ; do
12 case "$x" in
13 -l*) input=1 ;;
14 *) input= ;;
15 esac
16 if test "$input" ; then
17 sflags="-l-user-start"
18 eflags="-l-user-end"
19 break
21 done
23 exec $cc \
24 -B"$thisdir" \
25 -fuse-ld=musl-clang \
26 -static-libgcc \
27 -nostdinc \
28 --sysroot "$libc" \
29 -isystem "$libc_inc" \
30 -L-user-start \
31 $sflags \
32 "$@" \
33 $eflags \
34 -L"$libc_lib" \
35 -L-user-end