-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
68 lines (47 loc) · 2.39 KB
/
Makefile
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
BUILD_DIR_XCODE?=$(PWD)/BuildXcode
BUILD_DIR_NINJA?=$(PWD)/BuildNinja
RSD_UNITTESTS_DIR=$(BUILD_DIR_NINJA)/unittests
RSD=$(RSD_UNITTESTS_DIR)/RustSymbolDemanglingUnitTests
# Self-Documented Makefile
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## Show this help message.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
test: test_unit test_integration
test_unit: build_ninja ## Run Unit Tests (Builds Ninja cache first if it does not exist)
cd $(BUILD_DIR_NINJA) && ninja RustSymbolDemanglingUnitTests
# TODO: A common but dirty solution, people should learn about rpath
# http://stackoverflow.com/a/12399085/598057
cd $(RSD_UNITTESTS_DIR) && LD_LIBRARY_PATH=$(BUILD_DIR_NINJA)/lib $(RSD)
test_integration:
# TODO: also run unit tests using ninja
cd $(BUILD_DIR_NINJA) && ninja check-mull
CMAKE_COMMAND_LINE_DEBUG_FLAGS=# --trace # --debug-output # --debug-output --trace --trace-expand # --trace # --debug-output #
.PHONY: build build_xcode build_ninja
build_xcode: ## Build Xcode project with CMake.
mkdir -p $(BUILD_DIR_XCODE)
rm -rfv $(BUILD_DIR_XCODE)/CMakeCache.txt
cd $(BUILD_DIR_XCODE) && cmake ../ -G Xcode \
$(CMAKE_COMMAND_LINE_DEBUG_FLAGS)
rebuild_xcode: build_xcode reopen ## Build Xcode project with CMake, kill Xcode, reopen the project in Xcode
build_ninja: ## Build Ninja project with CMake.
mkdir -p $(BUILD_DIR_NINJA)
rm -rfv $(BUILD_DIR_NINJA)/CMakeCache.txt
cd $(BUILD_DIR_NINJA) && cmake ../ -G Ninja \
$(CMAKE_COMMAND_LINE_DEBUG_FLAGS)
# -DCMAKE_TOOLCHAIN_FILE=$(RSD_CMAKE_TOOLCHAIN)
## Xcode-specific tools.
## TODO: maybe extract to Makefile.Xcode?
open: ## Open RustSymbolDemangling.xcodeproj in Xcode
open BuildXcode/RustSymbolDemangling.xcodeproj
# This reopen task is mostly needed to do a work that involves serious
# modifications of CMake's files: **/CMakeLists.txt and toolchain files.
# Xcode does not pickup all of the changes in CMake without being reopened.
reopen: ## Kill Xcode and open RustSymbolDemangling.xcodeproj in Xcode.
killall Xcode || true
open BuildXcode/RustSymbolDemangling.xcodeproj
clean: clean_ninja clean_xcode ## Delete CMake build caches: Xcode and Ninja.
clean_xcode: ## Delete Xcode CMake build cache.
rm -rfv $(BUILD_DIR_XCODE)
clean_ninja: ## Delete Ninja CMake build cache.
rm -rfv $(BUILD_DIR_NINJA)