add prefix "common-" to make target names
This allows rules to be overridden with warnings about conflicting target names. Signed-off-by: Paul Gier <pgier@redhat.com>
This commit is contained in:
parent
a9d5034add
commit
cfb3f31538
|
@ -41,13 +41,18 @@ DOCKER_REPO ?= prom
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: style staticcheck unused build test
|
all: style staticcheck unused build test
|
||||||
|
|
||||||
.PHONY: style
|
# This rule is used to forward a target like "build" to "common-build". This
|
||||||
style:
|
# allows a new "build" target to be defined in a Makefile which includes this
|
||||||
|
# one and override "common-build" without override warnings.
|
||||||
|
%: common-% ;
|
||||||
|
|
||||||
|
.PHONY: common-style
|
||||||
|
common-style:
|
||||||
@echo ">> checking code style"
|
@echo ">> checking code style"
|
||||||
! $(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
|
! $(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
|
||||||
|
|
||||||
.PHONY: check_license
|
.PHONY: common-check_license
|
||||||
check_license:
|
common-check_license:
|
||||||
@echo ">> checking license header"
|
@echo ">> checking license header"
|
||||||
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
|
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
|
||||||
awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
|
awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
|
||||||
|
@ -57,56 +62,56 @@ check_license:
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
.PHONY: test-short
|
.PHONY: common-test-short
|
||||||
test-short:
|
common-test-short:
|
||||||
@echo ">> running short tests"
|
@echo ">> running short tests"
|
||||||
$(GO) test -short $(pkgs)
|
$(GO) test -short $(pkgs)
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: common-test
|
||||||
test:
|
common-test:
|
||||||
@echo ">> running all tests"
|
@echo ">> running all tests"
|
||||||
$(GO) test -race $(pkgs)
|
$(GO) test -race $(pkgs)
|
||||||
|
|
||||||
.PHONY: format
|
.PHONY: common-format
|
||||||
format:
|
common-format:
|
||||||
@echo ">> formatting code"
|
@echo ">> formatting code"
|
||||||
$(GO) fmt $(pkgs)
|
$(GO) fmt $(pkgs)
|
||||||
|
|
||||||
.PHONY: vet
|
.PHONY: common-vet
|
||||||
vet:
|
common-vet:
|
||||||
@echo ">> vetting code"
|
@echo ">> vetting code"
|
||||||
$(GO) vet $(pkgs)
|
$(GO) vet $(pkgs)
|
||||||
|
|
||||||
.PHONY: staticcheck
|
.PHONY: common-staticcheck
|
||||||
staticcheck: $(STATICCHECK)
|
common-staticcheck: $(STATICCHECK)
|
||||||
@echo ">> running staticcheck"
|
@echo ">> running staticcheck"
|
||||||
$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)
|
$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)
|
||||||
|
|
||||||
.PHONY: unused
|
.PHONY: common-unused
|
||||||
unused: $(GOVENDOR)
|
common-unused: $(GOVENDOR)
|
||||||
@echo ">> running check for unused packages"
|
@echo ">> running check for unused packages"
|
||||||
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
|
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: common-build
|
||||||
build: promu
|
common-build: promu
|
||||||
@echo ">> building binaries"
|
@echo ">> building binaries"
|
||||||
$(PROMU) build --prefix $(PREFIX)
|
$(PROMU) build --prefix $(PREFIX)
|
||||||
|
|
||||||
.PHONY: tarball
|
.PHONY: common-tarball
|
||||||
tarball: promu
|
common-tarball: promu
|
||||||
@echo ">> building release tarball"
|
@echo ">> building release tarball"
|
||||||
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
|
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
|
||||||
|
|
||||||
.PHONY: docker
|
.PHONY: common-docker
|
||||||
docker:
|
common-docker:
|
||||||
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
|
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
|
||||||
|
|
||||||
.PHONY: docker-publish
|
.PHONY: common-docker-publish
|
||||||
docker-publish:
|
common-docker-publish:
|
||||||
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
|
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
|
||||||
|
|
||||||
.PHONY: docker-tag-latest
|
.PHONY: common-docker-tag-latest
|
||||||
docker-tag-latest:
|
common-docker-tag-latest:
|
||||||
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):latest"
|
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):latest"
|
||||||
|
|
||||||
.PHONY: promu
|
.PHONY: promu
|
||||||
|
|
Loading…
Reference in New Issue