configure: generate lemon in the build dir, too
authorMichael Wallner <mike@php.net>
Fri, 3 Feb 2017 12:19:35 +0000 (13:19 +0100)
committerMichael Wallner <mike@php.net>
Fri, 3 Feb 2017 12:20:09 +0000 (13:20 +0100)
Makefile.frag
m4/psi/psi.m4

index 4d3d726f0db229cfb65341062723318f37f6c62b..2d05638a4fafa3c79e30c71288dd52d1ff5056cb 100644 (file)
@@ -10,37 +10,13 @@ $(PHP_PSI_BUILDDIR)/types/%.h: $(PHP_PSI_SRCDIR)/src/types/%.h | $(PHP_PSI_BUILD
 $(PHP_PSI_BUILDDIR)/%.h: $(PHP_PSI_SRCDIR)/src/%.h
        @cat >$@ <$<
 
-install-headers: psi-build-headers
-clean: psi-clean
-
-.PHONY: psi-build-headers
-psi-build-headers: $(PHP_PSI_HEADERS)
-
-.PHONY: psi-clean-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:
+$(PHP_PSI_BUILDDIR)/lempar.c:
        curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lempar.c?name=db1bdb4821f2d8fbd76e577cf3ab18642c8d08d1"
 
-lemon.c:
+$(PHP_PSI_BUILDDIR)/lemon.c:
        curl -sSo $@ "http://www.sqlite.org/src/raw/tool/lemon.c?name=5ccba178a8e8a4b21e1c9232944d23973da38ad7"
 
-./lemon: lemon.c | lempar.c
+$(PHP_PSI_BUILDDIR)/lemon: $(PHP_PSI_BUILDDIR)/lemon.c | $(PHP_PSI_BUILDDIR)/lempar.c
        $(CC) -o $@ $<
 
 $(PHP_PSI_SRCDIR)/src/parser_proc.h: $(PHP_PSI_SRCDIR)/src/parser_proc.c
@@ -57,16 +33,8 @@ $(PHP_PSI_SRCDIR)/src/parser.re: $(PHP_PSI_SRCDIR)/src/parser_proc.h
 $(PHP_PSI_SRCDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re
        $(RE2C) -o $@ $<
 
-# -- 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)
-
-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) $< \
@@ -80,5 +48,36 @@ ifneq ($(PSI_DEPS),)
 endif
 endif
 
+install-headers: psi-build-headers
+.PHONY: psi-clean
+clean: psi-clean
+
+.PHONY: psi-build-headers
+psi-build-headers: $(PHP_PSI_HEADERS)
+
+.PHONY: psi-clean-headers
+psi-clean-headers:
+       -rm -f $(PHP_PSI_HEADERS)
+
+psi-clean: psi-clean-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
+
+psi-clean: psi-clean-sources
+
+.PHONY: psi-clean-aux
+psi-clean-aux:
+       -rm -f $(PHP_PSI_BUILDDIR)/lempar.c $(PHP_PSI_BUILDDIR)/lemon.c $(PHP_PSI_BUILDDIR)/lemon
+
+psi-clean: psi-clean-aux
+
+.PHONY: psi-clean-depend
+psi-clean-depend:
+       -rm -f $(PHP_PSI_DEPEND)
+
+psi-clean: psi-clean-depend
 
-# -- deps
index b0e30f49eff63bbf66c687e0f4dfb8539c2736fd..5692e71e42ec517367da9c0d9faded023f16dd6b 100644 (file)
@@ -275,7 +275,7 @@ AC_DEFUN(PSI_LEMON, [
        AC_ARG_VAR(LEMON, The lemon parser generator of the SQLite project)
        if test -z "$LEMON"
        then
-               AC_PATH_PROG(LEMON, lemon, ./lemon)
+               AC_PATH_PROG(LEMON, lemon, $PHP_PSI_BUILDDIR/lemon)
        fi
        PHP_SUBST(LEMON)
 ])