mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-02-14 18:29:53 +00:00
chore: updates to make targets for building binaries (#1733)
* chore: do not automatically clean binaries before building Signed-off-by: Evans Mungai <evans@replicated.com> * chore: detect if source files changed before building Signed-off-by: Evans Mungai <evans@replicated.com> --------- Signed-off-by: Evans Mungai <evans@replicated.com>
This commit is contained in:
36
Makefile
36
Makefile
@@ -7,7 +7,6 @@ VERSION_PACKAGE = github.com/replicatedhq/troubleshoot/pkg/version
|
||||
VERSION ?=`git describe --tags --dirty`
|
||||
DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
|
||||
RUN?=""
|
||||
GOLANGCI_LINT_VERSION ?= "v1.61.0"
|
||||
|
||||
GIT_TREE = $(shell git rev-parse --is-inside-work-tree 2>/dev/null)
|
||||
ifneq "$(GIT_TREE)" ""
|
||||
@@ -104,18 +103,33 @@ clean:
|
||||
tidy:
|
||||
go mod tidy
|
||||
|
||||
bin/support-bundle:
|
||||
# Only build when any of the files in SOURCES changes, or if bin/<file> is absent
|
||||
MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
SOURCES := $(shell find $(MAKEFILE_DIR) -type f \( -name "*.go" -o -name "go.mod" -o -name "go.sum" \))
|
||||
bin/support-bundle: $(SOURCES)
|
||||
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/support-bundle github.com/replicatedhq/troubleshoot/cmd/troubleshoot
|
||||
|
||||
bin/preflight:
|
||||
bin/preflight: $(SOURCES)
|
||||
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/preflight github.com/replicatedhq/troubleshoot/cmd/preflight
|
||||
|
||||
bin/analyze:
|
||||
bin/analyze: $(SOURCES)
|
||||
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/analyze github.com/replicatedhq/troubleshoot/cmd/analyze
|
||||
|
||||
bin/collect:
|
||||
bin/collect: $(SOURCES)
|
||||
go build ${BUILDFLAGS} ${LDFLAGS} -o bin/collect github.com/replicatedhq/troubleshoot/cmd/collect
|
||||
|
||||
.PHONY: support-bundle
|
||||
support-bundle: bin/support-bundle
|
||||
|
||||
.PHONY: preflight
|
||||
preflight: bin/preflight
|
||||
|
||||
.PHONY: analyze
|
||||
analyze: bin/analyze
|
||||
|
||||
.PHONY: collect
|
||||
collect: bin/collect
|
||||
|
||||
build-linux: tidy
|
||||
@echo "Build cli binaries for Linux"
|
||||
GOOS=linux GOARCH=amd64 $(MAKE) -j bin/support-bundle bin/preflight bin/analyze bin/collect
|
||||
@@ -256,18 +270,6 @@ npm-install:
|
||||
|
||||
######## Lagacy make targets ###########
|
||||
# Deprecated: These can be removed
|
||||
.PHONY: support-bundle
|
||||
support-bundle: clean bin/support-bundle
|
||||
|
||||
.PHONY: preflight
|
||||
preflight: clean bin/preflight
|
||||
|
||||
.PHONY: analyze
|
||||
analyze: clean bin/analyze
|
||||
|
||||
.PHONY: collect
|
||||
collect: clean bin/collect
|
||||
|
||||
.PHONY: run-troubleshoot
|
||||
run-troubleshoot: run-support-bundle
|
||||
|
||||
|
||||
Reference in New Issue
Block a user