getopt-rs(3): added getopt library for Rust

This commit is contained in:
2023-12-29 15:17:39 -07:00
parent 75ead441ec
commit 0c2223d4fb
8 changed files with 992 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ endif
build: build_dir false intcmp scrut str strcmp true
build_dir:
mkdir -p build/o build/lib build/bin
mkdir -p build/o build/lib build/bin build/test
clean:
rm -rf build/
@@ -53,9 +53,10 @@ install: build
cp -f docs/*.1 $(PREFIX)/share/man/man1/
# cp -f docs/*.3 $(PREFIX)/share/man/man3/
test: build
test: build_dir tests/cc-compat.sh tests/posix-compat.sh src/getopt-rs/tests.rs
tests/cc-compat.sh
tests/posix-compat.sh
$(RUSTC) --test src/getopt-rs/lib.rs -o build/test/getopt
false: src/false.rs build_dir
$(RUSTC) $(RUSTCFLAGS) -o build/bin/false src/false.rs
@@ -75,3 +76,6 @@ strcmp: src/strcmp.c build_dir
true: src/true.rs build_dir
$(RUSTC) $(RUSTCFLAGS) -o build/bin/true src/true.rs
libgetopt: src/getopt-rs/lib.rs
$(RUSTC) $(RUSTCFLAGS) --crate-type=lib --crate-name=getopt \
-o build/o/libgetopt.rlib src/lib.rs