-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (58 loc) · 2.26 KB
/
Makefile
File metadata and controls
72 lines (58 loc) · 2.26 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Convenience Makefile for building std2 library components
BUILD_DIR = build
UNITTEST ?= false
.PHONY: all clean memory vector list std2 unittest configure
# Help target - lists available commands
help:
@echo "Available commands:"
@echo " make all - Build all targets"
@echo " make memory - Build memory component and run its tests"
@echo " make vector - Build vector component and run its tests"
@echo " make list - Build list component and run its tests"
@echo " make std2 - Build core std2 library"
@echo " make unittest - Build and run all unit tests"
@echo " make clean - Remove build directory"
@echo ""
@echo "Options:"
@echo " UNITTEST=true - Enable unit testing (default: false)"
@echo ""
@echo "Example:"
@echo " make vector UNITTEST=true - Build vector and run its tests"
configure: $(BUILD_DIR)
@cd $(BUILD_DIR) && cmake .. -DUNITTEST=$(UNITTEST)
all: configure
@cd $(BUILD_DIR) && cmake --build .
@if [ "$(UNITTEST)" = "true" ]; then \
cd $(BUILD_DIR) && ctest --output-on-failure; \
fi
$(BUILD_DIR):
@mkdir -p $(BUILD_DIR)
# Build targets with optional testing
memory: configure
@cd $(BUILD_DIR) && cmake --build . --target memory memory_tests
@if [ "$(UNITTEST)" = "true" ]; then \
cd $(BUILD_DIR) && GTEST_OUTPUT=xml:test-results/ GTEST_COLOR=1 ctest --output-on-failure -V -R "UniquePointerTest"; \
fi
vector: configure
@cd $(BUILD_DIR) && cmake --build . --target vector vector_tests
@if [ "$(UNITTEST)" = "true" ]; then \
cd $(BUILD_DIR) && GTEST_OUTPUT=xml:test-results/ GTEST_COLOR=1 ctest --output-on-failure -V -R "VectorTest|AllocatorTest"; \
fi
list: configure
@cd $(BUILD_DIR) && cmake --build . --target list list_tests
@if [ "$(UNITTEST)" = "true" ]; then \
cd $(BUILD_DIR) && GTEST_OUTPUT=xml:test-results/ GTEST_COLOR=1 ctest --output-on-failure -V -R "ListTest"; \
fi
std2: configure
@cd $(BUILD_DIR) && cmake --build . --target std2
@if [ "$(UNITTEST)" = "true" ]; then \
cd $(BUILD_DIR) && ctest --output-on-failure -R "^std2"; \
fi
# Run all unit tests explicitly
unittest: all
@cd $(BUILD_DIR) && cmake .. -DUNITTEST=true
@cd $(BUILD_DIR) && cmake --build . --target memory_tests vector_tests vector_tests
@cd $(BUILD_DIR) && ctest --output-on-failure
# Clean target
clean:
@rm -rf $(BUILD_DIR)