add Makefile: implement build, clean, test, and install targets
This commit is contained in:
39
Makefile
Normal file
39
Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
.PHONY: configure build clean test install
|
||||
|
||||
# Build directory
|
||||
BUILD_DIR := build
|
||||
|
||||
# Default target
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
|
||||
# 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 .
|
||||
|
||||
Reference in New Issue
Block a user