xref: /aosp_15_r20/external/pytorch/Makefile (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# This makefile does nothing but delegating the actual building to cmake.
2PYTHON = python3
3PIP = $(PYTHON) -m pip
4NIGHTLY_TOOL_OPTS := pull
5
6all:
7	@mkdir -p build && cd build && cmake .. $(shell $(PYTHON) ./scripts/get_python_cmake_flags.py) && $(MAKE)
8
9local:
10	@./scripts/build_local.sh
11
12android:
13	@./scripts/build_android.sh
14
15ios:
16	@./scripts/build_ios.sh
17
18clean: # This will remove ALL build folders.
19	@rm -r build*/
20
21linecount:
22	@cloc --read-lang-def=caffe.cloc caffe2 || \
23		echo "Cloc is not available on the machine. You can install cloc with " && \
24		echo "    sudo apt-get install cloc"
25
26ensure-branch-clean:
27	@if [ -n "$(shell git status --porcelain)" ]; then \
28		echo "Please commit or stash all changes before running this script"; \
29		exit 1; \
30	fi
31
32setup-env: ensure-branch-clean
33	$(PYTHON) tools/nightly.py $(NIGHTLY_TOOL_OPTS)
34
35setup-env-cuda:
36	$(MAKE) setup-env PYTHON="$(PYTHON)" NIGHTLY_TOOL_OPTS="$(NIGHTLY_TOOL_OPTS) --cuda"
37
38setup_env: setup-env
39setup_env_cuda: setup-env-cuda
40
41setup-lint:
42	$(PIP) install lintrunner
43	lintrunner init
44
45setup_lint: setup-lint
46
47lint:
48	lintrunner
49
50quicklint:
51	lintrunner
52
53triton:
54	$(PIP) uninstall -y triton
55	@./scripts/install_triton_wheel.sh
56