util/nvmutil: Proper DESTDIR/PREFIX handling

DESTDIR is the root directory where it goes, which
is normally an empty string; PREFIX is where the
bin directory is located, relative to DESTDIR

Default to /usr/local for PREFIX, not /usr, because
/usr/bin is for system utilities.

nvmutil is a local utility.

Signed-off-by: Leah Rowe <leah@libreboot.org>
master
Leah Rowe 2025-01-03 02:03:44 +00:00
parent 3f85ae5f85
commit 982f257f58
1 changed files with 5 additions and 4 deletions

View File

@ -4,16 +4,17 @@
CC?=cc CC?=cc
CFLAGS?=-Os -Wall -Wextra -Werror -pedantic CFLAGS?=-Os -Wall -Wextra -Werror -pedantic
PREFIX?=/usr/bin DESTDIR?=
PREFIX?=/usr/local
nvm: nvmutil.c nvm: nvmutil.c
$(CC) $(CFLAGS) nvmutil.c -o nvm $(CC) $(CFLAGS) nvmutil.c -o nvm
install: nvm install:
install nvm $(PREFIX)/nvm install nvm $(DESTDIR)$(PREFIX)/bin/nvm
uninstall: clean uninstall: clean
rm -f $(PREFIX)/nvm rm -f $(DESTDIR)$(PREFIX)/nvm
distclean: distclean:
rm -f nvm rm -f nvm