Makefile, getopt-rs: added getopt-rs library

This commit is contained in:
2024-01-15 15:50:12 -07:00
9 changed files with 1001 additions and 3 deletions

View File

@@ -28,7 +28,7 @@ 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/lib build/o build/test
clean:
rm -rf build/ dist/
@@ -51,6 +51,7 @@ install: dist
test: build
tests/cc-compat.sh
tests/posix-compat.sh
$(RUSTC) --test src/getopt-rs/lib.rs -o build/test/getopt
sysexits: build
# bandage solution until bindgen(1) gets stdin support
@@ -62,11 +63,16 @@ 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
$(RUSTC) $(RUSTCFLAGS) --crate-type=lib --crate-name=getopt \
-o build/o/libgetopt.rlib src/lib.rs
false: src/false.rs build
$(RUSTC) $(RUSTFLAGS) -o build/bin/false src/false.rs
fop: src/fop.rs build sysexits
$(RUSTC) $(RUSTFLAGS) -o build/bin/fop src/fop.rs
fop: src/fop.rs build libgetopt sysexits
$(RUSTC) $(RUSTFLAGS) --extern getopt=build/o/libgetopt.rlib \
-o build/bin/fop src/fop.rs
intcmp: src/intcmp.c build
$(CC) $(CFLAGS) -o build/bin/intcmp src/intcmp.c