Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: clean rhcs local directory before install #322

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ else
BINARY=terraform-provider-rhcs
DESTINATION_PREFIX=$(HOME)/.terraform.d/plugins
endif
RHCS_LOCAL_DIR=$(DESTINATION_PREFIX)/terraform.local/local/rhcs

GO_ARCH=$(shell go env GOARCH)
TARGET_ARCH=$(shell go env GOOS)_${GO_ARCH}
Expand All @@ -47,7 +48,7 @@ build:
go build -ldflags="$(ldflags)" -o ${BINARY}

.PHONY: install
install: build
install: clean build
platform=$$(terraform version -json | jq -r .platform); \
extension=""; \
if [[ "$${platform}" =~ ^windows_.*$$ ]]; then \
Expand All @@ -56,7 +57,7 @@ install: build
if [ -z "${version}" ]; then \
version="0.0.2"; \
fi; \
dir="$(DESTINATION_PREFIX)/terraform.local/local/rhcs/$${version}/$(TARGET_ARCH)"; \
dir="$(RHCS_LOCAL_DIR)/$${version}/$(TARGET_ARCH)"; \
file="terraform-provider-rhcs$${extension}"; \
mkdir -p "$${dir}"; \
mv ${BINARY} "$${dir}/$${file}"
Expand Down Expand Up @@ -91,7 +92,7 @@ fmt: fmt_go fmt_tf

.PHONY: clean
clean:
rm -rf .terraform.d
rm -rf "$(RHCS_LOCAL_DIR)"

generate:
go generate ./...
Expand Down
Loading