diff --git a/Makefile.include b/Makefile.include index 37322751d..ee3cd797e 100644 --- a/Makefile.include +++ b/Makefile.include @@ -1,5 +1,12 @@ # -*- makefile -*- +ifndef BOARD +default: allboards +else +default: all +endif +.PHONY: default + CROSS_COMPILE := arm-linux- LINKERSCRIPT := $(MC1322X)/mc1322x.lds @@ -33,7 +40,6 @@ export ARCH CPU VENDOR .SECONDARY: - ### See http://make.paulandlesley.org/autodep.html#advanced ifdef BOARD -include ${addprefix $(OBJDIR)/,$(addsuffix .d,$(TARGETS))} @@ -63,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)) @@ -118,13 +126,7 @@ clobber \ mrproper \ distclean: clean -#.DEFAULT_GOAL := all - -ifndef BOARD -.DEFAULT_GOAL := allboards -else -.DEFAULT_GOAL := all -endif +.PHONY: clean clobber mrproper distclean all: $(OBJDIR)/board.h for target in $(TARGETS); do make $$target\_$(BOARD).bin; done @@ -133,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 f544da56a..5e8dff878 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -18,12 +18,25 @@ TARGETS_WITH_ROM_VARS := nvm-read nvm-write romimg flasher \ rftest-rx rftest-tx \ per -submodule: - git submodule update --init - $(MAKE) +################################################## +# you shouldn't need to edit anything below here # +################################################## +# 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 +# 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) + +.PHONY: submodule +