1
0
forked from bonsai/harakit
coreutils/lib/Makefile

31 lines
1.2 KiB
Makefile
Raw Normal View History

# Copyright (c) 20232024 Emma Tebibyte <emma@tebibyte.media>
# Copyright (c) 20232024 DTB <trinity@trinity.moe>
# Copyright (c) 2023 Sasha Koshka <sashakoshka@tebibyte.media>
# Copyright (c) 2024 Aaditya Aryal <aryalaadi123@gmail.com>
# 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.
include ../config.mk
.PHONY: lib
lib: ../$(BUILD)/o/libsysexits.rlib ../$(BUILD)/o/libgetopt.rlib \
../$(BUILD)/o/libstrerror.rlib
../$(BUILD)/o/libgetopt.rlib: getopt-rs/lib.rs
$(RUSTC) $(RUSTFLAGS) --crate-type=lib --crate-name=getopt \
-o $@ getopt-rs/lib.rs
../$(BUILD)/o/libstrerror.rlib: strerror.rs
$(RUSTC) $(RUSTFLAGS) --crate-type=lib -o $@ \
strerror.rs
../$(BUILD)/o/libsysexits.rlib: $(SYSEXITS)sysexits.h
# bandage solution until bindgen(1) gets stdin support
printf '#define EXIT_FAILURE 1\n' | cat - $(SYSEXITS)sysexits.h \
> ../$(BUILD)/include/sysexits.h
bindgen --default-macro-constant-type signed --use-core --formatter=none \
../$(BUILD)/include/sysexits.h | $(RUSTC) $(RUSTFLAGS) --crate-type lib -o $@ -