Skip to content

Commit d9c7998

Browse files
silverwindtechknowlogicksapk
authored
add TAGS variable prereq on make targets that use it (#10219)
Write out TAGS to .make_evidence/tags and compare it to the previous invocation. If they differ, insert the evidence file into the prereqs of targets that use TAGS. I made it .PHONY so it always builds. I did not include the prereq on release tasks, asssuming the will always do a clean build. Fixes: #10196 Co-authored-by: techknowlogick <[email protected]> Co-authored-by: Antoine GIRARD <[email protected]>
1 parent bfd62b6 commit d9c7998

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ FOMANTIC_DEST_DIR := public/fomantic
7070
FOMANTIC_EVIDENCE := $(MAKE_EVIDENCE_DIR)/fomantic
7171

7272
TAGS ?=
73+
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags
7374

7475
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
7576

@@ -168,8 +169,17 @@ fmt:
168169
vet:
169170
$(GO) vet $(PACKAGES)
170171

172+
.PHONY: $(TAGS_EVIDENCE)
173+
$(TAGS_EVIDENCE):
174+
@mkdir -p $(MAKE_EVIDENCE_DIR)
175+
@echo "$(TAGS)" > $(TAGS_EVIDENCE)
176+
177+
ifneq "$(TAGS)" "$(shell cat $(TAGS_EVIDENCE) 2>/dev/null)"
178+
TAGS_PREREQ := $(TAGS_EVIDENCE)
179+
endif
180+
171181
.PHONY: generate
172-
generate: fomantic webpack
182+
generate: fomantic webpack $(TAGS_PREREQ)
173183
GO111MODULE=on $(GO) generate -mod=vendor -tags '$(TAGS)' $(PACKAGES)
174184

175185
.PHONY: generate-swagger
@@ -425,14 +435,14 @@ migrations.sqlite.test: $(GO_SOURCES)
425435
.PHONY: check
426436
check: test
427437

428-
.PHONY: install
438+
.PHONY: install $(TAGS_PREREQ)
429439
install: $(wildcard *.go)
430440
$(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
431441

432442
.PHONY: build
433443
build: go-check generate $(EXECUTABLE)
434444

435-
$(EXECUTABLE): $(GO_SOURCES)
445+
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
436446
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
437447

438448
.PHONY: release

0 commit comments

Comments
 (0)