[virt-tools-list] [PATCH 02/47] Move Makefile.am into each sub-dir

Daniel P. Berrange berrange at redhat.com
Wed Aug 25 19:36:57 UTC 2010


Move Makefile.am into each sub-dir so that built objects end
up in the same directory as the sources, instead of polluting
the top level. This will also enable the gobject introspection
makefile rules to be imported later

* .gitignore: test-skeleton & test-skeleton.sh
* Makefile.am: Remove all build rules, add SUBDIRS
* osinfo/Makefile.am: Add build rules for library
* test/Makefile.am: Add build rules for tests
* test/test-skeleton.c: Update to reflect changed
  current directory during test execution
---
 .gitignore           |    2 ++
 Makefile.am          |   46 +---------------------------------------------
 configure.ac         |    6 +++++-
 osinfo/Makefile.am   |   40 ++++++++++++++++++++++++++++++++++++++++
 test/Makefile.am     |   23 +++++++++++++++++++++++
 test/test-skeleton.c |    4 ++--
 6 files changed, 73 insertions(+), 48 deletions(-)
 create mode 100644 osinfo/Makefile.am
 create mode 100644 test/Makefile.am

diff --git a/.gitignore b/.gitignore
index 392e51c..811eeef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,5 @@ configure
 libtool
 m4
 stamp-h1
+test/test-skeleton
+test/test-skeleton.sh
diff --git a/Makefile.am b/Makefile.am
index 22acdcb..1a271c6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,51 +1,7 @@
 
-AM_CPPFLAGS = -I$(top_srcdir) $(LIBXML_CFLAGS) $(GOBJECT_CFLAGS)
-libosinfo_la_LDFLAGS = $(LIBXML_LIBS) $(GOBJECT_LIBS)
-
-lib_LTLIBRARIES = libosinfo.la
-
-libosinfo_la_SOURCES =		\
-  osinfo/osinfo_db.h		\
-  osinfo/osinfo_device.h		\
-  osinfo/osinfo_devicelist.h		\
-  osinfo/osinfo_entity.h		\
-  osinfo/osinfo_filter.h		\
-  osinfo/osinfo_hypervisor.h		\
-  osinfo/osinfo_hypervisorlist.h		\
-  osinfo/osinfo_list.h		\
-  osinfo/osinfo_os.h		\
-  osinfo/osinfo_oslist.h		\
-  osinfo/osinfo_common.h		\
-  osinfo/osinfo_common.c		\
-  osinfo/osinfo_dataread.c		\
-  osinfo/osinfo_device.c		\
-  osinfo/osinfo_devicelist.c		\
-  osinfo/osinfo_entity.c		\
-  osinfo/osinfo_filter.c		\
-  osinfo/osinfo_hypervisor.c	\
-  osinfo/osinfo_hypervisorlist.c	\
-  osinfo/osinfo_list.c	\
-  osinfo/osinfo_oslist.c	\
-  osinfo/osinfo_db.c			\
-  osinfo/osinfo_os.c
-
-check_PROGRAMS =			\
-  test/test-skeleton
+SUBDIRS = osinfo test
 
 EXTRA_DIST =				\
   data/libosinfo-dummy-data.xml
 
-LDADD = $(lib_LTLIBRARIES)
-
-generated_test_scripts = $(patsubst %,%.sh,$(check_PROGRAMS))
-TESTS = $(generated_test_scripts)
-
-DISTCLEANFILES = $(generated_test_scripts)
-
-test/%.sh: Makefile
-	printf '#!$(SHELL)\nexec $(*F) $(srcdir)/data\n' > $@-tmp
-	chmod a+x $@-tmp
-	mv $@-tmp $@
 
-TESTS_ENVIRONMENT = \
-  PATH='$(abs_top_builddir)/test$(PATH_SEPARATOR)'"$$PATH"
diff --git a/configure.ac b/configure.ac
index 9a182be..3db8bde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,5 +53,9 @@ fi
 AC_SUBST([LIBXML_CFLAGS])
 AC_SUBST([LIBXML_LIBS])
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([
+	Makefile
+	osinfo/Makefile
+	test/Makefile
+])
 AC_OUTPUT
diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
new file mode 100644
index 0000000..a44349a
--- /dev/null
+++ b/osinfo/Makefile.am
@@ -0,0 +1,40 @@
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir) \
+	$(LIBXML_CFLAGS) \
+	$(GOBJECT_CFLAGS)
+libosinfo_la_LDFLAGS = \
+	$(LIBXML_LIBS) \
+	$(GOBJECT_LIBS)
+
+lib_LTLIBRARIES = libosinfo.la
+
+libosinfo_includedir = $(includedir)/osinfo-1.0/osinfo
+
+libosinfo_include_HEADERS = 		\
+  osinfo_db.h		\
+  osinfo_device.h		\
+  osinfo_devicelist.h		\
+  osinfo_entity.h		\
+  osinfo_filter.h		\
+  osinfo_hypervisor.h		\
+  osinfo_hypervisorlist.h		\
+  osinfo_list.h		\
+  osinfo_os.h		\
+  osinfo_oslist.h
+
+libosinfo_la_SOURCES =		\
+  osinfo_common.h		\
+  osinfo_common.c		\
+  osinfo_dataread.c		\
+  osinfo_device.c		\
+  osinfo_devicelist.c		\
+  osinfo_entity.c		\
+  osinfo_filter.c		\
+  osinfo_hypervisor.c	\
+  osinfo_hypervisorlist.c	\
+  osinfo_list.c	\
+  osinfo_oslist.c	\
+  osinfo_db.c			\
+  osinfo_os.c
+
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..642cb7b
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,23 @@
+
+check_PROGRAMS =			\
+	test-skeleton
+
+
+generated_test_scripts = $(patsubst %,%.sh,$(check_PROGRAMS))
+TESTS = $(generated_test_scripts)
+
+test_skeleton_LDADD = ../osinfo/libosinfo.la
+test_skeleton_SOURCES = test-skeleton.c
+test_skeleton_CFLAGS = \
+	-I$(top_srcdir)/ \
+	$(GOBJECT_CFLAGS)
+
+DISTCLEANFILES = $(generated_test_scripts)
+
+%.sh: Makefile
+	printf '#!$(SHELL)\nexec $(*F) $(srcdir)/data\n' > $@-tmp
+	chmod a+x $@-tmp
+	mv $@-tmp $@
+
+TESTS_ENVIRONMENT = \
+  PATH='$(abs_top_builddir)/test$(PATH_SEPARATOR)'"$$PATH"
diff --git a/test/test-skeleton.c b/test/test-skeleton.c
index 24541f5..2b819e8 100644
--- a/test/test-skeleton.c
+++ b/test/test-skeleton.c
@@ -4,7 +4,7 @@
 #include <assert.h>
 
 #include <glib-object.h>
-#include <osinfo.h>
+#include <osinfo/osinfo.h>
 
 int
 main (int argc, char *argv[])
@@ -14,7 +14,7 @@ main (int argc, char *argv[])
 
     /* Create our object */
     OsinfoDb *db = g_object_new (OSINFO_TYPE_DB, "backing-dir",
-                                 "./data", NULL);
+                                 "../data", NULL);
 
     // Read in data
     ret = osinfoInitializeDb(db, NULL);
-- 
1.7.2.1




More information about the virt-tools-list mailing list