From 61ef7083420dd3a3c8d69162b53b2dc0d8ba959b Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Fri, 12 Mar 2010 16:43:21 -0500 Subject: [PATCH 1/3] new Makefile with errorchecks for make version number and checks that $(MC1322X) exists. --- tests/Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index f544da56a..652ae8387 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -18,8 +18,25 @@ TARGETS_WITH_ROM_VARS := nvm-read nvm-write romimg flasher \ rftest-rx rftest-tx \ per -submodule: +################################################## +# you shouldn't need to edit anything below here # +################################################## + +need := 3.81 +ok := $(filter $(need),$(firstword $(sort $(MAKE_VERSION) \ + $(need)))) + +ifdef $(need) +$(error You need to use version 3.81 of Make or later) +endif + +# this rule will become the default_goal if +# $(MC1322X)/Makefile.include doesn't exist it will try to update the +# submodule, check if $(MC1322X) exists, and if it does +# try make again +submodule: git submodule update --init + if [ ! -d $(MC1322X) ] ; then echo "*** cannot find MC1322X directory $(MC1322X)" ; exit 2; fi $(MAKE) -include $(MC1322X)/Makefile.include From d0ea93c7415fc91698978e9088f520588a26b9c4 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Fri, 12 Mar 2010 16:51:49 -0500 Subject: [PATCH 2/3] Workaround DEFAULT_GOAL so that you can use older versions of make. From Jim. --- Makefile.include | 14 ++++++-------- tests/Makefile | 12 ++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Makefile.include b/Makefile.include index 37322751d..a0669c9f2 100644 --- a/Makefile.include +++ b/Makefile.include @@ -1,5 +1,11 @@ # -*- makefile -*- +ifndef BOARD +default: allboards +else +default: all +endif + CROSS_COMPILE := arm-linux- LINKERSCRIPT := $(MC1322X)/mc1322x.lds @@ -118,14 +124,6 @@ clobber \ mrproper \ distclean: clean -#.DEFAULT_GOAL := all - -ifndef BOARD -.DEFAULT_GOAL := allboards -else -.DEFAULT_GOAL := all -endif - all: $(OBJDIR)/board.h for target in $(TARGETS); do make $$target\_$(BOARD).bin; done for target in $(TARGETS_WITH_ROM_VARS); do make TARGET_ROM_VARS=1 $$target\_$(BOARD).bin; done diff --git a/tests/Makefile b/tests/Makefile index 652ae8387..bcce0cce8 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -22,13 +22,9 @@ TARGETS_WITH_ROM_VARS := nvm-read nvm-write romimg flasher \ # you shouldn't need to edit anything below here # ################################################## -need := 3.81 -ok := $(filter $(need),$(firstword $(sort $(MAKE_VERSION) \ - $(need)))) - -ifdef $(need) -$(error You need to use version 3.81 of Make or later) -endif +# This Makefile includes the default rule at the top +# it needs to be included first +-include $(MC1322X)/Makefile.include # this rule will become the default_goal if # $(MC1322X)/Makefile.include doesn't exist it will try to update the @@ -39,7 +35,7 @@ submodule: if [ ! -d $(MC1322X) ] ; then echo "*** cannot find MC1322X directory $(MC1322X)" ; exit 2; fi $(MAKE) --include $(MC1322X)/Makefile.include + From 85e26336a4fc9306dd88805a5570a39d28d1acc4 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Fri, 12 Mar 2010 17:00:53 -0500 Subject: [PATCH 3/3] add PHONYs --- Makefile.include | 7 ++++++- tests/Makefile | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.include b/Makefile.include index a0669c9f2..ee3cd797e 100644 --- a/Makefile.include +++ b/Makefile.include @@ -5,6 +5,7 @@ default: allboards else default: all endif +.PHONY: default CROSS_COMPILE := arm-linux- @@ -39,7 +40,6 @@ export ARCH CPU VENDOR .SECONDARY: - ### See http://make.paulandlesley.org/autodep.html#advanced ifdef BOARD -include ${addprefix $(OBJDIR)/,$(addsuffix .d,$(TARGETS))} @@ -69,6 +69,8 @@ BOARDARCS := $(OBJDIR)/board.a(${filter $(OBJDIR)/%.o,$(OBJDIR)/$(COBJS)}) endif empty-board-a: $(AR) $(ARFLAGS) $(OBJDIR)/board.a +.PHONY: empty-board-a + $(OBJDIR)/board.a: empty-board-a $(BOARDARCS) $(MC1322X)/src/src.a: $(MC1322X)/src/src.a($(SRCOBJS)) @@ -124,6 +126,8 @@ clobber \ mrproper \ distclean: clean +.PHONY: clean clobber mrproper distclean + all: $(OBJDIR)/board.h for target in $(TARGETS); do make $$target\_$(BOARD).bin; done for target in $(TARGETS_WITH_ROM_VARS); do make TARGET_ROM_VARS=1 $$target\_$(BOARD).bin; done @@ -131,5 +135,6 @@ all: $(OBJDIR)/board.h allboards: for board in $(BOARDS); do make BOARD=$$board all; done +.PHONY: all allboards diff --git a/tests/Makefile b/tests/Makefile index bcce0cce8..5e8dff878 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -35,7 +35,7 @@ submodule: if [ ! -d $(MC1322X) ] ; then echo "*** cannot find MC1322X directory $(MC1322X)" ; exit 2; fi $(MAKE) - +.PHONY: submodule