xref: /trunk/Makefile (revision 98279f37a0d6fd955cba97478f2b21deb7b87e55)
1cc42a290SJohn Bampton# Licensed to the Apache Software Foundation (ASF) under one
2cc42a290SJohn Bampton# or more contributor license agreements.  See the NOTICE file
3cc42a290SJohn Bampton# distributed with this work for additional information
4cc42a290SJohn Bampton# regarding copyright ownership.  The ASF licenses this file
5cc42a290SJohn Bampton# to you under the Apache License, Version 2.0 (the
6cc42a290SJohn Bampton# "License"); you may not use this file except in compliance
7cc42a290SJohn Bampton# with the License.  You may obtain a copy of the License at
8cc42a290SJohn Bampton#
9cc42a290SJohn Bampton#   http://www.apache.org/licenses/LICENSE-2.0
10cc42a290SJohn Bampton#
11cc42a290SJohn Bampton# Unless required by applicable law or agreed to in writing,
12cc42a290SJohn Bampton# software distributed under the License is distributed on an
13cc42a290SJohn Bampton# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14cc42a290SJohn Bampton# KIND, either express or implied.  See the License for the
15cc42a290SJohn Bampton# specific language governing permissions and limitations
16cc42a290SJohn Bampton# under the License.
17cc42a290SJohn Bampton
18cc42a290SJohn BamptonPYTHON := $(shell command -v python || command -v python3 || echo python)
19cc42a290SJohn BamptonPIP := $(PYTHON) -m pip
20cc42a290SJohn Bampton
21*98279f37SJohn Bampton.PHONY: check checkinstall checkupdate createwordlist install
22cc42a290SJohn Bampton
23cc42a290SJohn Bamptoncheck: checkinstall
24cc42a290SJohn Bampton    @echo "Running pre-commit checks..."
25cc42a290SJohn Bampton    pre-commit run --all-files
26cc42a290SJohn Bampton
27cc42a290SJohn Bamptoncheckinstall: install
28cc42a290SJohn Bampton    @echo "Installing pre-commit hooks..."
29cc42a290SJohn Bampton    pre-commit install
30cc42a290SJohn Bampton
31cc42a290SJohn Bamptoncheckupdate:
32cc42a290SJohn Bampton    @echo "Updating pre-commit hooks..."
33cc42a290SJohn Bampton    pre-commit autoupdate
34cc42a290SJohn Bampton
35*98279f37SJohn Bamptoncreatewordlist: install
36*98279f37SJohn Bampton    @echo "Regenerating the ignored words list codespell.txt"
37*98279f37SJohn Bampton    codespell --skip='./extras' | cut -f2 -d' ' | tr A-Z a-z | sort | uniq > .github/linters/codespell.txt
38*98279f37SJohn Bampton
39cc42a290SJohn Bamptoninstall:
40cc42a290SJohn Bampton    @echo "Installing dependencies..."
41cc42a290SJohn Bampton    @if [ -f requirements-dev.txt ]; then \
42cc42a290SJohn Bampton        $(PIP) install -r requirements-dev.txt; \
43cc42a290SJohn Bampton    else \
44cc42a290SJohn Bampton        echo "Error: requirements-dev.txt not found."; \
45cc42a290SJohn Bampton        exit 1; \
46cc42a290SJohn Bampton    fi
47