-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Makefile
156 lines (124 loc) · 4.25 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# A GNU Makefile to run various tasks - compatibility for us old-timers.
# Note: This makefile include remake-style target comments.
# These comments before the targets start with #:
# remake --tasks to shows the targets and the comments
GIT2CL ?= admin-tools/git2cl
PYTHON ?= python3
PIP ?= pip3
BASH ?= bash
RM ?= rm
PYTEST_OPTIONS ?=
DOCTEST_OPTIONS ?=
# Variable indicating Mathics3 Modules you have available on your system, in latex2doc option format
MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang
.PHONY: \
all \
build \
check \
check-builtin-manifest \
check-consistency-and-style \
check-full \
clean \
clean-cache \
clean-cython \
develop \
develop-full \
develop-full-cython \
dist \
doc \
doctest \
doctest-data \
djangotest \
gstest \
latexdoc \
pytest \
rmChangeLog \
test \
texdoc
SANDBOX ?=
ifeq ($(OS),Windows_NT)
SANDBOX = t
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SANDBOX = t
endif
endif
#: Default target - same as "develop"
all: develop
#: build everything needed to install
build:
$(PYTHON) ./setup.py build
# Note that we need ./setup.py develop
# because pip install doesn't handle
# INSTALL_REQUIRES properly
#: Set up to run from the source tree
develop: mathics/data/op-tables.json mathics/data/operator-tables.json
$(PIP) install -e .[dev]
# See note above on ./setup.py
#: Set up to run from the source tree with full dependencies
develop-full: mathics/data/op-tables.json mathics/data/operators.json
$(PIP) install -e .[dev,full]
# See note above on ./setup.py
#: Set up to run from the source tree with full dependencies and Cython
develop-full-cython: mathics/data/op-tables.json mathics/data/operators.json
$(PIP) install -e .[dev,full,cython]
#: Make distribution: wheels, eggs, tarball
dist:
./admin-tools/make-dist.sh
#: Install Mathics
install:
$(PYTHON) setup.py install
#: Run the most extensive set of tests
check: pytest gstest doctest
#: Run the most extensive set of tests
check-for-Windows: pytest-for-windows gstest doctest
#: Build and check manifest of Builtins
check-builtin-manifest:
$(PYTHON) admin-tools/build_and_check_manifest.py
#: Run pytest consistency and style checks
check-consistency-and-style:
MATHICS_LINT=t $(PYTHON) -m pytest $(PYTEST_OPTIONS) test/consistency-and-style
check-full: check-builtin-manifest check-builtin-manifest check
#: Remove Cython-derived files
clean-cython:
find mathics -name "*.so" -type f -delete; \
find mathics -name "*.c" -type f -delete
#: Remove Python cache files
clean-cache:
find mathics -name *.py[co] -type f -delete; \
find mathics -name __pycache__ -type d -delete || true
#: Remove derived files
clean: clean-cython clean-cache
for dir in mathics/doc ; do \
($(MAKE) -C "$$dir" clean); \
done; \
rm -f factorials || true; \
rm -f mathics/data/op-tables || true; \
rm -rf build || true
#: Run pytest tests. Use environment variable "PYTEST_OPTIONS" for pytest options
pytest:
MATHICS_CHARACTER_ENCODING="ASCII" $(PYTHON) -m pytest $(PYTEST_OPTIONS) $(PYTEST_WORKERS) test
#: Run a more extensive pattern-matching test
gstest:
(cd examples/symbolic_logic/gries_schneider && $(PYTHON) test_gs.py)
#: Create doctest test data and test results that is used to build LaTeX PDF
# For LaTeX docs we assume Unicode
doctest-data: mathics/builtin/*.py mathics/doc/documentation/*.mdoc mathics/doc/documentation/images/*
MATHICS_CHARACTER_ENCODING="UTF-8" $(PYTHON) mathics/docpipeline.py --output --keep-going $(MATHICS3_MODULE_OPTION)
#: Run tests that appear in docstring in the code. Use environment variable "DOCTEST_OPTIONS" for doctest options
doctest:
MATHICS_CHARACTER_ENCODING="ASCII" SANDBOX=$(SANDBOX) $(PYTHON) mathics/docpipeline.py $(DOCTEST_OPTIONS)
#: Make Mathics PDF manual via Asymptote and LaTeX
latexdoc texdoc doc:
(cd mathics/doc/latex && $(MAKE) doc)
#: Build JSON ASCII to unicode opcode table and operator table
mathics/data/op-tables.json mathics/data/operators.json:
$(BASH) ./admin-tools/make-op-tables.sh
#: Remove ChangeLog
rmChangeLog:
$(RM) ChangeLog || true
#: Create a ChangeLog from git via git log and git2cl
ChangeLog: rmChangeLog
git log --pretty --numstat --summary | $(GIT2CL) >$@
patch -R ChangeLog < ChangeLog-spell-corrected.diff