Skip to content
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

Clean up makefile #85

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
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
69 changes: 51 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,56 @@
# 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
mkdir --parents tmp
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

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

.PHONY: athena-processor
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.

Loading