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:
parent
185cc2bc29
commit
0de5c65497
2
Makefile
2
Makefile
|
@ -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),, \
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue