Skip to content

Commit

Permalink
Clean up makefile
Browse files Browse the repository at this point in the history
* Remove `Makefile.common` and with it all of the vestigial uses of
  Prometheus tools
* Port linter checks to Makefile using standard go tools

Signed-off-by: Nicolas Bock <[email protected]>
  • Loading branch information
nicolasbock committed Oct 2, 2023
1 parent 4254edb commit 22a1486
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 322 deletions.
66 changes: 48 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,53 @@
# Copyright 2015 The Prometheus Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

DOCKER_REPO ?= athena
DOCKER_IMAGE_NAMES ?= processor monitor

include Makefile.common
.PHONY: all
all: lint build test

.PHONY: docker-compose
docker-compose:
docker-compose down --remove-orphans
BRANCH=$(shell git branch --show-current) docker-compose up --force-recreate --build

devel: common-build common-docker docker-compose
.PHONY: devel
devel: athena-monitor athena-processor docker-build docker-compose

.PHONY: common-docker monitor processor
docker-build: athena-monitor docker-build-monitor athena-processor docker-build-processor

.PHONY: docker-build-monitor docker-build-processor
docker-build-monitor docker-build-processor: docker-build-%:
docker build \
--tag athena/athena-$*-linux-amd64:$(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) \
--file cmd/$*/Dockerfile \
--no-cache \
--build-arg ARCH=amd64 \
--build-arg OS=linux \
.

.PHONY: build
build: athena-monitor athena-processor

athena-monitor:
go build -v -o $@ cmd/monitor/main.go

athena-processor:
go build -v -o $@ cmd/processor/main.go

.PHONY: lint
lint: check_modules gofmt

.PHONY: check_modules
check_modules:
go mod tidy

.PHONY: gofmt
gofmt: check_modules
@fmt_result=$$(gofmt -d $$(find . -name '*.go' -print)); \
if [ -n "$${fmt_result}" ]; then \
echo "gofmt checking failed"; \
echo; \
echo "$${fmt_result}"; \
false; \
fi

.PHONY: test
test:
go test -v ./...
304 changes: 0 additions & 304 deletions Makefile.common

This file was deleted.

0 comments on commit 22a1486

Please sign in to comment.