15804658 SUNBT7185081-12.0 Userland could use component-hook target from SFW
authorNorm Jacobs <Norm.Jacobs@Oracle.COM>
Mon, 05 Nov 2012 14:07:04 -0800
changeset 1038 3b4d8f56a1bf
parent 1037 336412dc83cf
child 1039 0b67f53d21f2
15804658 SUNBT7185081-12.0 Userland could use component-hook target from SFW
Makefile
components/Makefile
make-rules/shared-macros.mk
--- a/Makefile	Mon Nov 05 09:26:49 2012 -0800
+++ b/Makefile	Mon Nov 05 14:07:04 2012 -0800
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 
 include make-rules/shared-macros.mk
@@ -35,11 +35,12 @@
 clobber:	TARGET = clobber
 setup:		TARGET = setup
 test:		TARGET = test
+component-hook:		TARGET = component-hook
 
 .DEFAULT:	publish
 
 download setup prep build install publish validate clean clobber \
-test: $(SUBDIRS)
+test component-hook: $(SUBDIRS)
 
 $(SUBDIRS):	FORCE
 	+echo "$(TARGET) $@" ; $(GMAKE) -C $@ $(TARGET)
--- a/components/Makefile	Mon Nov 05 09:26:49 2012 -0800
+++ b/components/Makefile	Mon Nov 05 14:07:04 2012 -0800
@@ -57,6 +57,7 @@
 clean:			TARGET = clean
 clobber:		TARGET = clobber
 test:			TARGET = test
+component-hook:		TARGET = component-hook
 prep build install publish test:	TEMPLATE_ZONE=$(ZONE)
 prep build install publish test:	LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
 
@@ -73,6 +74,8 @@
 
 download prep:	$(COMPONENT_DIRS.nosetup)
 
+component-hook:	$(COMPONENT_DIRS.nosetup)
+
 clean:		$(COMPONENT_DIRS.nosetup)
 	$(RM) components.mk depends.mk .profile
 
--- a/make-rules/shared-macros.mk	Mon Nov 05 09:26:49 2012 -0800
+++ b/make-rules/shared-macros.mk	Mon Nov 05 14:07:04 2012 -0800
@@ -650,3 +650,12 @@
 NO_TESTS =	test-nothing
 test-nothing:
 	@echo "There are no tests available at this time."
+
+# default behaviour for 'component-hook' target is to echo the component
+# name and version information, but more complex behaviour can be implemented
+# via command line setting of the COMPONENT_HOOK macro.
+COMPONENT_HOOK ?=	echo $(COMPONENT_NAME) $(COMPONENT_VERSION)
+
+component-hook:
+	@$(COMPONENT_HOOK)
+