Skip to content

Refactor Makefile and autoloads generation#888

Merged
rswgnu merged 1 commit intomasterfrom
pr_refactor_phony_usage_in_makefile_and_other_fixes
Mar 5, 2026
Merged

Refactor Makefile and autoloads generation#888
rswgnu merged 1 commit intomasterfrom
pr_refactor_phony_usage_in_makefile_and_other_fixes

Conversation

@matsl
Copy link
Collaborator

@matsl matsl commented Mar 4, 2026

What

Refactor Makefile and autoloads generation

  • Makefile (.PHONY): Set the .PHONY declarations at each phony target.
    (HYPB_BYTE_COMP_INFO, HYPB_BYTE_COMP_FUNC): Use macros so %.elc rule
    can de defined once.
    (new-bin): Remove not needed dependency on autoloads.
    (eln): Remove not needed dependency on src and echo.
    (kotl/kotl-autoloads.el, hyperbole-autoloads.el): Use
    hload-path--make-directory-autoloads in both rules and make them
    consistent. Touch target after rebuild to ensure new timestamp.
    (bin): Run remove-elc before src target.
    (TOUCH): Add touch(1) for setting new timestamp.

Why

The phony targets were added a bit randomly so this makes it in better
order. While at it I simplified autoloads and made autoloads if
triggered always to update the timestamp.

* Makefile (.PHONY): Set the .PHONY declarations at each phony target.
    (HYPB_BYTE_COMP_INFO, HYPB_BYTE_COMP_FUNC): Use macros so %.elc rule
    can de defined once.
    (new-bin): Remove not needed dependency on autoloads.
    (eln): Remove not needed dependency on src and echo.
    (kotl/kotl-autoloads.el, hyperbole-autoloads.el): Use
    hload-path--make-directory-autoloads in both rules and make them
    consistent. Touch target after rebuild to ensure new timestamp.
    (bin): Run remove-elc before src target.
    (TOUCH): Add touch(1) for setting new timestamp.
@matsl matsl requested a review from rswgnu March 4, 2026 17:15
2026-03-04 Mats Lidell <matsl@gnu.org>

* Makefile (.PHONY): Set the .PHONY declarations at each phony target.
(HYPB_BYTE_COMP_INFO, HYPB_BYTE_COMP_FUNC): Use macros so %.elc rule
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help me understand the need for all the dot phony lines. It's a lot of noise to add to the file visually so it should have a lot of value if we add it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each phony target should be defined. In small Makefiles it is customary to do that at one place. In bigger Makefiles, such as ours, that pauses a problem since it is easy to miss a declaration. And the declarations gets added at ad hoc places as we currently have. With this change I adopt the policy to declare each phony target as phony close to where the target is defined. That makes it clear what target it is and easier to maintain.

@rswgnu
Copy link
Owner

rswgnu commented Mar 5, 2026 via email

@rswgnu rswgnu merged commit 8f54242 into master Mar 5, 2026
7 of 8 checks passed
@matsl
Copy link
Collaborator Author

matsl commented Mar 5, 2026

Just wondering if empirically you can point to any problem that you saw that was solved by this update. Yes, someone could add a file named ‘clean’ or ‘bin’ and that would interfere with a target name without a .phony, but have you seen that happen?

No, it is not based on that we have been hit by this problem.

I will approve but this is what I am trying to understand.

Thanks.

While doing the other improvements I noticed some phony targets were missing. While adding them I decided to go over the whole file to make the placement of the phony line more logical. The intent is to make the file easier to maintain when adding or removing targets.

@matsl matsl deleted the pr_refactor_phony_usage_in_makefile_and_other_fixes branch March 5, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants