The `Termux' distribution lives in a subdirectory of the weird Android
filesystem. Rather than symlinking scripts into `~/bin', copy them and
hack the shebang lines so that they can still find their interpreters
properly.
### Processing script links.
script-source = $(HERE)/bin/$(or $($1_SRC), $1)
### Processing script links.
script-source = $(HERE)/bin/$(or $($1_SRC), $1)
+
+ifeq ($(prefix-shebang-p),t)
+all:: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS))
+$(addprefix $(HOME)/bin/, $(SCRIPTLINKS)): $(HOME)/bin/%: \
+ $$(call script-source,$$*) Makefile
+ $(call v_tag,SHEBANG)mkdir -p $(dir $@) && \
+ rm -f $@.new && \
+ sed "1s\a\(#! *\)/\a\1$(SHEBANG_PREFIX)/\a" \
+ $(call script-source,$*) >$@.new && \
+ chmod --reference=$(call script-source,$*) $@.new && \
+ mv $@.new $@
+ $(script-hook/$*)
+else
scriptlink-ok-p = \
$(call symlink-ok-p,$(HOME)/bin/$1,$(call script-source,$1))
all:: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS))
scriptlink-ok-p = \
$(call symlink-ok-p,$(HOME)/bin/$1,$(call script-source,$1))
all:: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS))
ln -s $(call script-source,$*) $@.new && \
mv $@.new $@
$(script-hook/$*)
ln -s $(call script-source,$*) $@.new && \
mv $@.new $@
$(script-hook/$*)
all:: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS))
all:: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS))