better dependency management
[m6w6/ext-psi] / m4 / psi / psi.m4
index 4012ec1c782e5e24d45718a29a6d64a41afbd077..c8eec1850d9f546efeef16b550e39bbf1be9c38a 100644 (file)
@@ -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 <<EOF
+\$(PHP_PSI_SRCDIR)/php_psi.h:
+php_psi.h:
+\$(PHP_PSI_SRCDIR)/php_psi_stdinc.h:
+php_psi_stdinc.h:
+EOF
        for i in $PSI_STDTYPES $PSI_TYPES $PSI_STRUCTS $PSI_UNIONS $PSI_CONSTS $PSI_REDIRS $PSI_MACROS $PSI_DECLS $PSI_VA_DECLS $PSI_FN_DECLS; do
+               cat >>$PHP_PSI_BUILDDIR/php_psi.dep <<EOF
+$i:
+$(basename $i):
+EOF
                cat >$i <<EOF
 /* generated by configure */
 #include "php_psi_stdinc.h"
@@ -294,7 +304,10 @@ dnl PSI_LEMON()
 dnl Declare $LEMON precious, and check for a `lemon` in $PATH.
 AC_DEFUN(PSI_LEMON, [
        AC_ARG_VAR(LEMON, The lemon parser generator of the SQLite project)
-       AC_PATH_PROG(LEMON, lemon, ./lemon)
+       if test -z "$LEMON"
+       then
+               AC_PATH_PROG(LEMON, lemon, ./lemon)
+       fi
        PHP_SUBST(LEMON)
 ])