-
Notifications
You must be signed in to change notification settings - Fork 275
[Maint] add Makefile to replace format.sh
#1083
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
17ece1e
[Maint] add `Makefile` to replace `format.sh`
XuehaiPan 9ace086
[Maint] update docs target
XuehaiPan e166548
[Docs] update contribution guideline
XuehaiPan 1db7c65
[Maint] update excludes
XuehaiPan 5dc12ab
Merge remote-tracking branch 'upstream/main' into add-makefile
XuehaiPan 2c92b9a
[Minor] ensure pinned lint deps
XuehaiPan 3ed0c40
[Maint] add `sdist` target
XuehaiPan fd1b246
[Minor] update `clean` target
XuehaiPan d810d57
Merge branch 'main' into add-makefile
XuehaiPan ab4ecec
Merge remote-tracking branch 'upstream/main' into add-makefile
XuehaiPan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,19 @@ | ||
| include VERSION | ||
| include CMakeLists.txt | ||
| include requirements.txt | ||
| include requirements-test.txt | ||
| include requirements-dev.txt | ||
| include LICENSE | ||
| include THIRDPARTYNOTICES.txt | ||
|
|
||
| include version_provider.py | ||
| include Makefile | ||
| include requirements*.txt | ||
| include tilelang/jit/adapter/cython/cython_wrapper.pyx | ||
| recursive-include src * | ||
| recursive-include 3rdparty * | ||
| recursive-exclude 3rdparty/clang* * | ||
| recursive-exclude 3rdparty/llvm* * | ||
|
|
||
| include CMakeLists.txt | ||
| graft src | ||
| graft cmake | ||
| graft 3rdparty | ||
| prune 3rdparty/clang* | ||
| prune 3rdparty/llvm* | ||
|
|
||
| # Prune compiled files | ||
| prune */__pycache__ | ||
| global-exclude *~ *.py[cod] *.so *.a *.dylib *.pxd *.dll *.lib *.o *.obj |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,180 @@ | ||
| PROJECT_NAME = tilelang | ||
| SHELL = /bin/bash | ||
| .SHELLFLAGS := -eu -o pipefail -c | ||
| PROJECT_PATH = $(PROJECT_NAME) | ||
| SOURCE_FOLDERS = $(PROJECT_PATH) benchmark docs examples maint src testing | ||
| PYTHON_FILES = $(shell find $(SOURCE_FOLDERS) -type f -iname "*.py" -o -iname "*.pyi") version_provider.py | ||
| CXX_FILES = $(shell find $(SOURCE_FOLDERS) -type f -iname "*.[ch]pp" -o -iname "*.cc" -o -iname "*.c" -o -iname "*.h") | ||
| CUDA_FILES = $(shell find $(SOURCE_FOLDERS) -type f -iname "*.cu" -o -iname "*.cuh") | ||
| COMMIT_HASH = $(shell git rev-parse HEAD) | ||
| COMMIT_HASH_SHORT = $(shell git rev-parse --short=7 HEAD) | ||
| PYTHON ?= $(shell command -v python3 || command -v python) | ||
| PYTEST ?= $(PYTHON) -X dev -m pytest -Walways | ||
| PYTESTOPTS ?= | ||
| CMAKE_CONFIGURE_OPTS ?= | ||
|
|
||
| .PHONY: default | ||
| default: install | ||
|
|
||
| .PHONY: install | ||
| install: | ||
| $(PYTHON) -m pip install -v . | ||
|
|
||
| .PHONY: install-editable install-e | ||
| install-editable install-e: | ||
| $(PYTHON) -m pip install --upgrade pip setuptools wheel | ||
| $(PYTHON) -m pip install --upgrade --requirement requirements-dev.txt | ||
| $(PYTHON) -m pip install -v --no-build-isolation --editable . | ||
|
|
||
| .PHONY: uninstall | ||
| uninstall: | ||
| $(PYTHON) -m pip uninstall -y $(PROJECT_NAME) | ||
|
|
||
| .PHONY: sdist | ||
| sdist: | ||
| $(PYTHON) -m pip install --upgrade pip setuptools build | ||
| $(PYTHON) -m build --sdist --outdir=dist | ||
|
|
||
| # Tools Installation | ||
|
|
||
| check_pip_install = $(PYTHON) -m pip show $(1) &>/dev/null || (cd && $(PYTHON) -m pip install --upgrade $(1)) | ||
|
|
||
| .PHONY: pre-commit-install | ||
| pre-commit-install: | ||
| $(call check_pip_install,pre-commit) | ||
| $(PYTHON) -m pre_commit install --install-hooks | ||
|
|
||
| .PHONY: python-format-install | ||
| python-format-install: | ||
| $(call check_pip_install,yapf) | ||
|
|
||
| .PHONY: ruff-install | ||
| ruff-install: | ||
| $(call check_pip_install,ruff) | ||
|
|
||
| .PHONY: lint-install | ||
| lint-install: | ||
| $(PYTHON) -m pip install --requirement requirements-lint.txt | ||
|
|
||
| .PHONY: docs-install | ||
| docs-install: | ||
| $(PYTHON) -m pip install --requirement docs/requirements.txt | ||
|
|
||
| .PHONY: pytest-install | ||
| pytest-install: | ||
| $(call check_pip_install,pytest) | ||
| $(call check_pip_install,pytest-xdist) | ||
|
|
||
| .PHONY: test-install | ||
| test-install: pytest-install | ||
| $(PYTHON) -m pip install --requirement requirements-test.txt | ||
|
|
||
| .PHONY: cmake-install | ||
| cmake-install: | ||
| command -v cmake || $(call check_pip_install,cmake) | ||
|
|
||
| .PHONY: clang-format-install | ||
| clang-format-install: | ||
| $(call check_pip_install,clang-format) | ||
|
|
||
| .PHONY: clang-tidy-install | ||
| clang-tidy-install: | ||
| $(call check_pip_install,clang-tidy) | ||
|
|
||
| # Tests | ||
|
|
||
| .PHONY: pytest test | ||
| pytest test: pytest-install | ||
| $(PYTEST) --version | ||
| cd testing && $(PYTHON) -X dev -Walways -Werror -c 'import $(PROJECT_NAME)' && \ | ||
| $(PYTEST) --verbose --color=yes --durations=10 --showlocals \ | ||
| $(PYTESTOPTS) . | ||
|
|
||
| # Python Linters | ||
|
|
||
| .PHONY: pre-commit | ||
| pre-commit: pre-commit-install | ||
| $(PYTHON) -m pre_commit --version | ||
| $(PYTHON) -m pre_commit run --all-files | ||
|
|
||
| .PHONY: python-format pyfmt yapf | ||
| python-format pyfmt yapf: python-format-install | ||
| $(PYTHON) -m yapf --version | ||
| @$(PYTHON) -m yapf --quiet docs/conf.py &>/dev/null || true | ||
| $(PYTHON) -m yapf --in-place --parallel $(PYTHON_FILES) | ||
|
|
||
| .PHONY: ruff | ||
| ruff: ruff-install | ||
| $(PYTHON) -m ruff --version | ||
| $(PYTHON) -m ruff check . | ||
|
|
||
| .PHONY: ruff-fix | ||
| ruff-fix: ruff-install | ||
| $(PYTHON) -m ruff --version | ||
| $(PYTHON) -m ruff check --fix --exit-non-zero-on-fix . | ||
|
|
||
| # C++ Linters | ||
|
|
||
| .PHONY: cmake-configure | ||
| cmake-configure: cmake-install | ||
| cmake --version | ||
| cmake -S . -B cmake-build \ | ||
| --fresh $(CMAKE_CONFIGURE_OPTS) \ | ||
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | ||
|
|
||
| .PHONY: cmake cmake-build | ||
| cmake cmake-build: cmake-configure | ||
| cmake --build cmake-build --parallel | ||
|
|
||
| .PHONY: clang-format | ||
| clang-format: clang-format-install | ||
| clang-format --version | ||
| clang-format --style=file --Werror -i $(CXX_FILES) | ||
|
|
||
| .PHONY: clang-tidy | ||
| clang-tidy: clang-tidy-install cmake-configure | ||
| clang-tidy --version | ||
| if [[ -x "$(shell command -v run-clang-tidy)" ]]; then \ | ||
| run-clang-tidy -clang-tidy-binary="$(shell command -v clang-tidy)" \ | ||
| -fix -p="cmake-build" $(CXX_FILES); \ | ||
| else \ | ||
| clang-tidy --fix -p="cmake-build" $(CXX_FILES); \ | ||
| fi | ||
|
|
||
| # Documentation | ||
|
|
||
| .PHONY: docs | ||
| docs: docs-install | ||
| $(call check_pip_install,sphinx) | ||
| $(call check_pip_install,sphinx-autobuild) | ||
| $(PYTHON) -m sphinx_autobuild --watch $(PROJECT_PATH) --open-browser docs docs/_build | ||
|
|
||
| .PHONY: clean-docs | ||
| clean-docs: | ||
| $(MAKE) -C docs clean || true | ||
|
|
||
| # Utility Functions | ||
|
|
||
| .PHONY: format | ||
| format: lint-install pre-commit python-format ruff clang-format | ||
|
|
||
| .PHONY: lint | ||
| lint: format clang-tidy | ||
XuehaiPan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| .PHONY: clean-python | ||
| clean-python: | ||
| find . -type f -name '*.py[co]' -delete | ||
| find . -depth -type d -name "__pycache__" -exec rm -r "{}" + | ||
| find . -depth -type d -name ".ruff_cache" -exec rm -r "{}" + | ||
| find . -depth -type d -name ".pytest_cache" -exec rm -r "{}" + | ||
|
|
||
| .PHONY: clean-build | ||
| clean-build: | ||
| rm -rf build/ dist/ cmake-build/ cmake-build-*/ | ||
| find $(PROJECT_PATH) -type f -name '*.so' -delete | ||
| find $(PROJECT_PATH) -type f -name '*.dylib' -delete | ||
| find $(PROJECT_PATH) -type d -name '*.dylib.dSYM' -prune -exec rm -rf '{}' + | ||
| rm -rf *.egg-info .eggs | ||
|
|
||
| .PHONY: clean | ||
| clean: clean-python clean-build clean-docs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.