Page MenuHomeFreeBSD

Use some bmake variable modifier to simplify a bit the code
AbandonedPublic

Authored by bapt on Jun 5 2019, 9:14 AM.
Tags
None
Referenced Files
F80229587: D20521.id58260.diff
Fri, Mar 29, 11:30 AM
Unknown Object (File)
Feb 15 2024, 7:13 AM
Unknown Object (File)
Jan 30 2024, 10:13 PM
Unknown Object (File)
Jan 18 2024, 3:06 AM
Unknown Object (File)
Nov 27 2023, 8:52 PM
Unknown Object (File)
Sep 11 2023, 5:06 PM
Unknown Object (File)
Sep 11 2023, 4:55 AM
Unknown Object (File)
Aug 27 2023, 6:58 AM
Subscribers

Details

Reviewers
None
Group Reviewers
portmgr
Summary

Use some bmake variable modifier to simplify a bit the code
Not sure people will consider this as an improvement or as obfuscation :)

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 24695
Build 23462: arc lint + arc unit

Event Timeline

Herald added 1 blocking reviewer(s): portmgr. · View Herald Transcript
Herald added a subscriber: mat. · View Herald Transcript

I do feel it is really harder to read.

Also, reading make(1), I don't even understand what :? is supposed to be doing:

:?true_string:false_string
    If the variable name (not its value), when parsed as a .if
    conditional expression, evaluates to true, return as its value the
    true_string, otherwise return the false_string.

The "If the variable name (not its value)" makes me feel it kinda means ${FOO:?a:b} is equivalent to

.if FOO
a
.else
b
.endif

Which does not make much sense to me because I figure it is always true.

it is more

.if defined(FOO)
a
.else
b
.endif

Well, the :D construct is already used in a couple of places, so I'd say it is ok.

In D20521#443345, @bapt wrote:

it is more

.if defined(FOO)
a
.else
b
.endif

"it is more" is a bit too vague to be really helpful ;-)

I think that bit of the man page should be rewritten, with an exact example of what it does, because if someone like me that writes a lot of make(1) code do not understand what it does, I do feel we should not be using it...

I think that bit of the man page should be rewritten, with an exact example of what it does, because if someone like me that writes a lot of make(1) code do not understand what it does, I do feel we should not be using it...

I am sure that @sjg would be happy to help here :)