make-rules/configure.mk
changeset 166 db8a55996482
parent 156 c2445b73a8b2
child 168 5884bc1edfdf
--- a/make-rules/configure.mk	Mon Apr 04 23:24:05 2011 -0700
+++ b/make-rules/configure.mk	Tue Apr 05 09:12:38 2011 +0200
@@ -28,25 +28,30 @@
 # support and build multiple version (32/64 bit) from a shared source.
 #
 # To use these rules, include ../make-rules/configure.mk in your Makefile
-# and define "build", "install" targets appropriate to building your component.
+# and define "build", "install", and "test" targets appropriate to building
+# your component.
 # Ex:
 #
 # 	build:		$(SOURCE_DIR)/build/$(MACH32)/.built \
 #	 		$(SOURCE_DIR)/build/$(MACH64)/.built
-# 
+#
 #	install:	$(SOURCE_DIR)/build/$(MACH32)/.installed \
 #	 		$(SOURCE_DIR)/build/$(MACH64)/.installed
 #
+#	test:		$(SOURCE_DIR)/build/$(MACH32)/.tested \
+#	 		$(SOURCE_DIR)/build/$(MACH64)/.tested
+#
 # Any additional pre/post configure, build, or install actions can be specified
 # in your make file by setting them in on of the following macros:
 #	COMPONENT_PRE_CONFIGURE_ACTION, COMPONENT_POST_CONFIGURE_ACTION
 #	COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
 #	COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
+#	COMPONENT_PRE_TEST_ACTION, COMPONENT_POST_TEST_ACTION
 #
 # If component specific make targets need to be used for build or install, they
 # can be specified in
-
 #	COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
+#	COMPONENT_TEST_TARGETS
 #
 
 CONFIGURE_PREFIX =	/usr
@@ -82,6 +87,8 @@
 $(BUILD_DIR)/$(MACH64)/.built:		BITS=64
 $(BUILD_DIR)/$(MACH32)/.installed:	BITS=32
 $(BUILD_DIR)/$(MACH64)/.installed:	BITS=64
+$(BUILD_DIR)/$(MACH32)/.tested:		BITS=32
+$(BUILD_DIR)/$(MACH64)/.tested:		BITS=64
 
 CONFIGURE_ENV += $(CONFIGURE_ENV.$(BITS))
 CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
@@ -89,6 +96,9 @@
 # set the default target for installation of the component
 COMPONENT_INSTALL_TARGETS =	install
 
+# set the default target for test of the component
+COMPONENT_TEST_TARGETS =	check
+
 # configure the unpacked source for building 32 and 64 bit version
 CONFIGURE_SCRIPT =	$(SOURCE_DIR)/configure
 $(BUILD_DIR)/%/.configured:	$(SOURCE_DIR)/.prep
@@ -115,5 +125,13 @@
 	$(COMPONENT_POST_INSTALL_ACTION)
 	$(TOUCH) $@
 
+# test the built source
+$(BUILD_DIR)/%/.tested:	$(BUILD_DIR)/%/.built
+	$(COMPONENT_PRE_TEST_ACTION)
+	(cd $(@D) ; $(ENV) $(COMPONENT_TEST_ENV) $(GMAKE) \
+			$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
+	$(COMPONENT_POST_TEST_ACTION)
+	$(TOUCH) $@
+
 clean::
 	$(RM) -r $(BUILD_DIR) $(PROTO_DIR)