CI / build-and-test (push) Successful in 38s
make test: builds then runs all three test suites (138 tests). make clean: removes build, build-debug, build-release directories. Finishing off 0.2.
73 lines
2.0 KiB
Makefile
73 lines
2.0 KiB
Makefile
# kappa — build convenience Makefile
|
|
#
|
|
# Targets:
|
|
# build — default build (build/)
|
|
# debug — Debug build (build-debug/)
|
|
# release - Release build (build-release/)
|
|
# dist - tar.zst tarball of the release build (requires zstd)
|
|
# test — build then run all three test suites
|
|
# clean - remove all build directories
|
|
# dist-clean - remove everything under dist/
|
|
#
|
|
# Overridable: make release CXX=g++ GENERATOR="Unix Makefiles"
|
|
|
|
CC ?= clang
|
|
CXX ?= clang++
|
|
GENERATOR ?= Ninja
|
|
|
|
BUILD_DIR ?= build
|
|
DEBUG_DIR ?= build-debug
|
|
RELEASE_DIR ?= build-release
|
|
DIST_DIR ?= dist
|
|
|
|
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
|
GIT_TAG := $(shell git describe --tags --abbrev=0 2>/dev/null || echo 0.1.0)
|
|
STAMP := $(shell date +%Y-%M)
|
|
DIST_NAME := kappa-$(GIT_COMMIT)-$(GIT_TAG)-$(STAMP)
|
|
|
|
CMAKE := cmake
|
|
|
|
.PHONY: build debug release dist test clean dist-clean
|
|
|
|
build:
|
|
$(CMAKE) -S . -B $(BUILD_DIR) -G $(GENERATOR) \
|
|
-DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
|
|
$(CMAKE) --build $(BUILD_DIR)
|
|
|
|
debug:
|
|
$(CMAKE) -S . -B $(DEBUG_DIR) -G $(GENERATOR) \
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
-DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
|
|
$(CMAKE) --build $(DEBUG_DIR)
|
|
|
|
release:
|
|
$(CMAKE) -S . -B $(RELEASE_DIR) -G $(GENERATOR) \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
|
|
$(CMAKE) --build $(RELEASE_DIR)
|
|
|
|
dist: release
|
|
rm -rf $(DIST_DIR)/$(DIST_NAME)
|
|
$(CMAKE) --install $(RELEASE_DIR) --prefix $(DIST_DIR)/$(DIST_NAME)
|
|
tar --zstd -cf $(DIST_DIR)/$(DIST_NAME).tar.zst -C $(DIST_DIR) $(DIST_NAME)
|
|
rm -rf $(DIST_DIR)/$(DIST_NAME)
|
|
@echo "dist: $(DIST_DIR)/$(DIST_NAME).tar.zst"
|
|
|
|
dist-clean:
|
|
rm -rf $(DIST_DIR)
|
|
|
|
test: build
|
|
@echo "==> test.sh"
|
|
@./test.sh
|
|
@echo ""
|
|
@echo "==> test-init-switch.sh"
|
|
@./test-init-switch.sh
|
|
@echo ""
|
|
@echo "==> test-full.sh"
|
|
@./test-full.sh
|
|
@echo ""
|
|
@echo "all test suites passed"
|
|
|
|
clean:
|
|
rm -rf $(BUILD_DIR) $(DEBUG_DIR) $(RELEASE_DIR)
|