-
Notifications
You must be signed in to change notification settings - Fork 11
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
build: don't link to optional_mutex if it doesn't exist #513
Conversation
This has no effect on any project which has This PR is probably pointless for any practical projects, because once we have |
Makefile.inc
Outdated
.if !defined(NOLIBALL) | ||
.if exists(${FINALIZED_SUBDIR_DEPTH}/liball/optional_mutex_normal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no firm feelings about what we should have here. We could spell out the full path to liball_optional_mutex_normal.a
(or even that and liball_optional_mutex_pthread.a
!).
I initially had the full path, but it looked messy, and I figured the directory would be sufficient to be confident that the project either had optional_mutex or not.
# subdirectory depth, but it's not fully set at this stage in the build | ||
# process. Instead, we jump back to the shell and print the (finalized) | ||
# value of SUBDIR_DEPTH. | ||
FINALIZED_SUBDIR_DEPTH != ${MAKE} -v SUBDIR_DEPTH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this doesn't result in an infinite loop. Running make -V SUBDIR_DEPTH
would process the Makefile and come across this line again, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short answer: because make -v SUBDIR_DEPTH
gets it from Makefile
(where it's defined in full), not Makefile.BSD
.
Medium answer: I'll update the comment.
Better answer: hmm, that's weird, make -f Makefile.BSD -v SUBDIR_DEPTH
and -V FINALIZED_SUBDIR_DEPTH
both work, instead of going into an infinite loop. I need to investigate more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addendum to that "better answer": even if we run make -f Makefile.BSD -v SUBDIR_DEPTH
on the command-line, the top-level Makefile.inc
runs make -v SUBDIR_DEPTH
(which has the fully defined value) so there's no loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, so what happens if we run make Makefiles
and there isn't a Makefile already? We get a broken one and then it gets fixed the next time we run make Makefiles
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not broken. (Although admittedly, that's a happy accident rather than by design.)
metabuild.sh
line 25:
SUBDIR_DEPTH=$(${MAKEBSD} -v SUBDIR_DEPTH)
That works fine regardless of whether there's a Makefile
or not.
metabuild.sh
line 172 puts SUBDIR_DEPTH
into the Makefile
. Until that point,
.info ${FINALIZED_SUBDIR_DEPTH}
in Makefile.inc
shows that it's empty. But after line 172 of metabuild.sh
, it's fine.
Line 179 deals with liball via copyvar_LIBALL_optional_mutex
.
I've added a comment to metabuild.sh
to note this dependency.
# Link everything to liball.a, unless they specifically ask not to use it. | ||
# If appropriate, metabuild.sh will do: | ||
# s/optional_mutex_normal/optional_mutex_pthread/g | ||
LIBALL = ${SUBDIR_DEPTH}/liball/liball.a ${SUBDIR_DEPTH}/liball/optional_mutex_normal/liball_optional_mutex_normal.a | ||
.else | ||
# There is no optional_mutex; link everything to only liball.a. | ||
LIBALL = ${SUBDIR_DEPTH}/liball/liball.a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we write this instead as as LIBALL=.../liball.a
followed by an optional LIBALL+=.../liball_optional_mutex_normal.a
?
3fea5e7
to
213639b
Compare
Updated. The comment for |
213639b
to
521eb68
Compare
I wish there was a way to do this without needing the FINALIZED_SUBDIR_DEPTH hack, but I don't see any better alternative. |
No description provided.