@@ -9,6 +9,7 @@ MULTICALL ?= n
99COMPLETIONS ?= y
1010MANPAGES ?= y
1111LOCALES ?= y
12+ # allow bootstrapping by our install. mkdir, chmod and cp should be avoided
1213INSTALL ?= install
1314
1415# Needed for the foreach loops to split each loop into a separate command
@@ -159,7 +160,7 @@ test_toybox:
159160
160161toybox-src :
161162 if [ ! -e " $( TOYBOX_SRC) " ] ; then \
162- mkdir -p " $( TOYBOX_ROOT) " ; \
163+ $( INSTALL ) -d " $( TOYBOX_ROOT) " ; \
163164 curl -Ls " https://github.com/landley/toybox/archive/refs/tags/$( TOYBOX_VER) .tar.gz" -o " $( TOYBOX_ROOT) /$( TOYBOX_VER) .tar.gz" ; \
164165 tar -C " $( TOYBOX_ROOT) " -xf " $( TOYBOX_ROOT) /$( TOYBOX_VER) .tar.gz" ; \
165166 sed -i -e " s|TESTDIR=\" .*\" |TESTDIR=\" $( BUILDDIR) \" |g" $(TOYBOX_SRC ) /scripts/test.sh; \
@@ -168,7 +169,7 @@ toybox-src:
168169
169170busybox-src :
170171 if [ ! -e " $( BUSYBOX_SRC) " ] ; then \
171- mkdir -p " $( BUSYBOX_ROOT) " ; \
172+ $( INSTALL ) -d " $( BUSYBOX_ROOT) " ; \
172173 curl -Ls " https://github.com/mirror/busybox/archive/refs/tags/$( subst .,_,$( BUSYBOX_VER) ) .tar.gz" -o " $( BUSYBOX_ROOT) /busybox-$( BUSYBOX_VER) .tar.gz" ; \
173174 tar -C " $( BUSYBOX_ROOT) " -xf " $( BUSYBOX_ROOT) /busybox-$( BUSYBOX_VER) .tar.gz" ; \
174175 fi ;
@@ -204,7 +205,7 @@ build-uudoc:
204205 @unset CARGO_BUILD_TARGET && ${CARGO} build ${CARGOFLAGS} --bin uudoc --features " uudoc ${EXES} " ${PROFILE_CMD} --no-default-features
205206
206207install-manpages : build-uudoc
207- mkdir -p $(DESTDIR )$(DATAROOTDIR ) /man/man1
208+ $( INSTALL ) -d $(DESTDIR )$(DATAROOTDIR ) /man/man1
208209 $(foreach prog, $(INSTALLEES ) , \
209210 $(BUILDDIR_UUDOC ) /uudoc manpage $(prog ) > $(DESTDIR )$(DATAROOTDIR ) /man/man1/$(PROG_PREFIX )$(prog ) .1 $(newline ) \
210211 )
@@ -215,9 +216,9 @@ endif
215216ifeq ($(COMPLETIONS ) ,y)
216217
217218install-completions : build-uudoc
218- mkdir -p $(DESTDIR )$(DATAROOTDIR ) /zsh/site-functions
219- mkdir -p $(DESTDIR )$(DATAROOTDIR ) /bash-completion/completions
220- mkdir -p $(DESTDIR )$(DATAROOTDIR ) /fish/vendor_completions.d
219+ $( INSTALL ) -d $(DESTDIR )$(DATAROOTDIR ) /zsh/site-functions
220+ $( INSTALL ) -d $(DESTDIR )$(DATAROOTDIR ) /bash-completion/completions
221+ $( INSTALL ) -d $(DESTDIR )$(DATAROOTDIR ) /fish/vendor_completions.d
221222 $(foreach prog, $(INSTALLEES ) , \
222223 $(BUILDDIR_UUDOC ) /uudoc completion $(prog ) zsh > $(DESTDIR )$(DATAROOTDIR ) /zsh/site-functions/_$(PROG_PREFIX )$(prog ) $(newline ) \
223224 $(BUILDDIR_UUDOC ) /uudoc completion $(prog ) bash > $(DESTDIR )$(DATAROOTDIR ) /bash-completion/completions/$(PROG_PREFIX )$(prog ) .bash $(newline ) \
@@ -231,15 +232,15 @@ ifeq ($(LOCALES),y)
231232locales :
232233 @# Copy uucore common locales
233234 @if [ -d " $( BASEDIR) /src/uucore/locales" ]; then \
234- mkdir -p " $( BUILDDIR) /locales/uucore" ; \
235+ $( INSTALL ) -d " $( BUILDDIR) /locales/uucore" ; \
235236 for locale_file in " $( BASEDIR) " /src/uucore/locales/* .ftl; do \
236237 $(INSTALL ) -m 644 " $$ locale_file" " $( BUILDDIR) /locales/uucore/" ; \
237238 done ; \
238239 fi ; \
239240 # Copy utility-specific locales
240241 @for prog in $(INSTALLEES ) ; do \
241242 if [ -d " $( BASEDIR) /src/uu/$$ prog/locales" ]; then \
242- mkdir -p " $( BUILDDIR) /locales/$$ prog" ; \
243+ $( INSTALL ) -d " $( BUILDDIR) /locales/$$ prog" ; \
243244 for locale_file in " $( BASEDIR) " /src/uu/$$ prog/locales/* .ftl; do \
244245 if [ " $$ (basename " $$ locale_file" )" != " en-US.ftl" ]; then \
245246 $(INSTALL ) -m 644 " $$ locale_file" " $( BUILDDIR) /locales/$$ prog/" ; \
@@ -256,7 +257,7 @@ INSTALLEES_WITH_EXTRA_LOCALE = \
256257install-locales :
257258 @for prog in $(INSTALLEES_WITH_EXTRA_LOCALE ) ; do \
258259 if [ -d " $( BASEDIR) /src/uu/$$ prog/locales" ]; then \
259- mkdir -p " $( DESTDIR) $( DATAROOTDIR) /locales/$$ prog" ; \
260+ $( INSTALL ) -d " $( DESTDIR) $( DATAROOTDIR) /locales/$$ prog" ; \
260261 for locale_file in " $( BASEDIR) " /src/uu/$$ prog/locales/* .ftl; do \
261262 if [ " $$ (basename " $$ locale_file" )" != " en-US.ftl" ]; then \
262263 $(INSTALL ) -m 644 " $$ locale_file" " $( DESTDIR) $( DATAROOTDIR) /locales/$$ prog/" ; \
@@ -270,9 +271,9 @@ install-locales:
270271endif
271272
272273install : build install-manpages install-completions install-locales
273- mkdir -p $(INSTALLDIR_BIN )
274+ $( INSTALL ) -d $(INSTALLDIR_BIN )
274275ifneq (,$(and $(findstring stdbuf,$(UTILS ) ) ,$(findstring feat_external_libstdbuf,$(CARGOFLAGS ) ) ) )
275- mkdir -p $(DESTDIR)$(LIBSTDBUF_DIR)
276+ $(INSTALL) -d $(DESTDIR)$(LIBSTDBUF_DIR)
276277ifneq (,$(findstring cygwin,$(OS ) ) )
277278 $(INSTALL) -m 755 $(BUILDDIR)/deps/stdbuf.dll $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.dll
278279else
0 commit comments