Skip to content

add TAGS variable prereq on make targets that use it #10219

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

Merged
merged 4 commits into from
Feb 11, 2020
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
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ FOMANTIC_DEST_DIR := public/fomantic
FOMANTIC_EVIDENCE := $(MAKE_EVIDENCE_DIR)/fomantic

TAGS ?=
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags

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

Expand Down Expand Up @@ -168,8 +169,17 @@ fmt:
vet:
$(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
generate: fomantic webpack
generate: fomantic webpack $(TAGS_PREREQ)
GO111MODULE=on $(GO) generate -mod=vendor -tags '$(TAGS)' $(PACKAGES)

.PHONY: generate-swagger
Expand Down Expand Up @@ -425,14 +435,14 @@ migrations.sqlite.test: $(GO_SOURCES)
.PHONY: check
check: test

.PHONY: install
.PHONY: install $(TAGS_PREREQ)
install: $(wildcard *.go)
$(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'

.PHONY: build
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 $@

.PHONY: release
Expand Down