GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-104490: Consistently define phony make targets by indygreg · Pull Request #104491 · python/cpython

Conversation

@indygreg

@indygreg indygreg commented May 15, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

By convention make targets that don't refer to a file have a dependency on the fake .PHONY target/file. This ensures that these targets are always evaluated because there is no rule to create a .PHONY file and that will force make to think the rule is out of date and needs to be rebuilt.

This commit consistently associates our virtual targets with .PHONY by declaring the .PHONY dependency immediately above the make rule.

Before, some .PHONY associations were inline (as this patch establishes). Others were defined in common blocks. Even others were defined incorrectly, actually assigning a .PHONY variable instead of operating on the make target!

Before, not all virtual targets had .PHONY associations. And there were some defined .PHONY associations in common blocks whose targets had long been deleted.

Hopefully the unified convention will prevent things from getting out of sync going forward.

Why do this?

First, consistency is good. Now people don't have to know to look for a separate block of .PHONY attribution. Hopefully this prevents missing .PHONY annotations going forward.

Second, there are some cases where virtual make targets are virtual / phony when they shouldn't be. These are creating race conditions and avoidable rebuilds across multiple make invocations. e.g. a make all

  • make install invocation will perform PGO+BOLT if BOLT is enabled because profile-opt and bolt-opt are phony and always invoked. I plan follow-ups to this cleanup to fix some bugs I've run into.
  • Issue: Handle virtual / phony make targets consistently and more robustly #104490

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

arhadthedev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-bot bedevere-bot added the awaiting review label May 15, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 15, 2023
Handle virtual / phony make targets consistently and more robustly #104490
Closed
@indygreg
indygreg force-pushed the build-consistent-phony branch from a52de5c to 7c7a306 Compare May 15, 2023 02:03
arhadthedev
arhadthedev reviewed May 15, 2023
View reviewed changes
Comment thread Misc/NEWS.d/next/Build/2023-05-14-19-00-19.gh-issue-104490.1tA4AF.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@indygreg
pythongh-104490: consistently define phony make targets
aafd614
By convention make targets that don't refer to a file have a dependency
on the fake `.PHONY` target/file. This ensures that these targets are
always evaluated because there is no rule to create a `.PHONY` file
and that will force make to think the rule is out of date and needs
to be rebuilt.

This commit consistently associates our virtual targets with `.PHONY`
by declaring the `.PHONY` dependency immediately above the make rule.

Before, some `.PHONY` associations were inline (as this patch
establishes). Others were defined in common blocks. Even others were
defined incorrectly, actually assigning a `.PHONY` variable instead
of operating on the make target!

Before, not all virtual targets had `.PHONY` associations. And there
were some defined `.PHONY` associations in common blocks whose targets
had long been deleted.

Hopefully the unified convention will prevent things from getting out
of sync going forward.

Why do this?

First, consistency is good. Now people don't have to know to look for
a separate block of `.PHONY` attribution. Hopefully this prevents
missing `.PHONY` annotations going forward.

Second, there are some cases where virtual make targets are virtual
/ phony when they shouldn't be. These are creating race conditions and
avoidable rebuilds across multiple `make` invocations. e.g. a `make all`
+ `make install` invocation will perform PGO+BOLT if BOLT is enabled
because `profile-opt` and `bolt-opt` are phony and always invoked. I
plan follow-ups to this cleanup to fix some bugs I've run into.
@indygreg
indygreg force-pushed the build-consistent-phony branch from 7c7a306 to aafd614 Compare May 15, 2023 02:08
@indygreg indygreg mentioned this pull request May 15, 2023
[WIP] Various build system improvements #101093
Closed
@erlend-aasland
Whitespce nit
d6e51fc
@erlend-aasland erlend-aasland changed the title gh-104490: consistently define phony make targets gh-104490: Consistently define phony make targets May 15, 2023
@erlend-aasland erlend-aasland linked an issue May 15, 2023 that may be closed by this pull request
Handle virtual / phony make targets consistently and more robustly #104490
Closed
@erlend-aasland
erlend-aasland enabled auto-merge (squash) May 15, 2023 08:24
@erlend-aasland

erlend-aasland commented May 15, 2023

Copy link
Copy Markdown
Contributor

This is a very nice improvement; thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
erlend-aasland merged commit a6bcc8f into python:main May 15, 2023
@bedevere-bot bedevere-bot removed the awaiting review label May 15, 2023
carljm added a commit to carljm/cpython that referenced this pull request May 15, 2023
@carljm
Merge branch 'main' into supermon
343867a
* main: (29 commits)
  pythongh-101819: Fix _io clinic input for unused base class method stubs (python#104418)
  pythongh-101819: Isolate `_io` (python#101948)
  Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (python#104501)
  pythongh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (python#104495)
  pythongh-104050: Run mypy on `clinic.py` in CI (python#104421)
  pythongh-104490: Consistently define phony make targets (python#104491)
  pythongh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (python#104473)
  pythongh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (python#104488)
  pythongh-101282: move BOLT config after PGO (pythongh-104493)
  pythongh-104469 Convert _testcapi/float.c to use AC (pythongh-104470)
  pythongh-104456: Fix ref leak in _ctypes.COMError (python#104457)
  pythongh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (python#104474)
  pythongh-104337: Clarify random.gammavariate doc entry  (python#104410)
  Minor improvements to typing docs (python#104465)
  pythongh-87092: avoid gcc warning on uninitialized struct field in assemble.c (python#104460)
  pythonGH-71383: IDLE - Document testing subsets of modules (python#104463)
  pythongh-104454: Fix refleak in AttributeError_reduce (python#104455)
  pythongh-75710: IDLE - add docstrings and comments to editor module (python#104446)
  pythongh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (python#104424)
  Add a mention of PYTHONBREAKPOINT to breakpoint() docs (python#104430)
  ...
carljm added a commit to carljm/cpython that referenced this pull request May 15, 2023
@carljm
Merge branch 'main' into cached_property_docs
452d9f5
* main: (204 commits)
  pythongh-101819: Fix _io clinic input for unused base class method stubs (python#104418)
  pythongh-101819: Isolate `_io` (python#101948)
  Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (python#104501)
  pythongh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (python#104495)
  pythongh-104050: Run mypy on `clinic.py` in CI (python#104421)
  pythongh-104490: Consistently define phony make targets (python#104491)
  pythongh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (python#104473)
  pythongh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (python#104488)
  pythongh-101282: move BOLT config after PGO (pythongh-104493)
  pythongh-104469 Convert _testcapi/float.c to use AC (pythongh-104470)
  pythongh-104456: Fix ref leak in _ctypes.COMError (python#104457)
  pythongh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (python#104474)
  pythongh-104337: Clarify random.gammavariate doc entry  (python#104410)
  Minor improvements to typing docs (python#104465)
  pythongh-87092: avoid gcc warning on uninitialized struct field in assemble.c (python#104460)
  pythonGH-71383: IDLE - Document testing subsets of modules (python#104463)
  pythongh-104454: Fix refleak in AttributeError_reduce (python#104455)
  pythongh-75710: IDLE - add docstrings and comments to editor module (python#104446)
  pythongh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (python#104424)
  Add a mention of PYTHONBREAKPOINT to breakpoint() docs (python#104430)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@arhadthedev arhadthedev arhadthedev left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Handle virtual / phony make targets consistently and more robustly

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@indygreg @erlend-aasland @arhadthedev @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.