Skip to content
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

mirror: fix building documentation targets #153

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

viktormalik
Copy link
Contributor

Hi,

I'm trying to start building the bpftool Fedora package from this repo and ran across a strange issue which prevents me from building the documentation.

After some investigation, I found that the issue is in the callable descend command in Makefile.include (which is specific to this repo) which is currently broken due to two reasons:

  1. It is defined only for cases when the output is not suppressed by either V=1 or -s.
  2. The condition for checking the absence of -s is broken and it fails every time there is a variable definition containing the letter 's'.

The descend command is used in documentation targets and due to these errors, these targets fail to build in the following cases:

$ make V=1 doc
make: Nothing to be done for 'doc'.

$ make prefix="/usr" doc    # <- `prefix="/usr"` contains letter 's'
make: Nothing to be done for 'doc'.

This PR fixes the two above issues by (1) defining descend for all cases and (2) fixing the -s check by querying the first word of MAKEFLAGS which is the correct approach for make-4.0 and higher.

The callable `descend` command in Makefile.include is currently broken
due to two reasons:
1. It is defined only for cases when the output is not suppressed by
   either `V=1` or `-s`.
2. The condition for checking the absence of `-s` is broken and it fails
   every time there is a variable definition containing the letter 's'.

The `descend` command is used in documentation targets and due to these
errors, these targets fail to build in the following cases:

    $ make V=1 doc
    make: Nothing to be done for 'doc'.

    $ make prefix="/usr" doc    # <- `prefix="/usr"` contains letter 's'
    make: Nothing to be done for 'doc'.

This fixes the two above issues by (1) defining `descend` for all cases
and (2) fixing the `-s` check by querying the first word of `MAKEFLAGS`
which is the correct approach for make-4.0 and higher.

Signed-off-by: Viktor Malik <[email protected]>
@qmonnet
Copy link
Member

qmonnet commented Aug 26, 2024

Hi, thanks a lot for the PR! Please give me a couple days to come back from holiday and take a proper look, I don't trust my review capabilities on the phone 🙂

@viktormalik
Copy link
Contributor Author

Sure, no problem! Enjoy your holiday 🙂

Copy link
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Thanks for this!

  • It is defined only for cases when the output is not suppressed by either V=1 or -s.

Good catch, thank you!

  • The condition for checking the absence of -s is broken and it fails every time there is a variable definition containing the letter 's'.

I can't reproduce this one. What version of make do you use? My understanding from the doc is that only flags (valid make options) should be passed down with MAKEFLAGS, not random variable definitions. On my side:

$ make --version                  
GNU Make 4.3

[...] by querying the first word of MAKEFLAGS which is the correct approach for make-4.0 and higher.

Even though I can't reproduce, you've got a point, looking at how the variable works it seems to be cleaner to search for the s flag in the first word only.

So the change looks good but I'd be curious to understand why we don't get the same results for make prefix="/usr" doc 🤔

@viktormalik
Copy link
Contributor Author

  • The condition for checking the absence of -s is broken and it fails every time there is a variable definition containing the letter 's'.

I can't reproduce this one. What version of make do you use? My understanding from the doc is that only flags (valid make options) should be passed down with MAKEFLAGS, not random variable definitions. On my side:

$ make --version                  
GNU Make 4.3

For me:

$ make --version
GNU Make 4.4.1

Looking at the release notes of version 4.4, it really seems that this behavior was changed:

* WARNING: Backward-incompatibility!
  Previously only simple (one-letter) options were added to the MAKEFLAGS
  variable that was visible while parsing makefiles.  Now, all options are
  available in MAKEFLAGS.  If you want to check MAKEFLAGS for a one-letter
  option, expanding "$(firstword -$(MAKEFLAGS))" is a reliable way to return
  the set of one-letter options which can be examined via findstring, etc.

so I guess that explains it 🙂

@qmonnet
Copy link
Member

qmonnet commented Sep 2, 2024

Oh that says it all then, thanks a lot for looking! Perfect, I'll merge now 👍

@qmonnet qmonnet merged commit b3d4318 into libbpf:main Sep 2, 2024
6 checks passed
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