8000 Makefile: refactor build, setup and lint rules by ariel-anieli · Pull Request #152611 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Makefile: refactor build, setup and lint rules #152611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
PYTHON = python3
PIP = $(PYTHON) -m pip
NIGHTLY_TOOL_OPTS := pull
BUILD_TARGETS := android ios local
PLATFORMS := cuda rocm
SETUP_ENVS := $(PLATFORMS:%=setup-env-%)
SETUP_ENV_PLATFORMS := $(PLATFORMS:%=setup_env_%)

all:
@mkdir -p build && cd build && cmake .. $(shell $(PYTHON) ./scripts/get_python_cmake_flags.py) && $(MAKE)

local:
@./scripts/build_local.sh

android:
@./scripts/build_android.sh

ios:
@./scripts/build_ios.sh
$(BUILD_TARGETS): %:
@./scripts/build_$*.sh

clean: # This will remove ALL build folders.
@rm -r build*/
Expand All @@ -32,26 +30,19 @@ ensure-branch-clean:
setup-env: ensure-branch-clean
$(PYTHON) tools/nightly.py $(NIGHTLY_TOOL_OPTS)

setup-env-cuda:
$(MAKE) setup-env PYTHON="$(PYTHON)" NIGHTLY_TOOL_OPTS="$(NIGHTLY_TOOL_OPTS) --cuda"

setup-env-rocm:
$(MAKE) setup-env PYTHON="$(PYTHON)" NIGHTLY_TOOL_OPTS="$(NIGHTLY_TOOL_OPTS) --rocm"
$(SETUP_ENVS): setup-env-%:
$(MAKE) setup-env PYTHON="$(PYTHON)" NIGHTLY_TOOL_OPTS="$(NIGHTLY_TOOL_OPTS) --$*"

setup_env: setup-env
setup_env_cuda: setup-env-cuda
setup_env_rocm: setup-env-rocm
$(SETUP_ENV_PLATFORMS): setup_env_%: setup-env-%

setup-lint:
$(PIP) install lintrunner
lintrunner init

setup_lint: setup-lint

lint:
lintrunner

quicklint:
lint quicklint:
lintrunner

triton:
Expand Down
0