From: Michael Wallner Date: Wed, 1 Feb 2017 08:52:16 +0000 (+0100) Subject: better dependency management X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=commitdiff_plain;h=9c6a90318dc5e20b73820d7c2bb8eb3b30888cb3 better dependency management --- diff --git a/.gitignore b/.gitignore index b8e7d88..d81b816 100644 --- a/.gitignore +++ b/.gitignore @@ -76,4 +76,4 @@ php_psi_unions.h /token.h /types.h /types/ -*.d +*.dep diff --git a/Makefile.frag b/Makefile.frag index 65e5ed7..d192749 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -63,22 +63,23 @@ $(PHP_PSI_SRCDIR)/src/context.c: $(PHP_PSI_SRCDIR)/php_psi_consts.h $(PHP_PSI_SR # -- deps -PHP_PSI_DEPEND = $(PHP_PSI_SOURCES:.c=.d) +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) + -rm -f $(PHP_PSI_DEPEND) $(PHP_PSI_BUILDDIR)/php_psi.dep psi-clean: psi-clean-depend -%.d: %.c - $(CC) -MM -MG -MF $@ -MT $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(@:.d=.lo)) \ +$(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 diff --git a/config.m4 b/config.m4 index db96d5f..fa20964 100644 --- a/config.m4 +++ b/config.m4 @@ -133,6 +133,7 @@ if test "$PHP_PSI" != no; then AC_DEFINE_UNQUOTED([PSI_DECLS], ["$PSI_DECLS"], [Predefined functions]) AC_DEFINE_UNQUOTED([PSI_VA_DECLS], ["$PSI_VA_DECLS"], [Predefined vararg functions]) + PHP_ADD_INCLUDE($PHP_PSI_SRCDIR) PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src) PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/types) PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src) diff --git a/m4/psi/psi.m4 b/m4/psi/psi.m4 index 63ed194..c8eec18 100644 --- a/m4/psi/psi.m4 +++ b/m4/psi/psi.m4 @@ -16,7 +16,17 @@ dnl Creates stubs of the headers with pre-defined types etc. dnl These headers are included by src/context.c. dnl This macro must be called prior any checks for a type, struct, decl etc. AC_DEFUN(PSI_CONFIG_INIT, [ + cat >$PHP_PSI_BUILDDIR/php_psi.dep <>$PHP_PSI_BUILDDIR/php_psi.dep <$i <