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

build: fix config.gypi target #9053

Closed
wants to merge 3 commits into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Oct 12, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

build

Description of change

The config.gypi target has a recipe that uses the control function error
to report if the config.gypi file is missing or if it is stale (the
configure file was updated which is a prerequisite of this rule).

GNU make has two phases, immediate and deferred. During the first phase
it will expand any variables or functions as the makefile is parsed.
The recipe in this case is a shell if statement, which is a deferred
construct. But the control function $(error) is an immediate construct
which will cause the makefile processing to stop during the first phase
of the Make process.

If I understand this correctly the only possible outcome of this rule is
the "Stale config.gypi, please re-run ./configure" message which will
be done in the first phase and then exit. The shell condition will not
be considered. So it will never report that the config.gypi is missing.

I've updated the recipe to use the echo command and an exit status. The
downside of this is that the error message is not as nice.

Current error message:
Makefile:81: *** Stale config.gypi, please re-run ./configure. Stop.

"New error message":
$ make config.gypi
Stale config.gypi, please re-run ./configure
make: *** [config.gypi] Error 1

To verify the stale config.gypi:
$ touch configure
$ make

To verfify that config.gypi is missing:
$ rm config.gypi
$ make

The config.gypi target has a recipe that uses the control function error
to report if the config.gypi file is missing or if it is stale (the
configure file was updated which is a prerequisite of this rule).

GNU make has two phases, immediate and deferred. During the first phase
 it will expand any variables or functions as the makefile is parsed.
The recipe in this case is a shell if statement, which is a deferred
construct. But the control function $(error) is an immediate construct
which will cause the makefile processing to stop during the first phase
of the Make process.

If I understand this correctly the only possible outcome of this rule is
the "Stale config.gypi, please re-run ./configure"  message which will
be done in the first phase and then exit. The shell condition will not
be considered. So it will never report that the config.gypi is missing.

I've updated the recipe to use the echo command and an exit status. The
downside of this is that the error message is not as nice.

Current error message:
Makefile:81: *** Stale config.gypi, please re-run ./configure.  Stop.

"New error message":
$ make config.gypi
Stale config.gypi, please re-run ./configure
make: *** [config.gypi] Error 1

To verify the stale config.gypi:
$ touch configure
$ make

To verfify that config.gypi is missing:
$ rm config.gypi
$ make
@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Oct 12, 2016
@danbev
Copy link
Contributor Author

danbev commented Oct 12, 2016

@bnoordhuis
Copy link
Member

You could simply change the message to "Missing or stale config.gypi, please run configure". :-)

@danbev
Copy link
Contributor Author

danbev commented Oct 12, 2016

You could simply change the message to "Missing or stale config.gypi, please run configure". :-)

I'd like that :) Would that be acceptable?

@bnoordhuis
Copy link
Member

It's acceptable to me - but I may be biased. :-)

@danbev
Copy link
Contributor Author

danbev commented Oct 12, 2016

@bnoordhuis :) I'm adding that as an option and let other decide what they prefer. Thanks!

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

LGTM with a suggestion.

else
$(error No $@, please run ./configure first)
fi
$(error Missing or stale $@, please re-run ./$<)
Copy link
Member

Choose a reason for hiding this comment

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

Tiniest of nits: maybe s/re-run/run/ - in the 'missing' case, you probably haven't run configure before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks

danbev added a commit to danbev/node that referenced this pull request Oct 14, 2016
The config.gypi target has a recipe that uses the control function error
to report if the config.gypi file is missing or if it is stale (the
configure file was updated which is a prerequisite of this rule).

GNU make has two phases, immediate and deferred. During the first phase
 it will expand any variables or functions as the makefile is parsed.
The recipe in this case is a shell if statement, which is a deferred
construct. But the control function $(error) is an immediate construct
which will cause the makefile processing to stop during the first phase
of the Make process.

If I understand this correctly the only possible outcome of this rule is
the "Stale config.gypi, please re-run ./configure"  message which will
be done in the first phase and then exit. The shell condition will not
be considered. So it will never report that the config.gypi is missing.

bnoordhuis suggested that we simply change this into a single error
message:
"Missing or stale config.gypi, please run configure"

PR-URL: nodejs#9053
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
@danbev
Copy link
Contributor Author

danbev commented Oct 14, 2016

Landed in: 0ed6338

@danbev danbev closed this Oct 14, 2016
@danbev danbev deleted the makefile-config.gypi-fix branch October 14, 2016 05:44
jasnell pushed a commit that referenced this pull request Oct 14, 2016
The config.gypi target has a recipe that uses the control function error
to report if the config.gypi file is missing or if it is stale (the
configure file was updated which is a prerequisite of this rule).

GNU make has two phases, immediate and deferred. During the first phase
 it will expand any variables or functions as the makefile is parsed.
The recipe in this case is a shell if statement, which is a deferred
construct. But the control function $(error) is an immediate construct
which will cause the makefile processing to stop during the first phase
of the Make process.

If I understand this correctly the only possible outcome of this rule is
the "Stale config.gypi, please re-run ./configure"  message which will
be done in the first phase and then exit. The shell condition will not
be considered. So it will never report that the config.gypi is missing.

bnoordhuis suggested that we simply change this into a single error
message:
"Missing or stale config.gypi, please run configure"

PR-URL: #9053
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 11, 2016
The config.gypi target has a recipe that uses the control function error
to report if the config.gypi file is missing or if it is stale (the
configure file was updated which is a prerequisite of this rule).

GNU make has two phases, immediate and deferred. During the first phase
 it will expand any variables or functions as the makefile is parsed.
The recipe in this case is a shell if statement, which is a deferred
construct. But the control function $(error) is an immediate construct
which will cause the makefile processing to stop during the first phase
of the Make process.

If I understand this correctly the only possible outcome of this rule is
the "Stale config.gypi, please re-run ./configure"  message which will
be done in the first phase and then exit. The shell condition will not
be considered. So it will never report that the config.gypi is missing.

bnoordhuis suggested that we simply change this into a single error
message:
"Missing or stale config.gypi, please run configure"

PR-URL: #9053
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 11, 2016
The config.gypi target has a recipe that uses the control function error
to report if the config.gypi file is missing or if it is stale (the
configure file was updated which is a prerequisite of this rule).

GNU make has two phases, immediate and deferred. During the first phase
 it will expand any variables or functions as the makefile is parsed.
The recipe in this case is a shell if statement, which is a deferred
construct. But the control function $(error) is an immediate construct
which will cause the makefile processing to stop during the first phase
of the Make process.

If I understand this correctly the only possible outcome of this rule is
the "Stale config.gypi, please re-run ./configure"  message which will
be done in the first phase and then exit. The shell condition will not
be considered. So it will never report that the config.gypi is missing.

bnoordhuis suggested that we simply change this into a single error
message:
"Missing or stale config.gypi, please run configure"

PR-URL: #9053
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
This was referenced Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants