xref: /PHP-8.4/Zend/Makefile.frag (revision f3feef8b)
1#
2# Zend
3#
4
5$(builddir)/zend_language_scanner.lo: $(srcdir)/zend_language_parser.h
6$(builddir)/zend_ini_scanner.lo: $(srcdir)/zend_ini_parser.h
7
8$(srcdir)/zend_language_scanner.c $(srcdir)/zend_language_scanner_defs.h: $(srcdir)/zend_language_scanner.l
9	@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
10
11$(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c
12$(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
13# Tweak zendparse to be exported through ZEND_API. This has to be revisited once
14# bison supports foreign skeletons and that bison version is used. Read
15# https://git.savannah.gnu.org/cgit/bison.git/tree/data/README.md for more.
16	@$(YACC) $(YFLAGS) -v -d $(srcdir)/zend_language_parser.y -o $@
17	@$(SED) -e 's,^int zendparse\(.*\),ZEND_API int zendparse\1,g' < $@ \
18	> $@.tmp && \
19	mv $@.tmp $@
20	@$(SED) -e 's,^int zendparse\(.*\),ZEND_API int zendparse\1,g' < $(srcdir)/zend_language_parser.h \
21	> $(srcdir)/zend_language_parser.h.tmp && \
22	mv $(srcdir)/zend_language_parser.h.tmp $(srcdir)/zend_language_parser.h
23
24$(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c
25$(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
26	@$(YACC) $(YFLAGS) -v -d $(srcdir)/zend_ini_parser.y -o $@
27
28$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
29	@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
30
31# Use an intermediate target to indicate that zend_vm_gen.php produces both files
32# at the same time, rather than the same recipe applying for two different targets.
33# The "grouped targets" feature, which would solve this directly, is only available
34# since GNU Make 4.3.
35$(srcdir)/zend_vm_execute.h $(srcdir)/zend_vm_opcodes.c: vm.gen.intermediate ;
36.INTERMEDIATE: vm.gen.intermediate
37vm.gen.intermediate: $(srcdir)/zend_vm_def.h $(srcdir)/zend_vm_execute.skl $(srcdir)/zend_vm_gen.php
38	@if test ! -z "$(PHP)"; then \
39		$(PHP) $(srcdir)/zend_vm_gen.php; \
40	fi;
41
42$(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
43
44Zend/zend_execute.lo: $(srcdir)/zend_vm_execute.h $(srcdir)/zend_vm_opcodes.h
45