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
24 export UNAME:=$(shell uname)
\r
26 ifneq ($(findstring Darwin,$(UNAME)),)
\r
28 export SED=/opt/local/bin/gsed
\r
37 export TOPDIR = $(CURDIR)
\r
38 export CFG_RELEASE = n
\r
39 export CFG_DEBUG = y
\r
42 ifneq ($(filter clean_all,$(MAKECMDGOALS)),clean_all)
\r
44 $(error BOARDDIR is empty)
\r
51 # override BDIR := system/kernel ${BDIR}
\r
54 # Ugly thing to make things work under cmd.exe
\r
55 PATH := /usr/bin/:$(PATH)
\r
56 find := $(shell which find)
\r
58 export objdir = obj_$(BOARDDIR)
\r
65 @echo "Make kernel and a simple example"
\r
66 @echo " > make BOARDDIR=mpc551xsim CROSS_COMPILE=/opt/powerpc-eabi/bin/powerpc-eabi- BDIR=examples/simple all"
\r
68 @echo "Save the config (CROSS_COMPILE and BDIR)"
\r
69 @echo " > make BOARDDIR=mpc551xsim CROSS_COMPILE=/opt/powerpc-eabi/bin/powerpc-eabi- BDIR=examples/simple save"
\r
72 @echo " > make clean"
\r
74 @echo "Present config:"
\r
75 @echo " ARCH=$(ARCH)"
\r
76 @echo " ARCH_FAM=$(ARCH_FAM)"
\r
77 @echo " BOARDDIR =$(BOARDDIR)"
\r
78 @echo " CROSS_COMPILE =$(CROSS_COMPILE)"
\r
81 def-$(USE_DBG_PRINTF) += USE_DBG_PRINTF
\r
87 export def-y+=$(CFG_ARCH_$(ARCH)) $(CFG_MCU) $(CFG_CPU)
\r
89 # We descend into the object directories and build the. That way it's easier to build
\r
90 # multi-arch support and we don't have to use objdir everywhere.
\r
91 # ROOTDIR - The top-most directory
\r
92 # SUBDIR - The current subdirectory it's building.
\r
95 split = $(subst $(comma), ,$(1))
\r
96 dir_cmd_goals := $(call split,$(BDIR))
\r
97 cmd_cmd_goals := $(filter clean all install,$(MAKECMDGOALS))
\r
102 all: libs $(dir_cmd_goals)
\r
105 @echo Building for $(dir_cmd_goals)
\r
106 @echo BOARDDIR: $(BOARDDIR)
\r
107 @echo ARCH_FAM/ARCH: $(ARCH_FAM)/$(ARCH)
\r
110 $(dir_cmd_goals) :: show_build FORCE
\r
111 @echo ==========[ $@ ]===========
\r
112 +@[ -d $@/$(objdir) ] || mkdir -p $@/$(objdir)
\r
113 @chmod 777 $@/$(objdir)
\r
114 $(Q)$(MAKE) -r -C $@/$(objdir) -f $(CURDIR)/scripts/rules.mk ROOTDIR=$(CURDIR) SUBDIR=$@ $(cmd_cmd_goals)
\r
120 @find . -type d -name obj_* | xargs rm -rf
\r
121 @find . -type f -name *.a | xargs rm -rf
\r
124 clean: $(dir_cmd_goals)
\r
126 @echo " Removing objectfiles and libs for ARCH=$(ARCH)"
\r
127 @find . -type d -name $(objdir) | xargs rm -rf
\r
128 @find . -type f -name *.a| xargs rm -rf
\r