1+ # *** Build Parameters ***
2+ # Whether to use PMM for the build process
3+ USE_PMM := TRUE
4+ # Whether to build tests
5+ BUILD_TESTING := TRUE
6+ # Sanitizers to request (Comma-separated list)
7+ SANITIZE :=
8+ # The configurations to build (Semicolon-separated, or "all")
9+ CONFIGS := Debug
10+ # If running tests, the configuration to test
11+ TEST_CONFIG := Debug
12+ # Set the CMAKE_INSTALL_PREFIX and the `--prefix` arg for installs
13+ INSTALL_PREFIX :=
14+
15+ # *** Execution Parameters ***
16+ # Set the LAUNCHER parameter to prefix all executed commands
17+ LAUNCHER :=
18+
19+ # Update the shell to be executed by the launching command. Make will use
20+ # this to execute all commands in the Makefile:
21+ SHELL := $(LAUNCHER ) $(SHELL )
22+
123.SILENT :
224.PHONY : docs-html docs-serve default build test format format-check packages
325
@@ -12,45 +34,51 @@ THIS_DIR := $(shell dirname $(THIS_FILE))
1234# Directory where we will scribble build files
1335BUILD_DIR ?= $(THIS_DIR ) /_build/auto
1436
15- # uv commands used in this file
16- UV_RUN := uv run
17- DOCS_RUN := $(UV_RUN ) --isolated --group=docs
18- FORMAT_RUN := $(UV_RUN ) --isolated --group=format
19- # Build is not isolated, because CMake caches paths to certain files
20- BUILD_RUN := $(UV_RUN ) --group=build
37+ PYTHON_RUN :=
2138# Run CMake within the uv environment
22- CMAKE_RUN := $( BUILD_RUN ) cmake
39+ CMAKE_RUN := cmake
2340
2441SPHINX_JOBS ?= auto
2542SPHINX_ARGS := -W -j "$(SPHINX_JOBS ) " -aT -b dirhtml
2643
2744DOCS_SRC := $(THIS_DIR ) /docs
2845DOCS_OUT := $(BUILD_DIR ) /docs/dev/html
2946docs-html :
30- $( DOCS_RUN ) sphinx-build $(SPHINX_ARGS ) $(DOCS_SRC ) $(DOCS_OUT )
47+ sphinx-build $(SPHINX_ARGS ) $(DOCS_SRC ) $(DOCS_OUT )
3148
3249docs-serve :
33- $( DOCS_RUN ) sphinx-autobuild $(SPHINX_ARGS ) $(DOCS_SRC ) $(DOCS_OUT )
50+ sphinx-autobuild $(SPHINX_ARGS ) $(DOCS_SRC ) $(DOCS_OUT )
3451
35- build :
52+ configure :
3653 $(CMAKE_RUN ) \
3754 -S " $( THIS_DIR) " \
3855 -B " $( BUILD_DIR) " \
39- --fresh \
40- -D CMAKE_CROSS_CONFIGS=" Debug" \
56+ -D CMAKE_CROSS_CONFIGS=" $( CONFIGS) " \
4157 -D CMAKE_DEFAULT_CONFIGS=all \
58+ -D AMONGOC_USE_PMM=$(USE_PMM ) \
59+ -D BUILD_TESTING=$(BUILD_TESTING ) \
60+ -D MONGO_SANITIZE=" $( SANITIZE) " \
61+ -D CMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX ) \
4262 -G " Ninja Multi-Config"
63+
64+ build : configure
65+ $(MAKE ) build-fast
66+
67+ build-fast :
4368 $(CMAKE_RUN ) --build " $( BUILD_DIR) "
4469
4570test : build
71+ $(MAKE ) test-fast
72+
73+ test-fast :
4674 $(CMAKE_RUN ) -E chdir " $( BUILD_DIR) " \
47- ctest -C Debug -j4 --output-on-failure
75+ ctest -C $( TEST_CONFIG ) -j4 --output-on-failure --progress -E CMake/ \| URI/spec/
4876
4977format-check :
50- $(UV_RUN ) --group format tools/format.py --mode=check
78+ $(PYTHON_RUN ) tools/format.py --mode=check
5179
5280format :
53- $(UV_RUN ) --group format tools/format.py
81+ $(PYTHON_RUN ) tools/format.py
5482
5583packages :
5684 bash $(THIS_DIR ) /tools/earthly.sh -a +build-multi/ _build/pkgs
0 commit comments