Skip to content

Commit 157e204

Browse files
committed
[refactor] Clean up Makefile structure and improve build process clarity
1 parent 5e652e0 commit 157e204

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

Makefile

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,39 @@
11
PROJECT = CodeAstra
22
BUILD_DIR = $(PWD)/build
3-
EXECUTABLE = $(PROJECT)
43

5-
# Set CMake options
64
CMAKE_OPTIONS = ..
75

8-
# Default target: Run CMake and install the project
9-
all: build install
6+
.PHONY: all build clean install build_tests test
7+
8+
all: install
109

11-
# Run CMake to build the project
1210
build:
13-
@echo "Building $(PROJECT) with CMake..."
11+
@echo "Building $(PROJECT)..."
1412
@mkdir -p $(BUILD_DIR)
1513
@cd $(BUILD_DIR) && cmake $(CMAKE_OPTIONS)
1614

17-
# Clean the build directory
1815
clean:
1916
@echo "Cleaning the build directory..."
2017
@rm -rf $(BUILD_DIR)
2118

22-
# Uninstalling the software
23-
uninstall: clean
24-
@echo "Uninstalling $(PROJECT)..."
25-
@rm -f $(EXECUTABLE)
26-
27-
# Install the project
2819
install: build
2920
@echo "Installing $(PROJECT)..."
30-
@cd $(BUILD_DIR) && make
31-
@echo "$(PROJECT) installed."
21+
@cmake --build $(BUILD_DIR)
22+
@echo "Installation complete."
3223

3324
build_tests: build
34-
@cd $(BUILD_DIR)/tests/ && make
25+
@echo "Building tests..."
26+
@$(MAKE) -C $(BUILD_DIR)/tests
3527

3628
test: build_tests
29+
@echo "Running tests..."
3730
@for test in ./build/tests/test_*; do \
3831
if [ -f $$test ]; then \
3932
echo "Running $$test..."; \
4033
$$test; \
4134
fi; \
4235
done
36+
37+
run:
38+
@echo "Running $(PROJECT)..."
39+
@./build/bin/$(PROJECT)

0 commit comments

Comments
 (0)