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: https://github.com/go-gitea/gitea/issues/10196 Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>release/v1.15
parent
bfd62b6f01
commit
d9c79986ea
16
Makefile
16
Makefile
|
@ -70,6 +70,7 @@ FOMANTIC_DEST_DIR := public/fomantic
|
||||||
FOMANTIC_EVIDENCE := $(MAKE_EVIDENCE_DIR)/fomantic
|
FOMANTIC_EVIDENCE := $(MAKE_EVIDENCE_DIR)/fomantic
|
||||||
|
|
||||||
TAGS ?=
|
TAGS ?=
|
||||||
|
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags
|
||||||
|
|
||||||
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
|
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
|
||||||
|
|
||||||
|
@ -168,8 +169,17 @@ fmt:
|
||||||
vet:
|
vet:
|
||||||
$(GO) vet $(PACKAGES)
|
$(GO) vet $(PACKAGES)
|
||||||
|
|
||||||
|
.PHONY: $(TAGS_EVIDENCE)
|
||||||
|
$(TAGS_EVIDENCE):
|
||||||
|
@mkdir -p $(MAKE_EVIDENCE_DIR)
|
||||||
|
@echo "$(TAGS)" > $(TAGS_EVIDENCE)
|
||||||
|
|
||||||
|
ifneq "$(TAGS)" "$(shell cat $(TAGS_EVIDENCE) 2>/dev/null)"
|
||||||
|
TAGS_PREREQ := $(TAGS_EVIDENCE)
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: generate
|
.PHONY: generate
|
||||||
generate: fomantic webpack
|
generate: fomantic webpack $(TAGS_PREREQ)
|
||||||
GO111MODULE=on $(GO) generate -mod=vendor -tags '$(TAGS)' $(PACKAGES)
|
GO111MODULE=on $(GO) generate -mod=vendor -tags '$(TAGS)' $(PACKAGES)
|
||||||
|
|
||||||
.PHONY: generate-swagger
|
.PHONY: generate-swagger
|
||||||
|
@ -425,14 +435,14 @@ migrations.sqlite.test: $(GO_SOURCES)
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check: test
|
check: test
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install $(TAGS_PREREQ)
|
||||||
install: $(wildcard *.go)
|
install: $(wildcard *.go)
|
||||||
$(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
|
$(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: go-check generate $(EXECUTABLE)
|
build: go-check generate $(EXECUTABLE)
|
||||||
|
|
||||||
$(EXECUTABLE): $(GO_SOURCES)
|
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
|
||||||
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
||||||
|
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
|
|
Loading…
Reference in New Issue