From 0130773b31fd3391f8677da858a9de1a526050dd Mon Sep 17 00:00:00 2001 From: Sam James Date: Thu, 31 Mar 2022 04:13:38 +0100 Subject: [PATCH] Makefile: respect PREFIX Allows easily appending a prefix to all variables. Again, a standard used frequently by packagers. Not just for things like Gentoo Prefix but also e.g. macports where everything ends up installed in some path beginning with /usr/local, or /opt, or ... Signed-off-by: Sam James --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 01d9d59..5f2a56e 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,10 @@ #-O3 --std=c99 -lcurses -DNO_MOUSE for NetBSD curses #adding --std=c99 makes warnings in GNU, and the blame is upon glibc feature test macros. my code is correct. -GAMES_DIR?=/usr/games -SCORES_DIR?=/var/games -MAN_DIR?=/usr/share/man/man6 -CFLAGS+= -Wno-unused-result -D SCORES_DIR=\"$(SCORES_DIR)\" +GAMES_DIR?=$(PREFIX)/usr/games +SCORES_DIR?=$(PREFIX)/var/games +MAN_DIR?=$(PREFIX)/usr/share/man/man6 +CFLAGS+= -Wno-unused-result -D SCORES_DIR=\"$(PREFIX)$(SCORES_DIR)\" PKG-CONFIG?=pkg-config LIBS=$(shell pkg-config --libs --cflags ncurses) -lm @@ -61,8 +61,8 @@ snakeduel: snakeduel.c config.h tugow: tugow.c common.h $(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBS) -o $@ menu: - cp nbsdgames.desktop $(DESTIDR)/usr/share/applications - cp nbsdgames.svg $(DESTDIR)/usr/share/pixmaps + cp nbsdgames.desktop $(DESTIDR)$(PREFIX)/usr/share/applications + cp nbsdgames.svg $(DESTDIR)$(PREFIX)/usr/share/pixmaps clean: for game in $(ALL); do rm $$game; done; uninstall: