-
Notifications
You must be signed in to change notification settings - Fork 40
/
Makefile
62 lines (51 loc) · 1.45 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
# @file Makefile
# Not part of the PythonMonkey build - just workflow helper for Wes.
# @author Wes Garland, wes@distributive.network
# @date March 2024
#
BUILD = Debug # (case-insensitive) Release, DRelease, Debug, Sanitize, Profile, or None
DOCS = false
VERBOSE = true
PYTHON = python3
RUN = poetry run
OS_NAME := $(shell uname -s)
ifeq ($(OS_NAME),Linux)
CPU_COUNT = $(shell cat /proc/cpuinfo | grep -c processor)
MAX_JOBS = 10
CPUS := $(shell test $(CPU_COUNT) -lt $(MAX_JOBS) && echo $(CPU_COUNT) || echo $(MAX_JOBS))
PYTHON_BUILD_ENV += CPUS=$(CPUS)
endif
ifeq ($(BUILD),Profile)
PYTHON_BUILD_ENV += BUILD_TYPE=Profile
else ifeq ($(BUILD),Sanitize)
PYTHON_BUILD_ENV += BUILD_TYPE=Sanitize
else ifeq ($(BUILD),Debug)
PYTHON_BUILD_ENV += BUILD_TYPE=Debug
else ifeq ($(BUILD),DRelease)
PYTHON_BUILD_ENV += BUILD_TYPE=DRelease
else ifeq ($(BUILD), None)
PYTHON_BUILD_ENV += BUILD_TYPE=None
else # Release build
PYTHON_BUILD_ENV += BUILD_TYPE=Release
endif
ifeq ($(DOCS),true)
PYTHON_BUILD_ENV += BUILD_DOCS=1
endif
ifeq ($(VERBOSE),true)
PYTHON_BUILD_ENV += VERBOSE=1
endif
.PHONY: build test all clean debug
build:
$(PYTHON_BUILD_ENV) $(PYTHON) ./build.py
test:
$(RUN) ./peter-jr tests
$(RUN) pytest tests/python
all: build test
clean:
rm -rf build/src/CMakeFiles/pythonmonkey.dir
rm -f build/src/pythonmonkey.so
rm -f python/pythonmonkey/pythonmonkey.so
debug:
@echo JOBS=$(JOBS)
@echo CPU_COUNT=$(CPU_COUNT)
@echo OS_NAME=$(OS_NAME)