Skip to content

Commit 49321a1

Browse files
authored
Merge pull request #5493 from oss-qm/submit/install-prog
Makefile: allow overriding install command via environment
2 parents a152049 + 9643c99 commit 49321a1

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

Makefile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# Go command to use for build
1717
GO ?= go
18+
INSTALL ?= install
1819

1920
# Root directory of the project (absolute path).
2021
ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
@@ -249,7 +250,7 @@ man/%: docs/man/%.md FORCE
249250
go-md2man -in "$<" -out "$@"
250251

251252
define installmanpage
252-
mkdir -p $(DESTDIR)/man/man$(2);
253+
$(INSTALL) -d $(DESTDIR)/man/man$(2);
253254
gzip -c $(1) >$(DESTDIR)/man/man$(2)/$(3).gz;
254255
endef
255256

@@ -260,8 +261,8 @@ install-man: man
260261
releases/$(RELEASE).tar.gz: $(BINARIES)
261262
@echo "$(WHALE) $@"
262263
@rm -rf releases/$(RELEASE) releases/$(RELEASE).tar.gz
263-
@install -d releases/$(RELEASE)/bin
264-
@install $(BINARIES) releases/$(RELEASE)/bin
264+
@$(INSTALL) -d releases/$(RELEASE)/bin
265+
@$(INSTALL) $(BINARIES) releases/$(RELEASE)/bin
265266
@tar -czf releases/$(RELEASE).tar.gz -C releases/$(RELEASE) bin
266267
@rm -rf releases/$(RELEASE)
267268

@@ -272,27 +273,27 @@ release: releases/$(RELEASE).tar.gz
272273
# install of cri deps into release output directory
273274
ifeq ($(GOOS),windows)
274275
install-cri-deps: $(BINARIES)
275-
mkdir -p $(CRIDIR)
276+
$(INSTALL) -d $(CRIDIR)
276277
DESTDIR=$(CRIDIR) script/setup/install-cni-windows
277278
cp bin/* $(CRIDIR)
278279
else
279280
install-cri-deps: $(BINARIES)
280281
@rm -rf ${CRIDIR}
281-
@install -d ${CRIDIR}/usr/local/bin
282-
@install -D -m 755 bin/* ${CRIDIR}/usr/local/bin
283-
@install -d ${CRIDIR}/opt/containerd/cluster
282+
@$(INSTALL) -d ${CRIDIR}/usr/local/bin
283+
@$(INSTALL) -D -m 755 bin/* ${CRIDIR}/usr/local/bin
284+
@$(INSTALL) -d ${CRIDIR}/opt/containerd/cluster
284285
@cp -r contrib/gce ${CRIDIR}/opt/containerd/cluster/
285-
@install -d ${CRIDIR}/etc/systemd/system
286-
@install -m 644 containerd.service ${CRIDIR}/etc/systemd/system
286+
@$(INSTALL) -d ${CRIDIR}/etc/systemd/system
287+
@$(INSTALL) -m 644 containerd.service ${CRIDIR}/etc/systemd/system
287288
echo "CONTAINERD_VERSION: '$(VERSION:v%=%)'" | tee ${CRIDIR}/opt/containerd/cluster/version
288289

289290
DESTDIR=$(CRIDIR) script/setup/install-runc
290291
DESTDIR=$(CRIDIR) script/setup/install-cni
291292
DESTDIR=$(CRIDIR) script/setup/install-critools
292293
DESTDIR=$(CRIDIR) script/setup/install-imgcrypt
293294

294-
@install -d $(CRIDIR)/bin
295-
@install $(BINARIES) $(CRIDIR)/bin
295+
@$(INSTALL) -d $(CRIDIR)/bin
296+
@$(INSTALL) $(BINARIES) $(CRIDIR)/bin
296297
endif
297298

298299
ifeq ($(GOOS),windows)
@@ -345,8 +346,8 @@ clean-test: ## clean up debris from previously failed tests
345346

346347
install: ## install binaries
347348
@echo "$(WHALE) $@ $(BINARIES)"
348-
@mkdir -p $(DESTDIR)/bin
349-
@install $(BINARIES) $(DESTDIR)/bin
349+
@$(INSTALL) -d $(DESTDIR)/bin
350+
@$(INSTALL) $(BINARIES) $(DESTDIR)/bin
350351

351352
uninstall:
352353
@echo "$(WHALE) $@"

0 commit comments

Comments
 (0)