X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=Makefile.frag;h=c31b9d971f092e2f711cb5bd35d65e26c4d8d9a2;hp=1c42778fe48d63213d6d0e85a8effb14cda92227;hb=1cc295bbc317d62e6ba254a0dcfb00c5a7a5baaa;hpb=d60f4bbdd315ddf42dbafeff0fd3d87d2e7a51f7 diff --git a/Makefile.frag b/Makefile.frag index 1c42778..c31b9d9 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -3,11 +3,15 @@ PHP_PSI_HEADERS := $(addprefix $(PHP_PSI_BUILDDIR)/,$(PHP_PSI_HEADERS)) PHP_PSI_SOURCES := $(addprefix $(PHP_PSI_SRCDIR)/,$(PHP_PSI_SOURCES)) +$(PHP_PSI_BUILDDIR)/types: + mkdir -p $@ +$(PHP_PSI_BUILDDIR)/types/%.h: $(PHP_PSI_SRCDIR)/src/types/%.h | $(PHP_PSI_BUILDDIR)/types + @cat >$@ <$< $(PHP_PSI_BUILDDIR)/%.h: $(PHP_PSI_SRCDIR)/src/%.h @cat >$@ <$< -all: psi-build-headers -clean: psi-clean-headers +install-headers: psi-build-headers +clean: psi-clean .PHONY: psi-build-headers psi-build-headers: $(PHP_PSI_HEADERS) @@ -16,23 +20,66 @@ psi-build-headers: $(PHP_PSI_HEADERS) psi-clean-headers: -rm -f $(PHP_PSI_HEADERS) +.PHONY: psi-clean-sources +psi-clean-sources: + -rm -f $(PHP_PSI_BUILDDIR)/src/*o + -rm -f $(PHP_PSI_BUILDDIR)/src/types/*o + -rm -f $(PHP_PSI_SRCDIR)/src/parser.c $(PHP_PSI_SRCDIR)/src/parser_proc.c $(PHP_PSI_SRCDIR)/src/parser_proc.y + +.PHONY: psi-clean-aux +psi-clean-aux: + -rm -f lempar.c lemon.c lemon + +.PHONY: psi-clean +psi-clean: psi-clean-headers psi-clean-sources psi-clean-aux + + lempar.c: - curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lempar.c?name=3617143ddb9b176c3605defe6a9c798793280120" + curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lempar.c?name=db1bdb4821f2d8fbd76e577cf3ab18642c8d08d1" lemon.c: - curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lemon.c?name=039f813b520b9395740c52f9cbf36c90b5d8df03" + curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lemon.c?name=5ccba178a8e8a4b21e1c9232944d23973da38ad7" ./lemon: lemon.c | lempar.c $(CC) -o $@ $< -$(PHP_PSI_SRCDIR)/src/%.c: $(PHP_PSI_BUILDDIR)/parser.h - touch $@ -$(PHP_PSI_SRCDIR)/src/parser_proc.y: $(PHP_PSI_BUILDDIR)/parser.h - touch $@ +$(PHP_PSI_SRCDIR)/src/parser_proc.h: $(PHP_PSI_SRCDIR)/src/parser_proc.c + +$(PHP_PSI_SRCDIR)/src/parser_proc.inc: +$(PHP_PSI_SRCDIR)/src/parser_proc.y: $(PHP_PSI_SRCDIR)/src/parser_def.h $(PHP_PSI_SRCDIR)/src/parser_proc.inc + cat $(PHP_PSI_SRCDIR)/src/parser_proc.inc >$@ + $(CPP) -P -DGENERATE $< >>$@ $(PHP_PSI_SRCDIR)/src/parser_proc.c: $(PHP_PSI_SRCDIR)/src/parser_proc.y $(LEMON) - $(LEMON) -c $< + $(LEMON) $< -$(PHP_PSI_SRCDIR)/src/parser.re: $(PHP_PSI_BUILDDIR)/parser.h $(PHP_PSI_BUILDDIR)/parser_proc.h +$(PHP_PSI_SRCDIR)/src/parser.re: $(PHP_PSI_SRCDIR)/src/parser_proc.h touch $@ $(PHP_PSI_SRCDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re $(RE2C) -o $@ $< + +$(PHP_PSI_SRCDIR)/src/types/decl.c: $(PHP_PSI_SRCDIR)/php_psi_macros.h $(PHP_PSI_SRCDIR)/php_psi_redirs.h +$(PHP_PSI_SRCDIR)/src/context.c: $(PHP_PSI_SRCDIR)/php_psi_consts.h $(PHP_PSI_SRCDIR)/php_psi_decls.h $(PHP_PSI_SRCDIR)/php_psi_fn_decls.h $(PHP_PSI_SRCDIR)/php_psi_structs.h $(PHP_PSI_SRCDIR)/php_psi_types.h $(PHP_PSI_SRCDIR)/php_psi_unions.h $(PHP_PSI_SRCDIR)/php_psi_va_decls.h + +# -- deps + +PHP_PSI_DEPEND = $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(PHP_PSI_SOURCES:.c=.dep)) + +.PHONY: psi-clean-depend +psi-clean-depend: + -rm -f $(PHP_PSI_DEPEND) $(PHP_PSI_BUILDDIR)/php_psi.dep + +psi-clean: psi-clean-depend + +$(PHP_PSI_BUILDDIR)/%.dep: $(PHP_PSI_SRCDIR)/%.c + $(CC) -MM -MG -MF $@ -MT $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(@:.dep=.lo)) \ + $(CPPFLAGS) $(DEFS) $(INCLUDES) $< \ + || touch $@ + +DEPS = +ifneq ($(DEPS),) +-include $(PHP_PSI_DEPEND) +-include $(PHP_PSI_BUILDDIR)/php_psi.dep +endif + + +# -- deps