changeset 89:d01098eccf21

nuc-fw: configuration mechanism hooked into the top level Makefile
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 25 Aug 2013 19:05:51 +0000
parents ccde45a06737
children 5c1e6b7b5bd1
files .hgignore nuc-fw/Makefile nuc-fw/Makefile.build
diffstat 3 files changed, 33 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri Aug 23 02:02:59 2013 +0000
+++ b/.hgignore	Sun Aug 25 19:05:51 2013 +0000
@@ -10,6 +10,7 @@
 ^loadtools/fc-xram
 
 ^nuc-fw/build\.conf$
+^nuc-fw/config\.stamp$
 ^nuc-fw/finlink/.*\.map
 ^nuc-fw/include/config\.
 
--- a/nuc-fw/Makefile	Fri Aug 23 02:02:59 2013 +0000
+++ b/nuc-fw/Makefile	Sun Aug 25 19:05:51 2013 +0000
@@ -1,16 +1,23 @@
-COMPONENTS=	nucdemo nucleus sprintf sysglue
-SUBDIR=		${COMPONENTS} finlink
+SUBDIR=		finlink include nucdemo nucleus sprintf sysglue
 
-all:	ramImage
+default:	config.stamp
+	${MAKE} ${MFLAGS} -f Makefile.build $@
+
+ramImage flashImage:	config.stamp
+	${MAKE} ${MFLAGS} -f Makefile.build $@
 
-${COMPONENTS}: FRC
-	cd $@; make ${MFLAGS}
+config.stamp:	build.conf
+	cfgmagic/processconf.sh
+	touch $@
 
-ramImage flashImage: ${COMPONENTS}
-	cd finlink; make ${MFLAGS} $@
+build.conf:
+	@echo 'Configuration is required before the build.'
+	@echo 'Please create a valid build.conf file by running config.sh'
+	@echo 'or copying an existing configuration file into place.'
+	@false
 
 clean: FRC
-	rm -f a.out core errs
-	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
+	rm -f a.out core errs *.stamp
+	for i in ${SUBDIR}; do (cd $$i; ${MAKE} ${MFLAGS} clean); done
 
 FRC:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuc-fw/Makefile.build	Sun Aug 25 19:05:51 2013 +0000
@@ -0,0 +1,16 @@
+# The primary Makefile invokes ${MAKE} with this sub-Makefile
+# just like the typical subdirectory Makefiles.
+# This invokation happens after the processconf.sh step,
+# hence the include below.
+
+include	include/config.mk
+
+default: ${BUILD_DEFAULT_IMAGE}
+
+${BUILD_COMPONENTS}: FRC
+	cd $@; ${MAKE} ${MFLAGS}
+
+ramImage flashImage: ${BUILD_COMPONENTS}
+	cd finlink; ${MAKE} ${MFLAGS} $@
+
+FRC: