X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=Makefile.frag;h=d192749f055844e19afee4154f5af134d02b504f;hp=1c42778fe48d63213d6d0e85a8effb14cda92227;hb=9c6a90318dc5e20b73820d7c2bb8eb3b30888cb3;hpb=d60f4bbdd315ddf42dbafeff0fd3d87d2e7a51f7 diff --git a/Makefile.frag b/Makefile.frag index 1c42778..d192749 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) @@ -15,24 +19,68 @@ psi-build-headers: $(PHP_PSI_HEADERS) .PHONY: psi-clean-headers psi-clean-headers: -rm -f $(PHP_PSI_HEADERS) + -rmdir $(PHP_PSI_BUILDDIR)/types + +.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=3ec1463a034b37d87d782be5f6b8b10a3b1ecbe7" 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=799e73e19a33b8dd7767a7fa34618ed2a9c2397d" ./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