[PATCH 0/1] MR3797: makedep: Make *.tab.c build stable in parallel makes.
In `Makefile`, `foobar.tab.c` is made from the following rules: ``` foobar.tab.h: foobar.y bison -o foobar.tab.c -d foobar.y ---- Rule X foobar.tab.c: foobar.y foobar.tab.h bison -o $@ foobar.y --- Rule Y ``` Normally, `Rule X` is used. In parallel makes, if `foobar.tab.c` is considered while updating `foobar.tab.h` by `Rule X`, `Rule Y` is used. So, if we compare build directories, there might be a difference in that `foobar.tab.c` may or may not contain `#include "foobar.tab.h"`. To avoid the above situation, this patch introduces [Grouped Targets](https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html#ind...) which is new in GNU Make 4.3. The previous rules still apply to prevent build failures on older systems, such as Ubuntu 20.04 LTS. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3797
From: Akihiro Sagawa <sagawa.aki(a)gmail.com> In Makefile, foobar.tab.c is made from the following rules: --- foobar.tab.h: foobar.y bison -o foobar.tab.c -d foobar.y ---- Rule X foobar.tab.c: foobar.y foobar.tab.h bison -o $@ foobar.y --- Rule Y --- Normally, Rule X is used. In parallel makes, if foobar.tab.c is considered while updating foobar.tab.h by Rule X, Rule Y is used. So, if we compare build directories, there might be a difference in that foobar.tab.c may or may not contain #include "foobar.tab.h". To avoid the above situation, this patch introduces Grouped Targets which is new in GNU Make 4.3. The previous rules still apply to prevent build failures on older systems, such as Ubuntu 20.04 LTS. --- tools/makedep.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index 8495d93d8c6..2b6e36e6196 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -2685,16 +2685,26 @@ static void output_source_y( struct makefile *make, struct incl_file *source, co if (find_include_file( make, header )) { + output( "ifneq (,$(filter grouped-target,$(.FEATURES)))\n" ); + output( "%s %s.tab.c &: %s\n", + obj_dir_path( make, header ), obj_dir_path( make, obj ), source->filename ); + output( "\t%s%s -o %s.tab.c -d %s\n", + cmd_prefix( "BISON" ), bison, obj_dir_path( make, obj ), source->filename ); + output( "else\n" ); output( "%s: %s\n", obj_dir_path( make, header ), source->filename ); output( "\t%s%s -o %s.tab.c -d %s\n", cmd_prefix( "BISON" ), bison, obj_dir_path( make, obj ), source->filename ); output( "%s.tab.c: %s %s\n", obj_dir_path( make, obj ), source->filename, obj_dir_path( make, header )); + output( "\t%s%s -o $@ %s\n", cmd_prefix( "BISON" ), bison, source->filename ); + output( "endif\n" ); strarray_add( &make->clean_files, header ); } - else output( "%s.tab.c: %s\n", obj_dir_path( make, obj ), source->filename ); - - output( "\t%s%s -o $@ %s\n", cmd_prefix( "BISON" ), bison, source->filename ); + else + { + output( "%s.tab.c: %s\n", obj_dir_path( make, obj ), source->filename ); + output( "\t%s%s -o $@ %s\n", cmd_prefix( "BISON" ), bison, source->filename ); + } } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3797
Please let's not introduce GNU Make-specific syntax. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3797#note_45010
On Wed Sep 13 11:32:55 2023 +0000, Alexandre Julliard wrote:
Please let's not introduce GNU Make-specific syntax. All right. I give up this way.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3797#note_45210
This merge request was closed by Akihiro Sagawa. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3797
participants (3)
-
Akihiro Sagawa -
Akihiro Sagawa (@sgwaki) -
Alexandre Julliard (@julliard)