components/Makefile
changeset 34 d20b10eba317
parent 32 280a7444e782
child 38 cd00ea74156e
--- a/components/Makefile	Thu Sep 02 11:08:43 2010 -0500
+++ b/components/Makefile	Sun Sep 19 15:50:53 2010 -0500
@@ -31,9 +31,9 @@
 # components.mk is auto-generated by the build tools.  It populates the
 # COMPONENT_DIRS macro with a list of all directories in the workspace that
 # contain a component.
-components.mk:	Makefile # $(WS_TOP)/components
+components.mk:	# Makefile # $(WS_TOP)/components
 	@echo "Generating component list..."
-	@$(TOOLS)/bass-o-matic.py --workspace=$(WS_TOP) --components=paths \
+	@$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
 		| sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
 
 include components.mk
@@ -47,21 +47,22 @@
 validate:	TARGET = validate
 clean:		TARGET = clean
 clobber:	TARGET = clobber
-prep build install publish:		LOG = >$(WS_LOGS)/$(TARGET):[email protected] 2>&1
+prep build install publish:		TEMPLATE_ZONE=$(ZONE)
+prep build install publish:		LOG = >$(WS_LOGS)/$@.$(TARGET).log 2>&1
 
 .DEFAULT:	publish
 
-.PARALLEL:	$(COMPONENT_DIRS)
+download prep build install publish validate: $(COMPONENT_DIRS)
 
-download prep build install publish validate: setup $(COMPONENT_DIRS)
+COMPONENT_DIRS.nosetup =	$(COMPONENT_DIRS:%=%.nosetup)
 
-clean clobber:	$(COMPONENT_DIRS)
-ifeq ($(findstring file://, $(PKG_REPO)),file://)
-	$(RM) -r $(PKG_REPO:file://%=%) $(WS_LOGS)
-endif
-	$(RM) components.mk depends.mk
+clean:	$(COMPONENT_DIRS:%=%.nosetup)
+	$(RM) components.mk depends.mk .profile
 
-setup:	$(WS_LOGS) repo tools
+clobber:	$(COMPONENT_DIRS:%=%.nosetup) clean
+	$(RM) -r $(WS_REPO) $(WS_LOGS)
+
+setup:	$(WS_LOGS) repo tools .profile
 
 $(WS_LOGS):
 	$(MKDIR) $@
@@ -73,13 +74,27 @@
 tools:
 	@cd ../tools ; echo "building tools..." ; $(GMAKE) setup
 
+# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
+# to pass a few things on to zone based builds
+.profile:
+	echo "PATH=$(PATH)" >>$@
+	echo "WS_TOP=$(WS_TOP)" >>$@
+	echo "export PATH WS_TOP" >>$@
+
 $(COMPONENT_DIRS):	setup FORCE
-	@cd $@ ; echo "$(TARGET) $@" ; $(GMAKE) $(TARGET) $(LOG)
+	@cd $@ ; echo "$(TARGET) $@" ; \
+	 $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
+	 		 $(@:%=--component %) --make $(TARGET) $(LOG)
+
+$(COMPONENT_DIRS.nosetup):	FORCE
+	@cd $(@:%.nosetup=%) ; echo "$(TARGET) $(@:%.nosetup=%)" ; \
+	 $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
+	 		 $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
 
 # depends.mk is auto-generated by the build tools, bass-o-matic.py in particular
 depends.mk:	components.mk
 	@echo "Generating component dependencies..."
-	@$(TOOLS)/bass-o-matic.py --workspace=$(WS_TOP) --components=depend \
+	@$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=depend \
 		| sed -e 's;$(shell pwd)/;;g' >$@
 
 include depends.mk