forked from bonsai/harakit
Makefile, .gitignore, .editorconfig, configure, tests/cc-compat.sh: added configure script for compiler optimizations
This commit is contained in:
39
configure
vendored
Executable file
39
configure
vendored
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
set -e
|
||||
|
||||
CFLAGS='-Lbuild/lib -idirafter include -O3'
|
||||
RUSTFLAGS='-Copt-level=z -Ccodegen-units=1 -Cpanic=abort -Clto=y \
|
||||
-Cstrip=symbols -Ctarget-cpu=native \
|
||||
--extern sysexits=build/o/libsysexits.rlib'
|
||||
|
||||
case "$@" in
|
||||
clang)
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
;;
|
||||
clean)
|
||||
rm *.mk || true
|
||||
exit 0
|
||||
;;
|
||||
gcc)
|
||||
CFLAGS="$CFLAGS -s -Wl,-z,noseparate-code,-z,nosectionheader -flto"
|
||||
;;
|
||||
'rustc +nightly')
|
||||
RUSTFLAGS="+nightly -Zlocation-detail=none $RUSTFLAGS"
|
||||
;;
|
||||
'') ;;
|
||||
*)
|
||||
printf 'Usage: %s [compiler]\n' "$0"
|
||||
exit 64 # sysexits.h(3) EX_USAGE
|
||||
;;
|
||||
esac
|
||||
|
||||
printf 'CFLAGS=%s\n' "$CFLAGS" >cc.mk
|
||||
printf 'RUSTFLAGS=%s\n' "$RUSTFLAGS" >rustc.mk
|
||||
Reference in New Issue
Block a user