Page MenuHomeFreeBSD

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

Authored by bapt on Jun 5 2019, 9:14 AM.

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 Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 24695
Build 23462: arc lint + arc unit

Event Timeline

bapt created this revision.Jun 5 2019, 9:14 AM
Herald added 1 blocking reviewer(s): portmgr. · View Herald TranscriptJun 5 2019, 9:14 AM
Herald added 1 blocking reviewer(s): portmgr. · View Herald Transcript
Herald added a subscriber: mat. · View Herald Transcript
bapt updated this revision to Diff 58260.Jun 5 2019, 10:10 AM

Small fixed

mat added a comment.Jun 5 2019, 10:41 AM

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.

bapt added a comment.Jun 5 2019, 10:50 AM

it is more

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

mat added a comment.Jun 5 2019, 10:55 AM

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

mat added a comment.Jun 5 2019, 11:01 AM
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...

bapt added a subscriber: sjg.Jun 5 2019, 11:02 AM

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 :)

bapt abandoned this revision.Jun 13 2019, 12:55 PM