Skip to content

Commit

Permalink
Fix race condition in automatic zend_vm_gen.php invocation
Browse files Browse the repository at this point in the history
As previously written, this was treated as two independent targets
having the same recipe. GNU Make 4.3 has a new "grouped targets"
feature that allows specifying that these are actually both
outputs of a single recipe, but that's very recent.

Work around this by using an intermediate target.
  • Loading branch information
nikic committed Jul 16, 2021
1 parent be5fd30 commit 3025126
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Zend/Makefile.frag
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)

$(srcdir)/zend_vm_execute.h $(srcdir)/zend_vm_opcodes.c: $(srcdir)/zend_vm_def.h $(srcdir)/zend_vm_execute.skl $(srcdir)/zend_vm_gen.php
# Use an intermediate target to indicate that zend_vm_gen.php produces both files
# at the same time, rather than the same recipe applying for two different targets.
# The "grouped targets" feature, which would solve this directly, is only available
# since GNU Make 4.3.

This comment has been minimized.

Copy link
@kocsismate

kocsismate Jul 16, 2021

Member

Just an FYI that macs are bundled with an archaic version of make (~ 3.8).

This comment has been minimized.

Copy link
@cmb69

cmb69 Mar 19, 2022

Contributor

@cronlabspl, please cool down. No need to call something a lie, even if it might be wrong.

$(srcdir)/zend_vm_execute.h $(srcdir)/zend_vm_opcodes.c: vm.gen.intermediate ;
.INTERMEDIATE: vm.gen.intermediate
vm.gen.intermediate: $(srcdir)/zend_vm_def.h $(srcdir)/zend_vm_execute.skl $(srcdir)/zend_vm_gen.php
@if test ! -z "$(PHP)"; then \
$(PHP) $(srcdir)/zend_vm_gen.php; \
fi;
Expand Down

0 comments on commit 3025126

Please sign in to comment.