components/Makefile
changeset 32 280a7444e782
parent 23 e7ed56b7c498
child 34 d20b10eba317
--- a/components/Makefile	Wed Aug 25 11:58:58 2010 -0700
+++ b/components/Makefile	Thu Sep 02 11:07:22 2010 -0500
@@ -28,7 +28,16 @@
 # level build, it may make different decisions and will need to include
 # appropriate dependency information.
 
-COMPONENT_DIRS =	$(shell echo */Makefile | sed -e 's;/Makefile;;g')
+# 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
+	@echo "Generating component list..."
+	@$(TOOLS)/bass-o-matic.py --workspace=$(WS_TOP) --components=paths \
+		| sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
+
+include components.mk
+
 
 download:	TARGET = download
 prep:		TARGET = prep
@@ -38,7 +47,7 @@
 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:		LOG = >$(WS_LOGS)/$(TARGET):[email protected] 2>&1
 
 .DEFAULT:	publish
 
@@ -50,6 +59,7 @@
 ifeq ($(findstring file://, $(PKG_REPO)),file://)
 	$(RM) -r $(PKG_REPO:file://%=%) $(WS_LOGS)
 endif
+	$(RM) components.mk depends.mk
 
 setup:	$(WS_LOGS) repo tools
 
@@ -63,8 +73,15 @@
 tools:
 	@cd ../tools ; echo "building tools..." ; $(GMAKE) setup
 
-$(COMPONENT_DIRS):	FORCE
-	@cd $@ ; echo "$(TARGET) \c" ; pwd ; \
-	 $(GMAKE) $(TARGET) $(LOG)
+$(COMPONENT_DIRS):	setup FORCE
+	@cd $@ ; echo "$(TARGET) $@" ; $(GMAKE) $(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 \
+		| sed -e 's;$(shell pwd)/;;g' >$@
+
+include depends.mk
 
 FORCE: