From 5b4793647772c701d70864e12c7d2b720de54eee Mon Sep 17 00:00:00 2001 From: emma Date: Tue, 6 Feb 2024 22:21:46 -0700 Subject: [PATCH] Makefile: removed configure and made library builds better --- Makefile | 10 ++++------ configure | 44 -------------------------------------------- 2 files changed, 4 insertions(+), 50 deletions(-) delete mode 100755 configure diff --git a/Makefile b/Makefile index 61b67de..5c8f26e 100644 --- a/Makefile +++ b/Makefile @@ -15,9 +15,6 @@ PREFIX=/usr/local CC=cc RUSTC=rustc -# to build, first run ./configure -include cc.mk rustc.mk - .PHONY: all all: dj false fop intcmp scrut str strcmp true @@ -46,7 +43,7 @@ test: build tests/posix-compat.sh $(RUSTC) --test src/getopt-rs/lib.rs -o build/test/getopt -sysexits: build +build/o/libsysexits.rlib: build # bandage solution until bindgen(1) gets stdin support printf '#define EXIT_FAILURE 1\n' | cat - include/sysexits.h \ > build/include/sysexits.h @@ -56,7 +53,7 @@ sysexits: build | sed 's/ /\n/g' | grep sysexits.h)" \ | $(RUSTC) $(RUSTCFLAGS) --crate-type lib -o build/o/libsysexits.rlib - -libgetopt: src/getopt-rs/lib.rs +build/o/libgetopt.rlib: src/getopt-rs/lib.rs $(RUSTC) $(RUSTCFLAGS) --crate-type=lib --crate-name=getopt \ -o build/o/libgetopt.rlib src/getopt-rs/lib.rs @@ -72,8 +69,9 @@ build/bin/false: src/false.c build .PHONY: fop fop: build/bin/fop -build/bin/fop: src/fop.rs build libgetopt sysexits +build/bin/fop: src/fop.rs build build/o/libgetopt.rlib build/o/libsysexits.rlib $(RUSTC) $(RUSTFLAGS) --extern getopt=build/o/libgetopt.rlib \ + --extern sysexits=build/o/libsysexits.rlib \ -o $@ src/fop.rs .PHONY: intcmp diff --git a/configure b/configure deleted file mode 100755 index e7656d9..0000000 --- a/configure +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2023–2024 Emma Tebibyte -# 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' - -if [ "$1" = "clean" ]; then - rm *.mk || true - exit 0 -fi - -while test -n "$1"; do - case "$1" in - clang) - CFLAGS="$CFLAGS -Wall" - ;; - gcc) - CFLAGS="$CFLAGS -s -Wl,-z,noseparate-code,-z,nosectionheader -flto" - ;; - rustc) ;; - 'rustc +nightly') - RUSTFLAGS="+nightly -Zlocation-detail=none $RUSTFLAGS" - ;; - *) - printf 'Usage: %s [clean | compiler]\n' "$0" - exit 64 # sysexits.h(3) EX_USAGE - ;; - esac - - shift -done - -printf 'CFLAGS=%s\n' "$CFLAGS" >cc.mk -printf 'RUSTFLAGS=%s\n' "$RUSTFLAGS" >rustc.mk