Makefile, .gitignore, .editorconfig, configure, tests/cc-compat.sh: added configure script for compiler optimizations

This commit is contained in:
2024-01-15 15:30:21 -07:00
parent 622c13021d
commit 49a3bb9f30
5 changed files with 55 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
# Copyright (c) 20232024 Emma Tebibyte <emma@tebibyte.media>
# Copyright (c) 2023 DTB <trinity@trinity.moe>
# Copyright (c) 2023 Sasha Koshka <sashakoshka@tebibyte.media>
# SPDX-License-Identifier: FSFAP
@@ -18,19 +18,17 @@
PREFIX=/usr/local
CC=cc
CFLAGS=-O3 -Lbuild/lib -idirafter include
RUSTC=rustc
RUSTCFLAGS=-Copt-level=z -Ccodegen-units=1 -Cpanic=abort -Clto=y \
-Cstrip=symbols -Ctarget-cpu=native \
--extern sysexits=build/o/libsysexits.rlib
all: false fop intcmp scrut str strcmp true test
# to build, first run ./configure
include *.mk
all: false fop intcmp scrut str strcmp true
build:
# keep build/include until bindgen(1) has stdin support
# https://github.com/rust-lang/rust-bindgen/issues/2703
mkdir -p build/bin build/include build/o # build/lib
mkdir -p build/bin build/include build/o build/lib
clean:
rm -rf build/ dist/
@@ -65,10 +63,10 @@ sysexits: build
| $(RUSTC) $(RUSTCFLAGS) --crate-type lib -o build/o/libsysexits.rlib -
false: src/false.rs build
$(RUSTC) $(RUSTCFLAGS) -o build/bin/false src/false.rs
$(RUSTC) $(RUSTFLAGS) -o build/bin/false src/false.rs
fop: src/fop.rs build sysexits
$(RUSTC) $(RUSTCFLAGS) -o build/bin/fop src/fop.rs
$(RUSTC) $(RUSTFLAGS) -o build/bin/fop src/fop.rs
intcmp: src/intcmp.c build
$(CC) $(CFLAGS) -o build/bin/intcmp src/intcmp.c
@@ -83,4 +81,4 @@ strcmp: src/strcmp.c build
$(CC) $(CFLAGS) -o build/bin/strcmp src/strcmp.c
true: src/true.rs build
$(RUSTC) $(RUSTCFLAGS) -o build/bin/true src/true.rs
$(RUSTC) $(RUSTFLAGS) -o build/bin/true src/true.rs