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.
This commit is contained in:
Dom Rodriguez 2023-05-19 00:46:44 +01:00
parent 185cc2bc29
commit 0de5c65497
No known key found for this signature in database
GPG Key ID: 72DCF1231E54BD43
2 changed files with 2 additions and 2 deletions

View File

@ -228,7 +228,7 @@ KBUILD_OUTPUT := $(shell ( if not exist $(KBUILD_OUTPUT)\ mkdir $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(subst \,/,$(KBUILD_OUTPUT)) KBUILD_OUTPUT := $(subst \,/,$(KBUILD_OUTPUT))
else else
KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
&& /bin/pwd) && pwd)
endif endif
$(if $(KBUILD_OUTPUT),, \ $(if $(KBUILD_OUTPUT),, \

View File

@ -322,7 +322,7 @@ archive-cmd = ( ( echo create $@ && \
echo end ) | $(AR) -M ) echo end ) | $(AR) -M )
else else
# Command "/bin/echo -e" cannot work on Apple Mac machines, so we use "/usr/bin/printf" instead # 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\ addmod $(subst $(space),$(comma),$(strip $(filter-out %.a %.cpp,$(1))))\n\
$(foreach o,$(filter %.a,$(1)),addlib $o\n)save\nend' | $(AR) -M ) $(foreach o,$(filter %.a,$(1)),addlib $o\n)save\nend' | $(AR) -M )
endif endif