Skip to content

Conversation

@shankerwangmiao
Copy link

No description provided.

in order to prevent the command from continuing to execute when one of
the commands fails.
When one command generates multiple outputs, using a naive one-to-two
depency would introduce race condition when doing parallel compilation.
For example, when the rules are written in this pattern:

foo.c foo.h: foo.y
	command foo.y generating foo.c and foo.h
some-target: foo.c
	some command reading foo.c
some-other-target: foo.h
	some command reading foo.h

and the targets are built in parallel, `command foo.y` may be executed
twice because make thinks `command foo.y` can be used to generate foo.c
and can also be used to generate foo.h. What's worse, one of the
commands reading foo.c or foo.h may read an incomplete input during the
command generating the other one is running.

This pattern happens on the rules of def_data.in and gram.y. This
commit fixes this by using a stamp file to witness the execution of the
`command foo.y`, following the advice in the automake manual [1].

[1]: https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html
The targets for generating getdate.c and gram.c/h run yacc in the same
directory and post-process the generated y.tab.c/h by yacc into the
final target. They both generate temporary y.tab.c/h files with the same
name and they may overwrite each other if built in parallel. This commit
fixes this by let yacc run in individual temporary directories to
prevent them from overwriting each other.
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.

1 participant