build output to appropriate dir 90/3790/3
authorjcope <jcope@redhat.com>
Mon, 12 Oct 2020 15:42:35 +0000 (10:42 -0500)
committerjcope <jcope@redhat.com>
Wed, 14 Oct 2020 15:09:39 +0000 (10:09 -0500)
GOBIN is defined but overridden in go build command.  This fix corrects
the bug and builds binaries to ./bin.  Includes a .gitignore file in ./bin
to exclude build artifacts.

Replaces hardcoded ./bin paths in other commands with $(GOBIN), else
other make targets may not reference the most recent binary.

Change-Id: Icc7e0e23fef9ec4f41e5a9660bbf3d21d056deb4
Signed-off-by: jcope <jcope@redhat.com>
Makefile
bin/.gitignore [new file with mode: 0644]

index 992623b..f53ba55 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -43,12 +43,12 @@ binary:
 
 build:
        @echo "Building knictl with $(GOPATH) to knictl.tar.gz"
-       @GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o $(GONAME) $(GOFILES)
-       tar -czvf knictl.tar.gz $(GONAME) plugins utils
+       @GOPATH=$(GOPATH) go build -o "$(GOBIN)/$(GONAME)" $(GOFILES)
+       tar -czvf "$(GOBIN)/knictl.tar.gz" "$(GOBIN)/$(GONAME)" plugins utils
 
 clean:
        @echo "Destroying previous cluster"
-       @./bin/$(GONAME) clean --build_path $(BUILDDIR)
+       @"$(GOBIN)/$(GONAME)" clean --build_path $(BUILDDIR)
 
 dependencies:
        @echo "Installing dependencies"
@@ -56,12 +56,12 @@ dependencies:
 
 deploy: dependencies
        @echo "Launching cluster deployment bin/$(GONAME)"
-       @./bin/$(GONAME) generate --installer_path $(INSTALLER_PATH) --build_path $(BUILDDIR) --base_repository $(BASE_REPO) --base_path $(BASE_PATH) --secrets_repository $(CREDENTIALS) --site_repository $(SITE_REPO) --settings_path $(SETTINGS_PATH) --master_memory_mb $(MASTER_MEMORY_MB) --ssh_key_path $(SSH_KEY_PATH)
+       @"$(GOBIN)/$(GONAME)" generate --installer_path $(INSTALLER_PATH) --build_path $(BUILDDIR) --base_repository $(BASE_REPO) --base_path $(BASE_PATH) --secrets_repository $(CREDENTIALS) --site_repository $(SITE_REPO) --settings_path $(SETTINGS_PATH) --master_memory_mb $(MASTER_MEMORY_MB) --ssh_key_path $(SSH_KEY_PATH)
        $(MAKE) workloads
 
 workloads:
-       @./bin/$(GONAME) workloads --site_repository $(SITE_REPO) --cluster_credentials $(CLUSTER_CREDENTIALS) --workload_type customizations
-       @./bin/$(GONAME) workloads --site_repository $(SITE_REPO) --cluster_credentials $(CLUSTER_CREDENTIALS) --workload_type workloads
+       @"$(GOBIN)$(GONAME)" workloads --site_repository $(SITE_REPO) --cluster_credentials $(CLUSTER_CREDENTIALS) --workload_type customizations
+       @"$(GOBIN)$(GONAME)" workloads --site_repository $(SITE_REPO) --cluster_credentials $(CLUSTER_CREDENTIALS) --workload_type workloads
 
 help:
        @echo "Please use \`make <target>' where <target> is one of"
diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644 (file)
index 0000000..72e8ffc
--- /dev/null
@@ -0,0 +1 @@
+*