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