Skip to content
Snippets Groups Projects
Commit 5a049b728b25 authored by Matt Harbison's avatar Matt Harbison
Browse files

make: distribute `.PHONY` declaration to each target in the toplevel makefile

This makes it easier to notice when the declaration is missing.  (And yes, some
are missing.)
parent 2acf80e007ea
No related branches found
No related tags found
2 merge requests!1292Draft: 7.0rc preparation,!1260Distribute makefile `.PHONY` declarations to each target
......@@ -38,6 +38,7 @@
VENV_NAME=$(shell $(PYTHON) -c "import sys; v = sys.version_info; print(f'.venv_{sys.implementation.name}{v.major}.{v.minor}')")
PYBINDIRNAME=$(shell $(PYTHON) -c "import os; print('Scripts' if os.name == 'nt' else 'bin')")
.PHONY: help
help:
@echo 'Commonly used make targets:'
@echo ' all - build program and documentation'
......@@ -57,5 +58,6 @@
@echo 'Example for a local installation (usable in this directory):'
@echo ' make local && ./hg version'
.PHONY: all
all: build doc
......@@ -60,8 +62,9 @@
all: build doc
.PHONY: local
local:
$(PYTHON) -m venv $(VENV_NAME) --clear --upgrade-deps
$(VENV_NAME)/$(PYBINDIRNAME)/python -m \
pip install -e . -v --config-settings --global-option="$(PURE)"
env HGRCPATH= $(VENV_NAME)/$(PYBINDIRNAME)/hg version
......@@ -62,9 +65,10 @@
local:
$(PYTHON) -m venv $(VENV_NAME) --clear --upgrade-deps
$(VENV_NAME)/$(PYBINDIRNAME)/python -m \
pip install -e . -v --config-settings --global-option="$(PURE)"
env HGRCPATH= $(VENV_NAME)/$(PYBINDIRNAME)/hg version
.PHONY: build
build:
$(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
......@@ -77,6 +81,7 @@
wheel:
$(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
.PHONY: doc
doc:
$(MAKE) -C doc
......@@ -80,6 +85,7 @@
doc:
$(MAKE) -C doc
.PHONY: cleanbutpackages
cleanbutpackages:
rm -f hg.exe
rm -rf mercurial.egg-info dist
......@@ -95,6 +101,7 @@
rm -rf rust/target
rm -f mercurial/rustext.so
.PHONY: clean
clean: cleanbutpackages
rm -rf packages
......@@ -98,5 +105,6 @@
clean: cleanbutpackages
rm -rf packages
.PHONY: install
install: install-bin install-doc
......@@ -101,8 +109,9 @@
install: install-bin install-doc
.PHONY: install-bin
install-bin:
$(PYTHON) -m pip install --prefix="$(PREFIX)" --force -v --config-settings --global-option="$(PURE)"
install-chg: build-chg
make -C contrib/chg install PREFIX="$(PREFIX)"
......@@ -103,9 +112,10 @@
install-bin:
$(PYTHON) -m pip install --prefix="$(PREFIX)" --force -v --config-settings --global-option="$(PURE)"
install-chg: build-chg
make -C contrib/chg install PREFIX="$(PREFIX)"
.PHONY: install-doc
install-doc: doc
cd doc && $(MAKE) $(MFLAGS) install
......@@ -109,5 +119,6 @@
install-doc: doc
cd doc && $(MAKE) $(MFLAGS) install
.PHONY: install-home
install-home: install-home-bin install-home-doc
......@@ -112,5 +123,6 @@
install-home: install-home-bin install-home-doc
.PHONY: install-home-bin
install-home-bin:
$(PYTHON) -m pip install --user --force -v --config-settings --global-option="$(PURE)"
......@@ -114,9 +126,10 @@
install-home-bin:
$(PYTHON) -m pip install --user --force -v --config-settings --global-option="$(PURE)"
.PHONY: install-home-doc
install-home-doc: doc
cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
install-rhg: build-rhg
install -m 755 rust/target/release/rhg "$(PREFIX)"/bin/
......@@ -117,8 +130,9 @@
install-home-doc: doc
cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
install-rhg: build-rhg
install -m 755 rust/target/release/rhg "$(PREFIX)"/bin/
.PHONY: dist
dist: tests dist-notests
......@@ -123,5 +137,6 @@
dist: tests dist-notests
.PHONY: dist-notests
dist-notests: doc
TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
......@@ -125,5 +140,6 @@
dist-notests: doc
TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
.PHONY: check
check: tests
......@@ -128,5 +144,6 @@
check: tests
.PHONY: tests
tests:
# Run Rust tests if cargo is installed
if command -v $(CARGO) >/dev/null 2>&1; then \
......@@ -145,6 +162,7 @@
$(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
.PHONY: rust-tests
rust-tests:
cd $(HGROOT)/rust \
&& $(CARGO) test --quiet --all \
......@@ -154,6 +172,7 @@
cd $(HGROOT)/rust \
&& $(CARGO) clippy --all --features "$(HG_RUST_FEATURES)" -- -D warnings
.PHONY: check-code
check-code:
hg manifest | xargs python contrib/check-code.py
......@@ -157,7 +176,8 @@
check-code:
hg manifest | xargs python contrib/check-code.py
.PHONY: format-c
format-c:
clang-format --style file -i \
`hg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"'`
......@@ -160,7 +180,8 @@
format-c:
clang-format --style file -i \
`hg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"'`
.PHONY: update-pot
update-pot: i18n/hg.pot
i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
......@@ -226,7 +247,8 @@
ppa
# Forward packaging targets for convenience.
.PHONY: $(packaging_targets)
$(packaging_targets):
$(MAKE) -C contrib/packaging $(MAKEFLAGS) $@
......@@ -229,10 +251,11 @@
$(packaging_targets):
$(MAKE) -C contrib/packaging $(MAKEFLAGS) $@
.PHONY: pyoxidizer
pyoxidizer:
$(PYOXIDIZER) build --path ./rust/hgcli --release
# a temporary target to setup all we need for run-tests.py --pyoxidizer
# (should go away as the run-tests implementation improves
......@@ -233,9 +256,10 @@
pyoxidizer:
$(PYOXIDIZER) build --path ./rust/hgcli --release
# a temporary target to setup all we need for run-tests.py --pyoxidizer
# (should go away as the run-tests implementation improves
.PHONY: pyoxidizer-windows-tests
pyoxidizer-windows-tests: PYOX_DIR=build/pyoxidizer/x86_64-pc-windows-msvc/release/app
pyoxidizer-windows-tests: pyoxidizer
rm -rf $(PYOX_DIR)/templates
......@@ -252,6 +276,7 @@
# a temporary target to setup all we need for run-tests.py --pyoxidizer
# (should go away as the run-tests implementation improves
.PHONY: pyoxidizer-macos-tests
pyoxidizer-macos-tests: PYOX_DIR=build/pyoxidizer/x86_64-apple-darwin/release/app
pyoxidizer-macos-tests: pyoxidizer
rm -rf $(PYOX_DIR)/templates
......@@ -265,6 +290,7 @@
rm -rf $(PYOX_DIR)/doc
cp -a doc $(PYOX_DIR)/doc
.PHONY: pytype-docker
pytype-docker:
contrib/docker/pytype/recipe.sh
......@@ -268,9 +294,3 @@
pytype-docker:
contrib/docker/pytype/recipe.sh
.PHONY: help all local build doc cleanbutpackages clean install install-bin \
install-doc install-home install-home-bin install-home-doc \
dist dist-notests check tests rust-tests check-code format-c \
update-pot pyoxidizer pyoxidizer-windows-tests pyoxidizer-macos-tests \
$(packaging_targets) \
pytype-docker
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment