Makefile: uses dirname(1) to get normalized prefix, adds libraries to RUSTFLAGS, fixes typo

This commit is contained in:
Emma Tebibyte 2024-07-29 23:04:08 -06:00
parent 6a5739ea9d
commit 4aeba9d13f
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -17,8 +17,7 @@ DESTDIR ?= dist
PREFIX ?= /usr/local
# normalized prefix
PREFIX_N != (test -d $(PREFIX) && [ '-' != $(PREFIX) ] \
&& CDPATH= cd -P -- $(PREFIX) && pwd -P)
PREFIX_N != dirname $(PREFIX)/.
MANDIR != [ $(PREFIX_N) = / ] && printf '/usr/share/man\n' \
|| printf '/share/man\n'
SYSEXITS != printf '\043include <sysexits.h>\n' | cpp -M - | tr ' ' '\n' \
@ -26,7 +25,7 @@ SYSEXITS != printf '\043include <sysexits.h>\n' | cpp -M - | tr ' ' '\n' \
CC ?= cc
RUSTC ?= rustc
RUSTLIBS = --extern getopt=build/o/libgetopt.rlib \
RUSTFLAGS += --extern getopt=build/o/libgetopt.rlib \
--extern sysexits=build/o/libsysexits.rlib \
--extern strerror=build/o/libstrerror.rlib
CFLAGS += -I$(SYSEXITS)
@ -120,7 +119,7 @@ build/bin/mm: src/mm.rs build rustlibs
.PHONY: npc
npc: build/bin/npc
build/bin/npc: src/npc.c build
$(CC) $(CFLAGAS) -o $@ src/npc.c
$(CC) $(CFLAGS) -o $@ src/npc.c
.PHONY: rpn
rpn: build/bin/rpn