| 1 | ############################################################################ |
|---|
| 2 | # Copyright (c) 2003-2010, Broadcom Corporation |
|---|
| 3 | # All Rights Reserved |
|---|
| 4 | # Confidential Property of Broadcom Corporation |
|---|
| 5 | # |
|---|
| 6 | # THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | # AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | # EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | # |
|---|
| 10 | # $brcm_Workfile: tools.mak $ |
|---|
| 11 | # $brcm_Revision: 23 $ |
|---|
| 12 | # $brcm_Date: 4/26/10 6:25p $ |
|---|
| 13 | # |
|---|
| 14 | # Module Description: |
|---|
| 15 | # |
|---|
| 16 | # Revision History: |
|---|
| 17 | # |
|---|
| 18 | # $brcm_Log: /BSEAV/api/build/tools.mak $ |
|---|
| 19 | # |
|---|
| 20 | # 23 4/26/10 6:25p mward |
|---|
| 21 | # SW7125-253: Set CROSS_COMPILE for big-endian. |
|---|
| 22 | # |
|---|
| 23 | # 22 4/16/10 10:07a erickson |
|---|
| 24 | # SW7400-2511: avoid circular reference if ARCH is defined |
|---|
| 25 | # |
|---|
| 26 | # 21 4/15/10 2:36p erickson |
|---|
| 27 | # SW7400-2511: support B_REFSW_ARCH |
|---|
| 28 | # |
|---|
| 29 | # 20 4/9/10 4:50p jrubio |
|---|
| 30 | # SW7125-253: fix for Big Endian |
|---|
| 31 | # |
|---|
| 32 | # 19 4/2/10 6:07p mward |
|---|
| 33 | # SW7125-253: stbgcc-4.4.3-1.0 has mipsel-linux-uclibc-gcc not mipsel- |
|---|
| 34 | # uclibc-gcc. |
|---|
| 35 | # |
|---|
| 36 | # 18 3/24/10 11:16a erickson |
|---|
| 37 | # SW7405-4104: remove comment about g++ GPL contamination |
|---|
| 38 | # |
|---|
| 39 | # 17 11/17/09 2:15p erickson |
|---|
| 40 | # SW7405-3408: use $(filter) instead of $(findstring) |
|---|
| 41 | # |
|---|
| 42 | # 16 3/26/09 10:56a vsilyaev |
|---|
| 43 | # PR 53611: Use simply expanded variables everywhere where is used. It |
|---|
| 44 | # prevents evaluation of every where variable is used |
|---|
| 45 | # |
|---|
| 46 | # 15 12/12/07 9:30a erickson |
|---|
| 47 | # PR32813: changed comment |
|---|
| 48 | # |
|---|
| 49 | # 14 7/25/07 11:28a vsilyaev |
|---|
| 50 | # PR 32813: Added Windows MINGW support |
|---|
| 51 | # |
|---|
| 52 | # 13 12/15/06 6:27p vsilyaev |
|---|
| 53 | # PR 26656: Added BPRofile support |
|---|
| 54 | # |
|---|
| 55 | # 12 7/19/06 5:39p jgarrett |
|---|
| 56 | # PR 19909: Fixing make -j errors |
|---|
| 57 | # |
|---|
| 58 | # 11 7/14/06 11:31a jgarrett |
|---|
| 59 | # PR 19909: Merging to latest baseline |
|---|
| 60 | # |
|---|
| 61 | # PR19909/2 7/7/06 1:30p jgarrett |
|---|
| 62 | # PR 19909: Changed Q_ from ?= to := for vxWorks. |
|---|
| 63 | # |
|---|
| 64 | # PR19909/1 7/6/06 10:51a jgarrett |
|---|
| 65 | # PR 19909: Reducing brutus build output |
|---|
| 66 | # |
|---|
| 67 | # 9 2/17/06 2:34p rjlewis |
|---|
| 68 | # PR19725: v6 and linux versions can use -p option. |
|---|
| 69 | # |
|---|
| 70 | # 8 1/18/06 11:51a rjlewis |
|---|
| 71 | # PR19044: added MV definition (for move). |
|---|
| 72 | # |
|---|
| 73 | # 7 12/7/05 4:10p hkuhnert |
|---|
| 74 | # PR15072: Change chdir to pwd when compiling from linux host. |
|---|
| 75 | # |
|---|
| 76 | # 6 8/4/05 4:41p erickson |
|---|
| 77 | # PR15139: collected generic build configuration into |
|---|
| 78 | # BSEAV/build/refsw_inc.mak |
|---|
| 79 | # |
|---|
| 80 | # 5 2/23/05 2:40p erickson |
|---|
| 81 | # PR14180: tools.mak must define SYSTEM too |
|---|
| 82 | # |
|---|
| 83 | # 4 2/22/05 1:53p erickson |
|---|
| 84 | # PR14180: default DEBUG to y, added better ARCH/PLATFORM support for |
|---|
| 85 | # vxworks |
|---|
| 86 | # |
|---|
| 87 | # 3 2/17/05 1:51p erickson |
|---|
| 88 | # PR9497: modified ARCH for vxworks to be more meaningful |
|---|
| 89 | # |
|---|
| 90 | # 2 2/16/05 4:45p erickson |
|---|
| 91 | # PR9497: allow dos mkdir to work |
|---|
| 92 | # |
|---|
| 93 | # 1 2/7/05 6:57p dlwin |
|---|
| 94 | # Merge down for release 2005_REFSW_MERGETOMAIN: |
|---|
| 95 | # |
|---|
| 96 | # Irvine_BSEAVSW_Devel/13 9/10/04 9:44a erickson |
|---|
| 97 | # PR12621: use which and dirname to determine TOOLCHAIN_DIR from bottom |
|---|
| 98 | # up |
|---|
| 99 | # |
|---|
| 100 | # Irvine_BSEAVSW_Devel/12 6/24/04 11:40a erickson |
|---|
| 101 | # PR11135: converted backticks to $(shell) command |
|---|
| 102 | # |
|---|
| 103 | # Irvine_BSEAVSW_Devel/11 6/24/04 10:27a erickson |
|---|
| 104 | # PR11135: dynamically determine toolchain path |
|---|
| 105 | # |
|---|
| 106 | # Irvine_BSEAVSW_Devel/10 6/1/04 11:38a erickson |
|---|
| 107 | # PR9447: setting default to uclibc |
|---|
| 108 | # |
|---|
| 109 | # Irvine_BSEAVSW_Devel/9 3/1/04 2:02p erickson |
|---|
| 110 | # PR9447: define TOOLCHAIN_DIR in the tool.mak file |
|---|
| 111 | # |
|---|
| 112 | # Irvine_BSEAVSW_Devel/8 1/30/04 4:39p erickson |
|---|
| 113 | # PR9107: added option for ARCH=i386-linux, this should default |
|---|
| 114 | # CROSS_COMPILE to nothing |
|---|
| 115 | # |
|---|
| 116 | # Irvine_BSEAVSW_Devel/7 1/29/04 6:42p vsilyaev |
|---|
| 117 | # PR 9447: Default arch is mipsel-linux until further notice. |
|---|
| 118 | # |
|---|
| 119 | # Irvine_BSEAVSW_Devel/6 1/27/04 5:56p vsilyaev |
|---|
| 120 | # PR 9497: Added tools for VxWorks |
|---|
| 121 | # |
|---|
| 122 | # Irvine_BSEAVSW_Devel/5 1/23/04 11:17a erickson |
|---|
| 123 | # PR9447: using common tools.mak so that conversion to uclibc is easier |
|---|
| 124 | # |
|---|
| 125 | # Irvine_BSEAVSW_Devel/4 1/22/04 4:32p erickson |
|---|
| 126 | # PR9447: default ARCH to mipsel-uclibc |
|---|
| 127 | # |
|---|
| 128 | # Irvine_BSEAVSW_Devel/3 10/28/03 1:13p erickson |
|---|
| 129 | # convert from g++ to c++ |
|---|
| 130 | # |
|---|
| 131 | # Irvine_BSEAVSW_Devel/2 10/9/03 2:34p erickson |
|---|
| 132 | # fixed uclibc support |
|---|
| 133 | # |
|---|
| 134 | # |
|---|
| 135 | ########################################################################### |
|---|
| 136 | |
|---|
| 137 | # This make include defines macros for cross-development tools. |
|---|
| 138 | # It is used in a wide range of environments, so don't add anything |
|---|
| 139 | # that doesn't belong here. |
|---|
| 140 | |
|---|
| 141 | # ARCH must indentify the CPU and operating system being compiled for. |
|---|
| 142 | # If you chose a value of ARCH which doesn't uniquely identify this, you |
|---|
| 143 | # will have an unstable or hacked-up build system elsewhere. |
|---|
| 144 | |
|---|
| 145 | # Valid values include: |
|---|
| 146 | # i386-linux = Intel Linux systems(e.g. unix host compiler) |
|---|
| 147 | # i386-mingw = host compiler in Windows Mingw environment |
|---|
| 148 | # mipsel-linux = glibc, little endian Linux on MIPS |
|---|
| 149 | # mips-linux = glibc, big endian Linux on MIPS |
|---|
| 150 | # mipsel-uclibc = uclibc (busybox), little endian Linux on MIPS |
|---|
| 151 | # mips-uclibc = uclibc (busybox), big endian Linux on MIPS |
|---|
| 152 | # mips-vxworks = vxworks, big endian on MIPS |
|---|
| 153 | |
|---|
| 154 | ifdef B_REFSW_ARCH |
|---|
| 155 | ARCH ?= $(B_REFSW_ARCH) |
|---|
| 156 | endif |
|---|
| 157 | |
|---|
| 158 | # Handle vxworks from either the SYSTEM or ARCH variable. |
|---|
| 159 | ifeq ($(ARCH),mips-vxworks) |
|---|
| 160 | SYSTEM=vxworks |
|---|
| 161 | endif |
|---|
| 162 | |
|---|
| 163 | ifeq ($(SYSTEM),vxworks) |
|---|
| 164 | |
|---|
| 165 | ARCH = mips-vxworks |
|---|
| 166 | CROSS_COMPILE = mips |
|---|
| 167 | CC = cc${CROSS_COMPILE} |
|---|
| 168 | CXX = c++${CROSS_COMPILE} |
|---|
| 169 | LD = ld${CROSS_COMPILE} |
|---|
| 170 | AR = ar${CROSS_COMPILE} |
|---|
| 171 | NM = nm${CROSS_COMPILE} |
|---|
| 172 | STRIP = strip${CROSS_COMPILE} |
|---|
| 173 | OBJCOPY = objcopy${CROSS_COMPILE} |
|---|
| 174 | OBJDUMP = objdump${CROSS_COMPILE} |
|---|
| 175 | RANLIB = ranlib${CROSS_COMPILE} |
|---|
| 176 | |
|---|
| 177 | # MKDIR must make recursive dirs, and not fail if already existing |
|---|
| 178 | ifeq ($(OSTYPE),linux) |
|---|
| 179 | MKDIR = mkdir -p |
|---|
| 180 | PWD = pwd |
|---|
| 181 | MV = mv |
|---|
| 182 | else |
|---|
| 183 | ifeq ($(vxWorksVersion),6) |
|---|
| 184 | MKDIR = mkdir -p |
|---|
| 185 | PWD = pwd |
|---|
| 186 | MV = mv |
|---|
| 187 | else |
|---|
| 188 | # These are really DOS options: |
|---|
| 189 | MKDIR = -mkdir |
|---|
| 190 | PWD = chdir |
|---|
| 191 | MV = move |
|---|
| 192 | endif |
|---|
| 193 | endif |
|---|
| 194 | |
|---|
| 195 | else |
|---|
| 196 | |
|---|
| 197 | # |
|---|
| 198 | # Default toolchain |
|---|
| 199 | # |
|---|
| 200 | ARCH ?= mipsel-uclibc |
|---|
| 201 | SYSTEM ?= linux |
|---|
| 202 | |
|---|
| 203 | # |
|---|
| 204 | # Set variables based on the toolchain |
|---|
| 205 | # |
|---|
| 206 | ifeq ($(filter ${ARCH}, i386-linux i386-mingw), ${ARCH}) |
|---|
| 207 | CROSS_COMPILE ?= |
|---|
| 208 | TOOLCHAIN_DIR=/usr/bin |
|---|
| 209 | else |
|---|
| 210 | ifeq ($(filter ${ARCH}, mips-linux mips-uclibc mips-linux-uclibc), ${ARCH}) |
|---|
| 211 | TOOLCHAIN_DIR:=$(shell dirname $(shell dirname $(shell which mips-linux-uclibc-gcc 2>/dev/null) 2>/dev/null)) |
|---|
| 212 | CROSS_COMPILE ?= mips-linux-uclibc- |
|---|
| 213 | else |
|---|
| 214 | # Default Little Endian |
|---|
| 215 | # |
|---|
| 216 | TOOLCHAIN_DIR:=$(shell dirname $(shell dirname $(shell which mipsel-linux-uclibc-gcc 2>/dev/null) 2>/dev/null)) |
|---|
| 217 | CROSS_COMPILE ?= mipsel-linux-uclibc- |
|---|
| 218 | endif |
|---|
| 219 | endif |
|---|
| 220 | |
|---|
| 221 | # Define make variables |
|---|
| 222 | AS = $(CROSS_COMPILE)as |
|---|
| 223 | LD = $(CROSS_COMPILE)ld |
|---|
| 224 | CC = $(CROSS_COMPILE)gcc |
|---|
| 225 | CXX = $(CROSS_COMPILE)c++ |
|---|
| 226 | AR = $(CROSS_COMPILE)ar |
|---|
| 227 | NM = $(CROSS_COMPILE)nm |
|---|
| 228 | STRIP = $(CROSS_COMPILE)strip |
|---|
| 229 | OBJCOPY = $(CROSS_COMPILE)objcopy |
|---|
| 230 | OBJDUMP = $(CROSS_COMPILE)objdump |
|---|
| 231 | RANLIB = $(CROSS_COMPILE)ranlib |
|---|
| 232 | MKDIR = mkdir -p |
|---|
| 233 | PWD = pwd |
|---|
| 234 | MV = mv |
|---|
| 235 | |
|---|
| 236 | endif |
|---|
| 237 | |
|---|
| 238 | # These are operations common to all environments. |
|---|
| 239 | CPP = $(CC) -E |
|---|
| 240 | CP = cp -f |
|---|
| 241 | RM = rm -f |
|---|
| 242 | SORT = sort |
|---|
| 243 | SED = sed |
|---|
| 244 | TOUCH = touch |
|---|
| 245 | AWK = awk |
|---|
| 246 | |
|---|
| 247 | # Define options for quiet builds |
|---|
| 248 | export VERBOSE |
|---|
| 249 | ifneq ($(VERBOSE),) |
|---|
| 250 | Q_:= |
|---|
| 251 | else |
|---|
| 252 | # This was Q_?=@, but that caused vxWorks problems. VERBOSE=y must be used now to get verbose msgs. |
|---|
| 253 | Q_:=@ |
|---|
| 254 | MAKEFLAGS += --no-print-directory |
|---|
| 255 | endif |
|---|
| 256 | |
|---|