Skip to content

build: mark most phony targets as such #5637

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

Merged
merged 1 commit into from
Feb 5, 2023

Conversation

kmk3
Copy link
Collaborator

@kmk3 kmk3 commented Feb 3, 2023

To improve clarity and to prevent unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~4% for the default build and by ~12% for the "man" target (as an
example):

$ git checkout master >/dev/null 2>&1
$ git show --pretty='%h %ai %s' -s
b55cb6a80 2023-01-31 18:56:42 -0500 testing
$ ./configure >/dev/null
$ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
7101
$ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
1239
# (with this commit applied)
$ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
6793
$ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
1085

Environment: GNU make 4.4-1 on Artix Linux.

Note: The amount lines printed is the same on non-parallel builds (that
is, without -j 4).

See commit 2465f92 ("makefiles: make all, clean and distclean PHONY",
2021-02-12) / PR #4024 for details.

Note: By "most phony targets" I mean all non-path targets except for the
testing targets, which were being changed recently (for example, the
"test-github" target) and so might still be under development.

To improve clarity and to prevent unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~4% for the default build and by ~12% for the "man" target (as an
example):

    $ git checkout master >/dev/null 2>&1
    $ git show --pretty='%h %ai %s' -s
    b55cb6a 2023-01-31 18:56:42 -0500 testing
    $ ./configure >/dev/null
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    7101
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1239
    # (with this commit applied)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    6793
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1085

Environment: GNU make 4.4-1 on Artix Linux.

Note: The amount lines printed is the same on non-parallel builds (that
is, without `-j 4`).

See commit 2465f92 ("makefiles: make all, clean and distclean PHONY",
2021-02-12) / PR netblue30#4024 for details.

Note: By "most phony targets" I mean all non-path targets except for the
testing targets, which were being changed recently (for example, the
"test-github" target) and so might still be under development.
@netblue30 netblue30 merged commit a082c70 into netblue30:master Feb 5, 2023
@netblue30
Copy link
Owner

merged!

@kmk3 kmk3 deleted the build-add-phony branch February 5, 2023 06:39
kmk3 added a commit that referenced this pull request Feb 5, 2023
kmk3 added a commit that referenced this pull request Jun 15, 2023
See commit f48886f ("build: mark most phony targets as such",
2023-02-01) / PR #5637.
kmk3 added a commit to kmk3/firejail that referenced this pull request Jun 20, 2023
To reduce unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~62% for the default build and by ~96% for the "man" target (as an
example):

    $ git checkout master >/dev/null 2>&1
    $ git show --pretty='%h %ai %s' -s
    a8f01a3 2023-06-20 05:26:23 +0000 Merge pull request netblue30#5859 from kmk3/build-remove-retpoline
    $ ./configure >/dev/null
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    6798
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1085
    # (with this commit applied)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    2535
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    42

Environment: GNU make 4.4.1-2 on Artix Linux.

Commands used to search and replace:

    $ git ls-files -z -- '*Makefile*' | xargs -0 -I '{}' sh -c \
      "printf '%s\n' \"\$(sed '1s/^/.SUFFIXES:\n/' '{}')\" >'{}'"

See also commit f48886f ("build: mark most phony targets as such",
2023-02-01) / PR netblue30#5637.
kmk3 added a commit to kmk3/firejail that referenced this pull request Jun 21, 2023
Clear `.SUFFIXES:` to reduce unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~62% for the default build and by ~96% for the "man" target (as an
example):

    $ git checkout master >/dev/null 2>&1
    $ git show --pretty='%h %ai %s' -s
    a8f01a3 2023-06-20 05:26:23 +0000 Merge pull request netblue30#5859 from kmk3/build-remove-retpoline
    $ ./configure >/dev/null
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    6798
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1085
    # (with this commit applied)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    2535
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    42

Environment: GNU make 4.4.1-2 on Artix Linux.

Commands used to search and replace:

    $ git ls-files -z -- '*Makefile*' | xargs -0 -I '{}' sh -c \
      "printf '%s\n' \"\$(sed '1s/^/.SUFFIXES:\n/' '{}')\" >'{}'"

See also commit f48886f ("build: mark most phony targets as such",
2023-02-01) / PR netblue30#5637.
@kmk3 kmk3 added the enhancement New feature request label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request
Projects
Status: Done (on RELNOTES)
Development

Successfully merging this pull request may close these issues.

2 participants