45 lines
958 B
Makefile
45 lines
958 B
Makefile
.PHONY: configure build clean test install
|
|
|
|
# Lib
|
|
LIB_NAME := dynamic_array
|
|
|
|
# Build directory
|
|
BUILD_DIR := build
|
|
|
|
# Default target
|
|
.DEFAULT_GOAL := help
|
|
|
|
INSTALL_PREFIX ?= ~/.local/bin/$(LIB_NAME)
|
|
|
|
|
|
# Help target
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " make configure - Configure the project with CMake"
|
|
@echo " make build - Build the project"
|
|
@echo " make clean - Clean build artifacts"
|
|
@echo " make test - Run tests"
|
|
@echo " make install - Install the library"
|
|
|
|
# Configure: Run CMake configuration
|
|
configure:
|
|
@mkdir -p $(BUILD_DIR)
|
|
cd $(BUILD_DIR) && cmake ..
|
|
|
|
# Build: Compile the project
|
|
build:
|
|
cd $(BUILD_DIR) && cmake --build .
|
|
|
|
# Clean: Remove build directory and artifacts
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
# Test: Run the test suite
|
|
test: build
|
|
cd $(BUILD_DIR) && ctest --output-on-failure -V
|
|
|
|
# Install: Install the library
|
|
install: build
|
|
cd $(BUILD_DIR) && cmake --install . --prefix $(INSTALL_PREFIX)
|
|
|