-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (27 loc) · 1.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
BUILD_DIR = build
REPO = ghcr.io/janekbaraniewski/ser2net2ser
VERSION ?= latest
COMMIT_HASH ?= $(shell git rev-parse --short HEAD)
CMAKE_FLAGS ?= -DCMAKE_BUILD_TYPE=Release
help: ## Show this help message
@echo "Usage: make [target]"
@echo ""
@echo "Available targets:"
@grep -E '^[a-zA-Z_\-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " %-30s %s\n", $$1, $$2}'
clean: ## Clean build directory
@rm -rf ${BUILD_DIR}/*
build: ## Build with cmake
build: clean
@cmake -S . -B build $(CMAKE_FLAGS)
@cmake --build build
test: ## Build and test
test: build
@cd build && ctest
build-images: ## Build container images
@docker build . -f Dockerfile -t $(REPO):$(COMMIT_HASH)
tag-images: ## Tag container images
@docker tag $(REPO):$(COMMIT_HASH) $(REPO):$(VERSION)
push-images: ## Push container images to registry
@docker push $(REPO):$(COMMIT_HASH)
@docker push $(REPO):$(VERSION)
.PHONY: clean build test build-images build-server-image build-client-image tag-images tag-client-image tag-server-image push-images push-client-images push-server-images help