configure: now you can do multiple compilers!

This commit is contained in:
Emma Tebibyte 2024-01-16 16:47:26 -07:00
parent f99cc797e6
commit 5e1749ca43
Signed by untrusted user: emma
GPG Key ID: 06FA419A1698C270

44
configure vendored
View File

@ -14,26 +14,30 @@ RUSTFLAGS='-Copt-level=z -Ccodegen-units=1 -Cpanic=abort -Clto=y \
-Cstrip=symbols -Ctarget-cpu=native \ -Cstrip=symbols -Ctarget-cpu=native \
--extern sysexits=build/o/libsysexits.rlib' --extern sysexits=build/o/libsysexits.rlib'
case "$@" in if [ "$1" = "clean" ]; then
clang) rm *.mk || true
CFLAGS="$CFLAGS -Wall" exit 0
;; fi
clean)
rm *.mk || true while test -n "$1"; do
exit 0 case "$1" in
;; clang)
gcc) CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -s -Wl,-z,noseparate-code,-z,nosectionheader -flto" ;;
;; gcc)
'rustc +nightly') CFLAGS="$CFLAGS -s -Wl,-z,noseparate-code,-z,nosectionheader -flto"
RUSTFLAGS="+nightly -Zlocation-detail=none $RUSTFLAGS" ;;
;; 'rustc +nightly')
'') ;; RUSTFLAGS="+nightly -Zlocation-detail=none $RUSTFLAGS"
*) ;;
printf 'Usage: %s [compiler]\n' "$0" *)
exit 64 # sysexits.h(3) EX_USAGE printf 'Usage: %s [clean | compiler]\n' "$0"
;; exit 64 # sysexits.h(3) EX_USAGE
esac ;;
esac
shift
done
printf 'CFLAGS=%s\n' "$CFLAGS" >cc.mk printf 'CFLAGS=%s\n' "$CFLAGS" >cc.mk
printf 'RUSTFLAGS=%s\n' "$RUSTFLAGS" >rustc.mk printf 'RUSTFLAGS=%s\n' "$RUSTFLAGS" >rustc.mk