add makefile, improve gitignore, formatting

This commit is contained in:
2026-01-04 21:56:17 +01:00
parent c0fb0e8122
commit 715d12f29a
4 changed files with 33 additions and 5 deletions
+25
View File
@@ -0,0 +1,25 @@
BUILD_DIR := build
EXECUTABLE := modbus
.PHONY: all build run clean rebuild debug release help
all: build
# Configure and build the project
build:
@mkdir -p $(BUILD_DIR)
@cd $(BUILD_DIR) && cmake ..
@cmake --build $(BUILD_DIR)
@echo "Build complete. Executable: $(BUILD_DIR)/$(EXECUTABLE)"
# Run the built executable, build if needed
run: build
@echo "Running $(EXECUTABLE)..."
@./$(BUILD_DIR)/$(EXECUTABLE)
# Clean build artifacts
clean:
@rm -rf $(BUILD_DIR)
@echo "Build directory cleaned"
# Rebuild from scratch
rebuild: clean build