From 0de5c65497fe35cdf13e597603d50863d28fc2d5 Mon Sep 17 00:00:00 2001 From: Dom Rodriguez Date: Fri, 19 May 2023 00:46:44 +0100 Subject: [PATCH] fix(makefile): Use shell-builtins in Makefile This improves portability, especially on systems like NixOS, where `/bin/pwd` and `/usr/bin/printf` do not exist. --- Makefile | 2 +- scripts/build.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 118a190..fed961e 100644 --- a/Makefile +++ b/Makefile @@ -228,7 +228,7 @@ KBUILD_OUTPUT := $(shell ( if not exist $(KBUILD_OUTPUT)\ mkdir $(KBUILD_OUTPUT) KBUILD_OUTPUT := $(subst \,/,$(KBUILD_OUTPUT)) else KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ - && /bin/pwd) + && pwd) endif $(if $(KBUILD_OUTPUT),, \ diff --git a/scripts/build.mk b/scripts/build.mk index cd64b88..5e0c1bd 100644 --- a/scripts/build.mk +++ b/scripts/build.mk @@ -322,7 +322,7 @@ archive-cmd = ( ( echo create $@ && \ echo end ) | $(AR) -M ) else # Command "/bin/echo -e" cannot work on Apple Mac machines, so we use "/usr/bin/printf" instead -archive-cmd = ( /usr/bin/printf 'create $@\n\ +archive-cmd = ( printf 'create $@\n\ addmod $(subst $(space),$(comma),$(strip $(filter-out %.a %.cpp,$(1))))\n\ $(foreach o,$(filter %.a,$(1)),addlib $o\n)save\nend' | $(AR) -M ) endif