-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (40 loc) · 1.3 KB
/
Copy pathMakefile
File metadata and controls
53 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Makefile wrapper for CMake build
# Default build directory
BUILD_DIR = build
# Default build type
BUILD_TYPE ?= Debug
# CMake generation flags
CMAKE_FLAGS ?= -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
# Determine the number of CPU cores for parallel builds
NPROCS = $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)
.PHONY: all clean test install configure reconfigure
all: configure
@echo "Building AXL compiler..."
@cmake --build $(BUILD_DIR) -j$(NPROCS)
configure:
@if [ ! -d "$(BUILD_DIR)" ]; then \
echo "Configuring CMake build..."; \
mkdir -p $(BUILD_DIR); \
cd $(BUILD_DIR) && cmake $(CMAKE_FLAGS) ..; \
fi
reconfigure:
@echo "Reconfiguring CMake build..."
@rm -rf $(BUILD_DIR)/CMakeCache.txt
@cd $(BUILD_DIR) && cmake $(CMAKE_FLAGS) ..
clean:
@echo "Cleaning build directory..."
@rm -rf $(BUILD_DIR)
test: all
@echo "Running tests..."
@cd $(BUILD_DIR) && ctest --output-on-failure
install: all
@echo "Installing AXL compiler..."
@cd $(BUILD_DIR) && cmake --install .
# Target for sanitizer builds
sanitize:
@$(MAKE) reconfigure CMAKE_FLAGS="$(CMAKE_FLAGS) -DAXL_ENABLE_SANITIZERS=ON"
@$(MAKE) all
# Target for dry run (just configure and show what would be built)
dry-run: configure
@echo "Dry run complete. Build files generated in $(BUILD_DIR)"
@echo "To build, run: make"