xref: /PHP-8.1/Zend/Makefile.frag (revision e83cda08)
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) --no-generation-date --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	@nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
24	$(SED) -e "s/^#ifndef YYTOKENTYPE/#include \"zend.h\"\\$${nl}#ifndef YYTOKENTYPE/" < $(srcdir)/zend_language_parser.h \
25	> $(srcdir)/zend_language_parser.h.tmp && \
26	mv $(srcdir)/zend_language_parser.h.tmp $(srcdir)/zend_language_parser.h
27
28$(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c
29$(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
30	$(YACC) $(YFLAGS) -v -d $(srcdir)/zend_ini_parser.y -o $@
31
32$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
33	@(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)
34
35# Use an intermediate target to indicate that zend_vm_gen.php produces both files
36# at the same time, rather than the same recipe applying for two different targets.
37# The "grouped targets" feature, which would solve this directly, is only available
38# since GNU Make 4.3.
39$(srcdir)/zend_vm_execute.h $(srcdir)/zend_vm_opcodes.c: vm.gen.intermediate ;
40.INTERMEDIATE: vm.gen.intermediate
41vm.gen.intermediate: $(srcdir)/zend_vm_def.h $(srcdir)/zend_vm_execute.skl $(srcdir)/zend_vm_gen.php
42	@if test ! -z "$(PHP)"; then \
43		$(PHP) $(srcdir)/zend_vm_gen.php; \
44	fi;
45
46$(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
47
48Zend/zend_execute.lo: $(srcdir)/zend_vm_execute.h $(srcdir)/zend_vm_opcodes.h
49