Lets use more of libtoolisms to make sure we don't build files
everytime, only when needed.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
.gitignore | 1 +
tools/Makefile.am | 29 ++++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/.gitignore b/.gitignore
index 2a6915a..95c45bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@ Makefile.in
config.log
config.status
configure
+depcomp
docs/*.html
docs/*.html.in
autom4te.cache/
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 27254ae..6d3f6bc 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,6 +1,25 @@
-EXTRA_DIST = generate-api-docs.c
+noinst_PROGRAMS=generate-api-docs
-all-am:
- $(CC) -Wall -o generate-api-docs generate-api-docs.c
- ./generate-api-docs ../src/libvirt-php.c ../docs/api-reference.html.in
- ./generate-api-docs --private ../src/libvirt-php.c ../docs/dev-api-reference.html.in
+generate_api_docs_SOURCES=generate-api-docs.c
+
+APIBUILD_STAMP=$(srcdir)/.stamp
+EXTRA_DIST = $(APIBUILD_STAMP)
+
+doc_generated_files = \
+ $(top_builddir)/docs/api-reference.html.in \
+ $(top_builddir)/docs/dev-api-reference.html.in
+ $(NULL)
+
+$(doc_generated_files): $(APIBUILD_STAMP)
+
+$(APIBUILD_STAMP): $(srcdir)/generate-api-docs
+ ./generate-api-docs $(top_srcdir)/src/libvirt-php.c ../docs/api-reference.html.in
+ ./generate-api-docs --private $(top_srcdir)/src/libvirt-php.c
../docs/dev-api-reference.html.in
+ touch $@
+
+CLEANFILES = $(doc_generated_files)
+
+maintainer-clean-local:
+ rm -rf $(APIBUILD_STAMP)
+
+all-am: $(APIBUILD_STAMP)
--
2.3.6