X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=Makefile.frag;h=c31b9d971f092e2f711cb5bd35d65e26c4d8d9a2;hp=99f708aec56338585dfe85e25703520975d2c3ea;hb=1cc295bbc317d62e6ba254a0dcfb00c5a7a5baaa;hpb=3013555bce1419702ada905aa6829fac285cf118 diff --git a/Makefile.frag b/Makefile.frag index 99f708a..c31b9d9 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -1,12 +1,17 @@ # provide headers in builddir, so they do not end up in /usr/include/ext/psi/src 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,17 +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/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_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