Skip to content

Commit 6ed9dfa

Browse files
authored
Fix recalculating licenses.csv (#1827)
1 parent 27a701e commit 6ed9dfa

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,23 @@ help: ## Show this help screen
122122
.PHONY: all
123123
all: manager ## Build all binaries
124124

125-
licenses.csv: go.mod ## Track licenses in a CSV file
125+
.PHONY: build-licenses.csv
126+
build-licenses.csv: go.mod ## Track licenses in a CSV file
126127
@echo "Tracking licenses into file $@"
127128
@echo "========================================"
128129
GOOS=linux GOARCH=amd64 go mod download
129130
# https://github.com/google/go-licenses/issues/244
130-
GOTOOLCHAIN=local GOOS=linux GOARCH=amd64 $(GO_LICENSES) csv --include_tests $(BASE_GO_PACKAGE)/... > $@
131+
GOTOOLCHAIN=local GOOS=linux GOARCH=amd64 $(GO_LICENSES) csv --include_tests $(BASE_GO_PACKAGE)/... > licenses.csv
131132
echo $(GOMOD_SHA) > $(LICENSES_GOMOD_SHA_FILE)
132133

134+
.PHONY: recompute-licenses
133135
recompute-licenses: ## Recompute the licenses.csv only if needed (gomod was changed)
134-
@[ "$(GOMOD_SHA)" == "$(GOMOD_LICENSES_SHA)" ] || $(MAKE) licenses.csv
136+
@[ "$(GOMOD_SHA)" == "$(GOMOD_LICENSES_SHA)" ] || $(MAKE) build-licenses.csv
135137

136-
licenses-up-to-date:
138+
.PHONY: licenses-up-to-date
139+
licenses-up-to-date: ## Check if the licenses.csv is up to date
137140
@if [ "$(GOMOD_SHA)" != "$(GOMOD_LICENSES_SHA)" ]; then \
138-
echo "licenses.csv needs to be recalculated: git rebase AND run 'make licenses.csv'"; exit 1; \
141+
echo "licenses.csv needs to be recalculated: git rebase AND run 'make build-licenses.csv'"; exit 1; \
139142
else echo "licenses.csv is OK! (up to date)"; fi
140143

141144
.PHONY: check-licenses

0 commit comments

Comments
 (0)