From d7c0127f97f3d20c10438af5554f964a29b94f6d Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 25 Dec 2019 15:46:28 -0500 Subject: [PATCH] Allow to run Makefile for another directory It is possible for a user to run make from outside of the acceptance-testing directory. For example $ cd /tmp $ make -f $GOPATH/src/helm.sh/acceptance-testing/Makefile To support this, the Makefile must use the ROOT_DIR of where the Makefile resides, so as to find all other files. Signed-off-by: Marc Khouzam --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e175d6b..a63353a 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,19 @@ -SHELL = /bin/bash +SHELL = /bin/bash +ROOT_DIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) .PHONY: acceptance acceptance: - @scripts/acceptance.sh + @$(ROOT_DIR)/scripts/acceptance.sh .PHONY: github-actions-ci github-actions-ci: - @scripts/github-actions-ci.sh + @$(ROOT_DIR)/scripts/github-actions-ci.sh .PHONY: github-actions-ci-local github-actions-ci-local: docker run -it --rm \ - -v $(shell pwd):/tmp/acceptance-testing \ + -v $(ROOT_DIR):/tmp/acceptance-testing \ -w /tmp/acceptance-testing \ --privileged -v /var/run/docker.sock:/var/run/docker.sock \ --entrypoint=/bin/bash ubuntu:latest \ - -c 'set +e; scripts/github-actions-ci.sh; echo "Exited $?. (Ctrl+D to exit shell)"; bash' \ No newline at end of file + -c 'set +e; scripts/github-actions-ci.sh; echo "Exited $?. (Ctrl+D to exit shell)"; bash'