3 # make subdir1 - build the subdir1
\r
4 # make subdir1/subdir2 - build subdir2
\r
7 # Removed all generated files
\r
9 # BOARDDIR=<board dir>
\r
10 # Select what board to build for
\r
12 # BOARDDIR=<board dir>
\r
13 # Select what board to build for
\r
16 # If Q=@ cmd's will not be echoed.
\r
19 # >make BOARDDIR=mpc551xsim BDIR=system/kernel,examples/simple all
\r
21 # >make BOARDDIR=mpc551xsim BDIR=system/kernel,examples/simple clean
\r
26 #-include board_config.mk
\r
31 UNAME:=$(shell uname)
\r
33 ifneq ($(findstring Darwin,$(UNAME)),)
\r
35 export SED=/opt/local/bin/gsed
\r
44 export TOPDIR = $(CURDIR)
\r
49 # -include saved_config.mk
\r
52 ifneq ($(filter clean_all,$(MAKECMDGOALS)),clean_all)
\r
54 $(error BOARDDIR is empty)
\r
62 export RELEASE_TREE=n
\r
64 override BDIR := system/kernel ${BDIR}
\r
65 #BDIR += system/kernel/testsystem
\r
73 # Ugly thing to make things work under cmd.exe
\r
74 PATH := /usr/bin/:$(PATH)
\r
75 find := $(shell which find)
\r
77 export objdir = obj_$(BOARDDIR)
\r
81 #space = $(empty) $(empty)
\r
88 @echo "Make kernel and a simple example"
\r
89 @echo " > make BOARDDIR=mpc551xsim CROSS_COMPILE=/opt/powerpc-eabi/bin/powerpc-eabi- BDIR=system/kernel,examples/simple all"
\r
91 @echo "Save the config (CROSS_COMPILE and BDIR)"
\r
92 @echo " > make BOARDDIR=mpc551xsim CROSS_COMPILE=/opt/powerpc-eabi/bin/powerpc-eabi- BDIR=system/kernel,examples/simple save"
\r
95 @echo " > make clean"
\r
97 @echo "Present config:"
\r
98 @echo " ARCH=$(ARCH)"
\r
99 @echo " ARCH_FAM=$(ARCH_FAM)"
\r
100 @echo " BOARDDIR =$(BOARDDIR)"
\r
101 @echo " CROSS_COMPILE =$(CROSS_COMPILE)"
\r
104 def-$(USE_T32_SIM) += USE_T32_SIM
\r
105 def-$(USE_DBG_PRINTF) += USE_DBG_PRINTF
\r
111 export def-y+=$(CFG_ARCH_$(ARCH)) $(CFG_MCU) $(CFG_CPU)
\r
113 BASEDIR = $(TOPDIR)/$(MOD)
\r
115 # We descend into the object directories and build the. That way it's easier to build
\r
116 # multi-arch support and we don't have to use objdir everywhere.
\r
117 # ROOTDIR - The top-most directory
\r
118 # SUBDIR - The current subdirectory it's building.
\r
121 make embUnit/textui embunit/embUnit drivers/test all
\r
124 split = $(subst $(comma), ,$(1))
\r
127 #dir_cmd_goals := $(filter-out %_config config testa all install uninstall clean test save,$(MAKECMDGOALS))
\r
128 dir_cmd_goals := $(call split,$(BDIR))
\r
130 cmd_cmd_goals := $(filter clean all install,$(MAKECMDGOALS))
\r
132 #$(error $(dir_cmd_goals) $(MAKECMDGOALS))
\r
137 all: libs $(dir_cmd_goals)
\r
140 @echo Building for $(dir_cmd_goals)
\r
141 @echo BOARDDIR: $(BOARDDIR)
\r
142 @echo ARCH_FAM/ARCH: $(ARCH_FAM)/$(ARCH)
\r
145 $(dir_cmd_goals) :: show_build FORCE
\r
146 @echo ==========[ $@ ]===========
\r
147 +@[ -d $@/$(objdir) ] || mkdir -p $@/$(objdir)
\r
148 @chmod 777 $@/$(objdir)
\r
149 $(Q)$(MAKE) -r -C $@/$(objdir) -f $(CURDIR)/scripts/rules.mk ROOTDIR=$(CURDIR) SUBDIR=$@ $(cmd_cmd_goals)
\r
152 # --no-print-directory
\r
159 @find . -type d -name obj_* | xargs rm -rf
\r
160 @find . -type f -name *.a | xargs rm -rf
\r
163 clean: $(dir_cmd_goals)
\r
165 @echo " Removing objectfiles and libs for ARCH=$(ARCH)"
\r
166 @find . -type d -name $(objdir) | xargs rm -rf
\r
167 @find . -type f -name *.a| xargs rm -rf
\r