From de4f7cc512bbffb5e71290ac48e659dae5e9601d Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 5 Dec 2016 12:58:42 +0100 Subject: [PATCH] Makefile: optional deps --- .gitignore | 1 + Makefile.frag | 26 ++++++++++++++++++-------- src/calc.h | 2 +- src/marshal.h | 2 +- src/types/impl_def_val.h | 2 +- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index aa984d7..b8e7d88 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,4 @@ php_psi_unions.h /token.h /types.h /types/ +*.d diff --git a/Makefile.frag b/Makefile.frag index e904edf..65e5ed7 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -61,15 +61,25 @@ $(PHP_PSI_SRCDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re $(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 -PHP_PSI_DEPEND = $(PHP_PSI_BUILDDIR)/Makefile.deps +# -- deps -depend: psi-depend -.PHONY: psi-depend -psi-depend: $(PHP_PSI_DEPEND) +PHP_PSI_DEPEND = $(PHP_PSI_SOURCES:.c=.d) -$(PHP_PSI_DEPEND): $(PHP_PSI_SOURCES) - $(CC) -MM -MG $(CPPFLAGS) $(DEFS) $(INCLUDES) $^ \ - | $(SED) -e 's/^\(.*\).o: /\1.lo: /' \ - > $@ +.PHONY: psi-clean-depend +psi-clean-depend: + -rm -f $(PHP_PSI_DEPEND) +psi-clean: psi-clean-depend + +%.d: %.c + $(CC) -MM -MG -MF $@ -MT $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(@:.d=.lo)) \ + $(CPPFLAGS) $(DEFS) $(INCLUDES) $< \ + || touch $@ + +DEPS = +ifneq ($(DEPS),) -include $(PHP_PSI_DEPEND) +endif + + +# -- deps diff --git a/src/calc.h b/src/calc.h index d8f9e18..8e1ea6b 100644 --- a/src/calc.h +++ b/src/calc.h @@ -27,7 +27,7 @@ #define PSI_CALC_H #include "token.h" -#include "impl_val.h" +#include "types/impl_val.h" #define PRIfval "f" #define PRIdval "lf" diff --git a/src/marshal.h b/src/marshal.h index 6fe15c6..8067fb3 100644 --- a/src/marshal.h +++ b/src/marshal.h @@ -26,7 +26,7 @@ #ifndef PSI_MARSHAL_H #define PSI_MARSHAL_H -#include "impl_val.h" +#include "types/impl_val.h" #include "Zend/zend_types.h" struct psi_let_exp; diff --git a/src/types/impl_def_val.h b/src/types/impl_def_val.h index d483d8e..b5530bc 100644 --- a/src/types/impl_def_val.h +++ b/src/types/impl_def_val.h @@ -27,7 +27,7 @@ #define PSI_TYPES_IMPL_DEF_VAL_H #include "token.h" -#include "impl_val.h" +#include "types/impl_val.h" struct psi_data; struct psi_impl_type; -- 2.30.2