[Libguestfs] [PATCH 04/12] configure: Make sure that certain build directories exist.

Richard W.M. Jones rjones at redhat.com
Wed Apr 24 20:55:32 UTC 2013


From: "Richard W.M. Jones" <rjones at redhat.com>

When builddir != srcdir, this ensures that certain build directories
which might not exist are created by configure.
---
 appliance/Makefile.am    |  4 ----
 configure.ac             | 13 +++++++++++++
 java/Makefile.am         |  1 -
 ocaml/Makefile.am        | 17 -----------------
 tests/guests/Makefile.am |  2 --
 5 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/appliance/Makefile.am b/appliance/Makefile.am
index 28ae06b..dfd1a84 100644
--- a/appliance/Makefile.am
+++ b/appliance/Makefile.am
@@ -78,13 +78,11 @@ excludelist: excludelist.in Makefile
 
 supermin.d/base.img supermin.d/hostfiles: stamp-supermin
 stamp-supermin: make.sh packagelist excludelist
-	mkdir -p supermin.d
 	rm -f $@ supermin.d/base.img supermin.d/hostfiles
 	./make.sh
 	touch $@
 
 supermin.d/daemon.img: ../daemon/guestfsd guestfsd.suppressions
-	mkdir -p supermin.d
 	rm -f $@ $@-t
 	rm -rf tmp-d
 	mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc
@@ -96,7 +94,6 @@ supermin.d/daemon.img: ../daemon/guestfsd guestfsd.suppressions
 
 supermin.d/init.img: init
 	cmp -s $(srcdir)/init $(builddir)/init || cp $(srcdir)/init $(builddir)/init
-	mkdir -p supermin.d
 	rm -f $@ $@-t
 	echo "init" | cpio --quiet -o -H newc > $@-t
 	mv $@-t $@
@@ -104,7 +101,6 @@ supermin.d/init.img: init
 # We should put this file in /lib/udev/rules.d, but put it in /etc so
 # we don't have to deal with all the UsrMove crap in Fedora.
 supermin.d/udev-rules.img: 99-guestfs-serial.rules
-	mkdir -p supermin.d
 	rm -f $@ $@-t
 	rm -rf tmp-u
 	mkdir -p tmp-u/etc/udev/rules.d
diff --git a/configure.ac b/configure.ac
index af45de8..c290fa9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1528,7 +1528,19 @@ LIBTOOL='bash $(top_srcdir)/libtool-kill-dependency_libs.sh $(top_builddir)/libt
 AC_SUBST([LIBTOOL])
 
 dnl Produce output files.
+
 AC_CONFIG_HEADERS([config.h])
+
+dnl For separated builds, make sure that certain build directories exist.
+dnl This avoids having to sprinkle 'mkdir -p' statements throughout
+dnl many Makefile.am rules.
+mkdir -p \
+    appliance/supermin.d \
+    java/t \
+    ocaml/html \
+    ocaml/t \
+    tests/guests/guest-aux
+
 dnl http://www.mail-archive.com/automake@gnu.org/msg10204.html
 AC_CONFIG_FILES([appliance/libguestfs-make-fixed-appliance],
                 [chmod +x,-w appliance/libguestfs-make-fixed-appliance])
@@ -1540,6 +1552,7 @@ AC_CONFIG_FILES([podwrapper.pl],
                 [chmod +x,-w podwrapper.pl])
 AC_CONFIG_FILES([run],
                 [chmod +x,-w run])
+
 AC_CONFIG_FILES([Makefile
                  align/Makefile
                  appliance/Makefile
diff --git a/java/Makefile.am b/java/Makefile.am
index c3bb337..240b2de 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -132,7 +132,6 @@ TESTS_ENVIRONMENT = $(top_builddir)/run --test
 noinst_DATA = Bindtests.class $(java_tests:.java=.class)
 
 t/%.class: t/%.java libguestfs-$(VERSION).jar
-	mkdir -p t
 	$(JAVAC) $(JAVAC_FLAGS) -classpath libguestfs-$(VERSION).jar -d $(builddir)/t $<
 
 Bindtests.class: Bindtests.java libguestfs-$(VERSION).jar
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 5215f1d..d3b3a2e 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -90,7 +90,6 @@ if HAVE_OCAMLDOC
 noinst_DATA += html/index.html
 
 html/index.html: $(srcdir)/guestfs*.mli $(srcdir)/guestfs*.ml
-	mkdir -p html
 	-$(OCAMLDOC) -d html -html $^
 endif
 
@@ -120,75 +119,59 @@ noinst_DATA += \
 	$(test_progs:%=%.opt)
 
 bindtests.bc: bindtests.cmo mlguestfs.cma
-	mkdir -p t
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
 bindtests.opt: bindtests.cmx mlguestfs.cmxa
-	mkdir -p t
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
 
 t/guestfs_005_load.bc: t/guestfs_005_load.cmo mlguestfs.cma
-	mkdir -p t
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
 t/guestfs_005_load.opt: t/guestfs_005_load.cmx mlguestfs.cmxa
-	mkdir -p t
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
 
 t/guestfs_010_basic.bc: t/guestfs_010_basic.cmo mlguestfs.cma
-	mkdir -p t
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
 t/guestfs_010_basic.opt: t/guestfs_010_basic.cmx mlguestfs.cmxa
-	mkdir -p t
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
 
 t/guestfs_070_threads.bc: t/guestfs_070_threads.cmo mlguestfs.cma
-	mkdir -p t
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix,threads -thread -linkpkg mlguestfs.cma $< -o $@
 
 t/guestfs_070_threads.opt: t/guestfs_070_threads.cmx mlguestfs.cmxa
-	mkdir -p t
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix,threads -thread -linkpkg mlguestfs.cmxa $< -o $@
 
 t/guestfs_080_optargs.bc: t/guestfs_080_optargs.cmo mlguestfs.cma
-	mkdir -p t
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
 t/guestfs_080_optargs.opt: t/guestfs_080_optargs.cmx mlguestfs.cmxa
-	mkdir -p t
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
 
 t/guestfs_400_events.bc: t/guestfs_400_events.cmo mlguestfs.cma
-	mkdir -p t
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
 t/guestfs_400_events.opt: t/guestfs_400_events.cmx mlguestfs.cmxa
-	mkdir -p t
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
 
 t/guestfs_400_progress.bc: t/guestfs_400_progress.cmo mlguestfs.cma
-	mkdir -p t
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
 t/guestfs_400_progress.opt: t/guestfs_400_progress.cmx mlguestfs.cmxa
-	mkdir -p t
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
 
 t/guestfs_500_mount_local.bc: t/guestfs_500_mount_local.cmo mlguestfs.cma
-	mkdir -p t
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc -custom $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
 t/guestfs_500_mount_local.opt: t/guestfs_500_mount_local.cmx mlguestfs.cmxa
-	mkdir -p t
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
 
 # Explicit rules for these tests which require 'threads' package.
diff --git a/tests/guests/Makefile.am b/tests/guests/Makefile.am
index 884098d..3fd2cfa 100644
--- a/tests/guests/Makefile.am
+++ b/tests/guests/Makefile.am
@@ -106,13 +106,11 @@ fedora-btrfs.img: guest-aux/make-fedora-img.pl \
 
 guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt
 	rm -f $@ $@-t
-	mkdir -p guest-aux
 	$(DB_LOAD) $@-t < $<
 	mv $@-t $@
 
 guest-aux/fedora-packages.db: guest-aux/fedora-packages.db.txt
 	rm -f $@ $@-t
-	mkdir -p guest-aux
 	$(DB_LOAD) $@-t < $<
 	mv $@-t $@
 
-- 
1.8.1.4




More information about the Libguestfs mailing list