| 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: rules.mak $ |
|---|
| 11 | # $brcm_Revision: 38 $ |
|---|
| 12 | # $brcm_Date: 4/22/10 12:01p $ |
|---|
| 13 | # |
|---|
| 14 | # Module Description: |
|---|
| 15 | # |
|---|
| 16 | # Revision History: |
|---|
| 17 | # |
|---|
| 18 | # $brcm_Log: /BSEAV/api/build/rules.mak $ |
|---|
| 19 | # |
|---|
| 20 | # 38 4/22/10 12:01p mward |
|---|
| 21 | # SW7125-325: LIVEMEDIA_SUPPORT build error using stbgcc-4.4.3-1.0. Must |
|---|
| 22 | # do final link using c++ not gcc if LiveMedia library built with c++ is |
|---|
| 23 | # used. |
|---|
| 24 | # |
|---|
| 25 | # 37 8/11/09 1:47p vsilyaev |
|---|
| 26 | # PR 57592: Don't strip local symbols |
|---|
| 27 | # |
|---|
| 28 | # 36 4/21/09 11:02a jtna |
|---|
| 29 | # PR54118: temporary revert |
|---|
| 30 | # |
|---|
| 31 | # 35 4/20/09 5:38p jtna |
|---|
| 32 | # PR54118: enforce dependency of libsettop.so: nexus |
|---|
| 33 | # |
|---|
| 34 | # 34 3/26/09 2:21p vsilyaev |
|---|
| 35 | # PR 53611: Use -MMD files to create dependency file (this would exclude |
|---|
| 36 | # #include <header.h> files) |
|---|
| 37 | # |
|---|
| 38 | # 33 1/2/08 9:54a erickson |
|---|
| 39 | # PR36068: veryclean should do clean, otherwise the OTHER_CLEANS are |
|---|
| 40 | # ignored with veryclean. |
|---|
| 41 | # |
|---|
| 42 | # 32 12/18/07 1:49p gmohile |
|---|
| 43 | # PR 34640 : Added DivX DRM binaries |
|---|
| 44 | # |
|---|
| 45 | # 31 2/15/07 12:52p rjlewis |
|---|
| 46 | # PR27791: add crypto library for VxWorks builds. |
|---|
| 47 | # |
|---|
| 48 | # 30 1/15/07 10:44a vsilyaev |
|---|
| 49 | # PR 26928: Fixed link flags to reserved spaced for common symbols |
|---|
| 50 | # |
|---|
| 51 | # 29 1/11/07 4:39p vsilyaev |
|---|
| 52 | # PR 26928: Added linuxkernel target |
|---|
| 53 | # |
|---|
| 54 | # 28 1/5/07 10:57a vsilyaev |
|---|
| 55 | # PR 26928: Added bprofile support for application builds |
|---|
| 56 | # |
|---|
| 57 | # 27 12/19/06 4:33p jgarrett |
|---|
| 58 | # PR 20139: Fixing verbose rule default |
|---|
| 59 | # |
|---|
| 60 | # 26 12/15/06 6:27p vsilyaev |
|---|
| 61 | # PR 26656: Added BPRofile support |
|---|
| 62 | # |
|---|
| 63 | # 25 12/13/06 1:17p rjlewis |
|---|
| 64 | # PR21172: build map for VxWorks too. |
|---|
| 65 | # |
|---|
| 66 | # 24 8/28/06 11:22a mphillip |
|---|
| 67 | # PR22821: Issue was the ODIR_FLAG wasn't being made. This will ignore |
|---|
| 68 | # that dependency if the output is the current directory (as directory |
|---|
| 69 | # creation serialization is not key if you're using pwd). |
|---|
| 70 | # |
|---|
| 71 | # 23 8/25/06 12:13p rjlewis |
|---|
| 72 | # PR20604: vxworks doesn't like ?= |
|---|
| 73 | # |
|---|
| 74 | # 22 8/2/06 7:01p rjlewis |
|---|
| 75 | # PR19725: don't error if there are no files to delete. |
|---|
| 76 | # |
|---|
| 77 | # 21 8/2/06 2:08p mphillip |
|---|
| 78 | # PR19544: More build support |
|---|
| 79 | # |
|---|
| 80 | # 20 7/14/06 11:31a jgarrett |
|---|
| 81 | # PR 19909: Merging to latest baseline |
|---|
| 82 | # |
|---|
| 83 | # PR19909/2 7/6/06 4:43p jgarrett |
|---|
| 84 | # PR 19909: Merging to latest baseline |
|---|
| 85 | # |
|---|
| 86 | # 19 6/13/06 11:56a mphillip |
|---|
| 87 | # PR21883: Experimental aggressive optimization for p3d, opengles, vdc, |
|---|
| 88 | # and grc enabled for 7038. |
|---|
| 89 | # |
|---|
| 90 | # 18 5/9/06 4:30p vsilyaev |
|---|
| 91 | # PR 21171: Added hook that allows to execute arbitrary command when |
|---|
| 92 | # library and map file were built |
|---|
| 93 | # |
|---|
| 94 | # 16 4/24/06 3:00p vsilyaev |
|---|
| 95 | # PR 21171: Added rule to build map file |
|---|
| 96 | # |
|---|
| 97 | # 15 3/28/06 11:16a vsilyaev |
|---|
| 98 | # PR 20308: Fixed application build rules |
|---|
| 99 | # |
|---|
| 100 | # PR19909/1 7/6/06 10:51a jgarrett |
|---|
| 101 | # PR 19909: Reducing brutus build output |
|---|
| 102 | # |
|---|
| 103 | # 14 1/24/06 1:34p btan |
|---|
| 104 | # PR 19086: Added LIBS during APP_IMAGE build. |
|---|
| 105 | # |
|---|
| 106 | # 12 10/10/05 11:37a vsilyaev |
|---|
| 107 | # PR9497: Make Q_ options overwritable |
|---|
| 108 | # |
|---|
| 109 | # 11 8/8/05 10:29a erickson |
|---|
| 110 | # PR15577: removed ODIR_FLAG functionality for vxworks |
|---|
| 111 | # |
|---|
| 112 | # 10 7/20/05 5:17p vsilyaev |
|---|
| 113 | # PR 15577: Added rule to guarantee that we start compiling only after |
|---|
| 114 | # target directory was created. |
|---|
| 115 | # |
|---|
| 116 | # 8 5/5/05 2:31p erickson |
|---|
| 117 | # PR15159: added double quotes for DOS builds |
|---|
| 118 | # |
|---|
| 119 | # 7 5/2/05 12:29p erickson |
|---|
| 120 | # PR15145: added OTHER_MAKES which allows option of extending build rules |
|---|
| 121 | # |
|---|
| 122 | # 6 4/27/05 4:29p erickson |
|---|
| 123 | # PR9497: DOS mkdir doesn't do multiple subdirs (inside makefile at |
|---|
| 124 | # least), so be more explicit about it |
|---|
| 125 | # |
|---|
| 126 | # 5 3/24/05 12:53p vsilyaev |
|---|
| 127 | # PR 14593: 93560 support |
|---|
| 128 | # |
|---|
| 129 | # Refsw_93560_Bringup/1 3/21/05 9:09p vsilyaev |
|---|
| 130 | # Use C compiler (instead of C++) to build applications. It removes from |
|---|
| 131 | # link some libraries. |
|---|
| 132 | # |
|---|
| 133 | # 4 2/23/05 2:40p erickson |
|---|
| 134 | # PR14180: removed unnecessary vxworks code |
|---|
| 135 | # |
|---|
| 136 | # 3 2/17/05 1:51p erickson |
|---|
| 137 | # PR9497: make vxworks-friendly |
|---|
| 138 | # |
|---|
| 139 | # 2 2/16/05 4:44p erickson |
|---|
| 140 | # PR9497: allow dos mkdir to work |
|---|
| 141 | # |
|---|
| 142 | # 1 2/7/05 6:57p dlwin |
|---|
| 143 | # Merge down for release 2005_REFSW_MERGETOMAIN: |
|---|
| 144 | # |
|---|
| 145 | # Irvine_BSEAVSW_Devel/14 1/25/05 5:12p erickson |
|---|
| 146 | # PR13908: Settop API makefile rework |
|---|
| 147 | # |
|---|
| 148 | # Irvine_BSEAVSW_Devel/13 12/9/04 9:37a erickson |
|---|
| 149 | # PR12610: allow png to be cleaned from bwin |
|---|
| 150 | # |
|---|
| 151 | # Irvine_BSEAVSW_Devel/12 11/16/04 3:27p erickson |
|---|
| 152 | # PR13272: allow Q_= makefile option to have verbose output |
|---|
| 153 | # |
|---|
| 154 | # Irvine_BSEAVSW_Devel/11 8/13/04 10:04a liangl |
|---|
| 155 | # PR12279: Built fails if DEBUG=n in vxworks.bat |
|---|
| 156 | # |
|---|
| 157 | # Irvine_BSEAVSW_Devel/11 8/13/04 10:03a liangl |
|---|
| 158 | # PR12279: Built fails if DEBUG=n in vxworks.bat |
|---|
| 159 | # |
|---|
| 160 | # Irvine_BSEAVSW_Devel/10 4/7/04 1:18a vsilyaev |
|---|
| 161 | # PR 9497: Removed bogus comment. |
|---|
| 162 | # |
|---|
| 163 | # Irvine_BSEAVSW_Devel/9 3/29/04 10:14a jjordan |
|---|
| 164 | # PR10164: fix build dependencies (*.h) issue |
|---|
| 165 | # |
|---|
| 166 | # Irvine_BSEAVSW_Devel/8 1/29/04 8:11p vsilyaev |
|---|
| 167 | # PR 9497: Cleanup, compile vxworks to binaries with 'out' suffix. |
|---|
| 168 | # |
|---|
| 169 | # Irvine_BSEAVSW_Devel/7 1/29/04 6:29p vsilyaev |
|---|
| 170 | # PR 9497: Some hackory to make WindRiver's incornations of Gnu Make and |
|---|
| 171 | # Gnu C happier. |
|---|
| 172 | # |
|---|
| 173 | # Irvine_BSEAVSW_Devel/6 1/27/04 5:56p vsilyaev |
|---|
| 174 | # PR 9497: Use different suffix and rules to build VxWorks shared library |
|---|
| 175 | # |
|---|
| 176 | # Irvine_BSEAVSW_Devel/5 1/15/04 10:06a erickson |
|---|
| 177 | # PR9320: Switched -MMD to -MD in order to pick up Magnum dependencies. |
|---|
| 178 | # |
|---|
| 179 | # Irvine_BSEAVSW_Devel/4 12/19/03 4:54p vsilyaev |
|---|
| 180 | # PR 8850: In clean also remove libraries |
|---|
| 181 | # |
|---|
| 182 | # Irvine_BSEAVSW_Devel/3 7/28/03 3:48p erickson |
|---|
| 183 | # veryclean is dangerous from utils without this check |
|---|
| 184 | # |
|---|
| 185 | # Irvine_BSEAVSW_Devel/2 7/1/03 12:38p vsilyaev |
|---|
| 186 | # Changes order between destdir and library. |
|---|
| 187 | # |
|---|
| 188 | # |
|---|
| 189 | ########################################################################### |
|---|
| 190 | |
|---|
| 191 | ifneq ($(VERBOSE),) |
|---|
| 192 | Q_= |
|---|
| 193 | endif |
|---|
| 194 | |
|---|
| 195 | CDEP_FLAG = -MMD |
|---|
| 196 | |
|---|
| 197 | ifeq ($(ODIR),) |
|---|
| 198 | ODIR = . |
|---|
| 199 | endif |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | # We need ODIR_FLAG to serialize between directory creation and building object files into this directory |
|---|
| 203 | # ODIR itself can't be used because it would change with every object file written into the directory |
|---|
| 204 | ifneq ($(SYSTEM),vxworks) |
|---|
| 205 | ifeq ($(ODIR),.) |
|---|
| 206 | ODIR_FLAG= |
|---|
| 207 | else |
|---|
| 208 | ODIR_FLAG = ${ODIR}/flag |
|---|
| 209 | endif |
|---|
| 210 | endif |
|---|
| 211 | |
|---|
| 212 | # COPT_FLAGS is being set to allow objects in *_OPT_OBJS to be built with specialized flags. As of the time |
|---|
| 213 | # of implementation, it is restricted to the p3d, opengles, grc, and vdc objects. Not all areas of settopapi |
|---|
| 214 | # can safely be optimized to this level. |
|---|
| 215 | |
|---|
| 216 | # Implicit C Compile Rule |
|---|
| 217 | ifeq ($(SYSTEM),linux) |
|---|
| 218 | ifeq ($(BCHP_CHIP),7038) |
|---|
| 219 | $(ODIR)/%.o : COPT_FLAGS=$(if $(findstring $@,$(ST_OPT_OBJS)),-O3 -mips32,) |
|---|
| 220 | endif |
|---|
| 221 | endif |
|---|
| 222 | $(ODIR)/%.o : %.c ${ODIR_FLAG} |
|---|
| 223 | @echo [Compile... $(notdir $<)] |
|---|
| 224 | ${Q_}$(CC) ${CDEP_FLAG} ${CFLAGS_STATIC} $(CFLAGS) $(COPT_FLAGS) $(if $(findstring $@,$(ST_NOPROF_OBJS)),,${CFLAGS_BPROFILE}) -c $< -o $@ |
|---|
| 225 | ifeq ($(SYSTEM),vxworks) |
|---|
| 226 | ifneq ($(vxWorksVersion),6) |
|---|
| 227 | -${Q_}$(MV) $(patsubst %.c,%.d,$(notdir $< )) ${ODIR} |
|---|
| 228 | endif |
|---|
| 229 | endif |
|---|
| 230 | |
|---|
| 231 | ifeq ($(SYSTEM),linux) |
|---|
| 232 | ifeq ($(BCHP_CHIP),7038) |
|---|
| 233 | $(ODIR)/%.so : COPT_FLAGS=$(if $(findstring $@,$(SH_OPT_OBJS)),-O3 -mips32,) |
|---|
| 234 | endif |
|---|
| 235 | endif |
|---|
| 236 | $(ODIR)/%.so : %.c ${ODIR_FLAG} |
|---|
| 237 | @echo [Compile... $(notdir $<)] |
|---|
| 238 | ${Q_}$(CC) ${CDEP_FLAG} ${CFLAGS_SHARED} $(CFLAGS) $(COPT_FLAGS) $(if $(findstring $@,$(SH_NOPROF_OBJS)),,${CFLAGS_BPROFILE}) -c $< -o $@ |
|---|
| 239 | ifeq ($(SYSTEM),vxworks) |
|---|
| 240 | ifneq ($(vxWorksVersion),6) |
|---|
| 241 | -${Q_}$(MV) $(patsubst %.c,%.d,$(notdir $< )) ${ODIR} |
|---|
| 242 | endif |
|---|
| 243 | endif |
|---|
| 244 | |
|---|
| 245 | |
|---|
| 246 | # Implicit C++ Compile Rule |
|---|
| 247 | $(ODIR)/%.o : %.cpp ${ODIR_FLAG} |
|---|
| 248 | @echo [Compile... $(notdir $<)] |
|---|
| 249 | ${Q_}$(CC) ${CDEP_FLAG} ${CPPFLAGS_STATIC} $(CPPFLAGS) -c $< -o $@ |
|---|
| 250 | |
|---|
| 251 | # Implicit C++ Compile Rule |
|---|
| 252 | $(ODIR)/%.so : %.cpp ${ODIR_FLAG} |
|---|
| 253 | @echo [Compile... $(notdir $<)] |
|---|
| 254 | ${Q_}$(CC) ${CDEP_FLAG} ${CPPFLAGS_SHARED} $(CPPFLAGS) -c $< -o $@ |
|---|
| 255 | |
|---|
| 256 | # Determine whether or not to print rm operations |
|---|
| 257 | ifneq ($(VERBOSE),) |
|---|
| 258 | RMOPTS := -v |
|---|
| 259 | else |
|---|
| 260 | RMOPTS := |
|---|
| 261 | endif |
|---|
| 262 | |
|---|
| 263 | ifeq ($(SYSTEM),vxworks) |
|---|
| 264 | #ifneq ($(vxWorksVersion),6) |
|---|
| 265 | # For tests and utils we need a rule that doesn't include the ODIR (the objects build in the currect working directory). |
|---|
| 266 | # This is mainly for VxWorks 5.5 compiler (defaults to putting the .o and the .d in the current working directory. |
|---|
| 267 | # Implicit C Compile Rule |
|---|
| 268 | %.o : %.c |
|---|
| 269 | @echo === Compiling $< |
|---|
| 270 | ${Q_}$(CC) ${CDEP_FLAG} ${CFLAGS_STATIC} $(CFLAGS) -c $< -o $@ |
|---|
| 271 | #endif |
|---|
| 272 | endif |
|---|
| 273 | |
|---|
| 274 | ifdef APP |
|---|
| 275 | APP_OBJS = $(SRCS:%.c=${ODIR}/%.o) |
|---|
| 276 | APP_OPT_OBJS = $(OPTIMIZE_SRCS:%.c=${ODIR}/%.o) |
|---|
| 277 | |
|---|
| 278 | ifeq ($(SYSTEM),vxworks) |
|---|
| 279 | APP_IMAGE = ${ODIR}/${APP}.out |
|---|
| 280 | else |
|---|
| 281 | ifeq ($(SYSTEM),linuxkernel) |
|---|
| 282 | ifeq ($(LINUX_VER_GE_2_6),y) |
|---|
| 283 | #OBJS += umdrv.mod.o |
|---|
| 284 | CFLAGS += -DKBUILD_MODNAME=${APP} |
|---|
| 285 | MOD_EXT = ko |
|---|
| 286 | else |
|---|
| 287 | MOD_EXT = o |
|---|
| 288 | endif |
|---|
| 289 | APP_IMAGE = ${ODIR}/${APP}.${MOD_EXT} |
|---|
| 290 | else |
|---|
| 291 | APP_IMAGE = ${ODIR}/${APP} |
|---|
| 292 | endif |
|---|
| 293 | endif |
|---|
| 294 | |
|---|
| 295 | application: $(OTHER_MAKES) ${ODIR} ${APP_IMAGE} |
|---|
| 296 | |
|---|
| 297 | ifneq ($(SYM_SRC),) |
|---|
| 298 | SYM_OBJ = $(SYM_SRC:%.c=$(ODIR)/%.o) |
|---|
| 299 | SYM_INC = $(SYM_SRC:%.c=$(ODIR)/%.inc) |
|---|
| 300 | |
|---|
| 301 | OBJS += ${SYM_OBJ} |
|---|
| 302 | |
|---|
| 303 | ifeq ($(SYSTEM),linuxkernel) |
|---|
| 304 | ${SYM_OBJ} : ${SYM_SRC} $(filter-out ${SYM_OBJ},${OBJS}) ${APP_OBJS} |
|---|
| 305 | @echo [Symbols... $(notdir $<)] |
|---|
| 306 | ${Q_}# compile empty sym-table and link with it |
|---|
| 307 | ${Q_}${RM) ${SYM_INC} |
|---|
| 308 | ${Q_}echo '/* */' >${SYM_INC} |
|---|
| 309 | ${Q_}$(CC) ${CFLAGS_STATIC} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 310 | ${Q_}$(LD) ${LDFLAGS} $(OBJS) ${APP_OBJS} ${LIBS} -o ${APP_IMAGE}.sym |
|---|
| 311 | ${Q_}# compile with real sym-table but possibly wrong offsets |
|---|
| 312 | ${Q_}${RM) ${SYM_INC} |
|---|
| 313 | ${Q_}${NM} -f bsd -n --defined-only ${APP_IMAGE}.sym|${AWK} '/.* [Tt] .*/ {printf "B_SYM(0x%su,%s)\n",$$1,$$3}' >${SYM_INC} |
|---|
| 314 | ${Q_}$(CC) ${CFLAGS_STATIC} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 315 | ${Q_}$(LD) ${LDFLAGS} $(OBJS) ${APP_OBJS} ${LIBS} -o ${APP_IMAGE}.sym |
|---|
| 316 | ${Q_}# build real symtable and compile with it |
|---|
| 317 | ${Q_}${RM) ${SYM_INC} |
|---|
| 318 | ${Q_}${NM} -f bsd -n --defined-only ${APP_IMAGE}.sym|${AWK} '/.* [Tt] .*/ {printf "B_SYM(0x%su,%s)\n",$$1,$$3}' >${SYM_INC} |
|---|
| 319 | ${Q_}$(CC) ${CFLAGS_STATIC} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 320 | ${Q_}${MV} ${SYM_INC} $(SYM_INC:%.inc=%.sym) |
|---|
| 321 | else |
|---|
| 322 | ${SYM_OBJ} : ${SYM_SRC} $(filter-out ${SYM_OBJ},${OBJS}) ${APP_OBJS} |
|---|
| 323 | @echo [Symbols... $(notdir $<)] |
|---|
| 324 | ${Q_}# compile empty sym-table and link with it |
|---|
| 325 | ${Q_}${RM) ${SYM_INC} |
|---|
| 326 | ${Q_}echo '/* */' >${SYM_INC} |
|---|
| 327 | ${Q_}$(CC) ${CFLAGS_STATIC} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 328 | ${Q_}$(CC) $(OBJS) ${APP_OBJS} $(LDFLAGS) ${LIBS} -o ${APP_IMAGE}.sym |
|---|
| 329 | ${Q_}# compile with real sym-table but possibly wrong offsets |
|---|
| 330 | ${Q_}${RM) ${SYM_INC} |
|---|
| 331 | ${Q_}${NM} -f bsd -n --defined-only ${APP_IMAGE}.sym|${AWK} '/.* [Tt] .*/ {printf "B_SYM(0x%su,%s)\n",$$1,$$3}' >${SYM_INC} |
|---|
| 332 | ${Q_}$(CC) ${CFLAGS_STATIC} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 333 | ${Q_}$(CC) $(OBJS) ${APP_OBJS} $(LDFLAGS) ${LIBS} -o ${APP_IMAGE}.sym |
|---|
| 334 | ${Q_}# build real symtable and compile with it |
|---|
| 335 | ${Q_}${RM) ${SYM_INC} |
|---|
| 336 | ${Q_}${NM} -f bsd -n --defined-only ${APP_IMAGE}.sym|${AWK} '/.* [Tt] .*/ {printf "B_SYM(0x%su,%s)\n",$$1,$$3}' >${SYM_INC} |
|---|
| 337 | ${Q_}$(CC) ${CFLAGS_STATIC} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 338 | ${Q_}${MV} ${SYM_INC} $(SYM_INC:%.inc=%.sym) |
|---|
| 339 | endif |
|---|
| 340 | |
|---|
| 341 | endif |
|---|
| 342 | |
|---|
| 343 | # liveMedia library is compiled with C++, must link with C++ |
|---|
| 344 | ifeq ($(LIVEMEDIA_SUPPORT),y) |
|---|
| 345 | B_LINKER := $(CXX) |
|---|
| 346 | else |
|---|
| 347 | B_LINKER := $(CC) |
|---|
| 348 | endif |
|---|
| 349 | |
|---|
| 350 | $(APP_IMAGE): ${LIBS} $(OBJS) ${APP_OBJS} |
|---|
| 351 | @echo [Linking... $(notdir $@)] |
|---|
| 352 | ifeq ($(SYSTEM),linuxkernel) |
|---|
| 353 | ${Q_}$(LD) ${LDFLAGS} $(OBJS) ${APP_OBJS} ${LIBS} -o $@ |
|---|
| 354 | else |
|---|
| 355 | ${Q_}$(B_LINKER) $(OBJS) ${APP_OBJS} $(LDFLAGS) ${LIBS} -o $@ |
|---|
| 356 | endif |
|---|
| 357 | |
|---|
| 358 | target-clean: |
|---|
| 359 | ${Q_}${RM} ${RMOPTS} ${APP_IMAGE} |
|---|
| 360 | |
|---|
| 361 | endif |
|---|
| 362 | |
|---|
| 363 | ifdef LIB |
|---|
| 364 | ifeq (${SYSTEM},vxworks) |
|---|
| 365 | SH_LIB = ${ODIR}/lib$(LIB).out |
|---|
| 366 | else |
|---|
| 367 | SH_LIB = ${ODIR}/lib$(LIB).so |
|---|
| 368 | endif |
|---|
| 369 | SH_MAP = ${ODIR}/lib$(LIB).map |
|---|
| 370 | ST_LIB = ${ODIR}/lib$(LIB).a |
|---|
| 371 | |
|---|
| 372 | .PHONY: shared static |
|---|
| 373 | shared: $(OTHER_MAKES) ${ODIR} ${SH_LIB} |
|---|
| 374 | static: $(OTHER_MAKES) ${ODIR} ${ST_LIB} |
|---|
| 375 | |
|---|
| 376 | SH_OBJS = $(SRCS:%.c=${ODIR}/%.so) |
|---|
| 377 | ST_OBJS = $(SRCS:%.c=${ODIR}/%.o) |
|---|
| 378 | |
|---|
| 379 | ifneq ($(SYM_SRC),) |
|---|
| 380 | SYM_OBJ = $(SYM_SRC:%.c=$(ODIR)/%.so) |
|---|
| 381 | SYM_INC = $(SYM_SRC:%.c=$(ODIR)/%.inc) |
|---|
| 382 | |
|---|
| 383 | SH_OBJS += ${SYM_OBJ} |
|---|
| 384 | |
|---|
| 385 | ${SYM_OBJ} : ${SYM_SRC} $(filter-out ${SYM_OBJ},${SH_OBJS}) |
|---|
| 386 | @echo [Symbols... $(notdir $<)] |
|---|
| 387 | ${Q_}# compile empty sym-table and link with it |
|---|
| 388 | ${Q_}${RM) ${SYM_INC} |
|---|
| 389 | ${Q_}echo '/* */' >${SYM_INC} |
|---|
| 390 | ${Q_}$(CC) ${CFLAGS_SHARED} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 391 | ${Q_}$(CC) ${LDFLAGS} -shared -o ${SH_LIB}.sym -Wl,-soname,lib${LIB}.so ${SH_OBJS} ${LIBS} ${CRYPTO_LDFLAGS} ${DIVX_DRM_LIBS} |
|---|
| 392 | ${Q_}# compile with real sym-table but possibly wrong offsets |
|---|
| 393 | ${Q_}${RM) ${SYM_INC} |
|---|
| 394 | ${Q_}${NM} -f bsd -n --defined-only ${SH_LIB}.sym|${AWK} '/.* [Tt] .*/ {printf "B_SYM(0x%su,%s)\n",$$1,$$3}' >${SYM_INC} |
|---|
| 395 | ${Q_}$(CC) ${CFLAGS_SHARED} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 396 | ${Q_}$(CC) ${LDFLAGS} -shared -o ${SH_LIB}.sym -Wl,-soname,lib${LIB}.so ${SH_OBJS} ${LIBS} ${CRYPTO_LDFLAGS} ${DIVX_DRM_LIBS} |
|---|
| 397 | ${Q_}# build real symtable and compile with it |
|---|
| 398 | ${Q_}${RM) ${SYM_INC} |
|---|
| 399 | ${Q_}${NM} -f bsd -n --defined-only ${SH_LIB}.sym|${AWK} '/.* [Tt] .*/ {printf "B_SYM(0x%su,%s)\n",$$1,$$3}' >${SYM_INC} |
|---|
| 400 | ${Q_}$(CC) ${CFLAGS_SHARED} -I${ODIR} $(CFLAGS) $(COPT_FLAGS) -c $< -o $@ |
|---|
| 401 | ${Q_}${MV} ${SYM_INC} $(SYM_INC:%.inc=%.sym) |
|---|
| 402 | |
|---|
| 403 | endif |
|---|
| 404 | |
|---|
| 405 | SH_OPT_OBJS = $(OPTIMIZE_SRCS:%.c=${ODIR}/%.so) |
|---|
| 406 | ST_OPT_OBJS = $(OPTIMIZE_SRCS:%.c=${ODIR}/%.o) |
|---|
| 407 | SH_NOPROF_OBJS = $(NOPROFILE_SRCS:%.c=${ODIR}/%.so) |
|---|
| 408 | ST_NOPROF_OBJS = $(NOPROFILE_SRCS:%.c=${ODIR}/%.o) |
|---|
| 409 | |
|---|
| 410 | |
|---|
| 411 | ${SH_LIB}: ${SH_OBJS} $(LIBS) |
|---|
| 412 | @echo [Linking... $(notdir $@)] |
|---|
| 413 | ifeq (${SYSTEM},vxworks) |
|---|
| 414 | ${Q_}$(CC) ${LDFLAGS} -nostdlib -r -Wl,-Map,${SH_MAP} -Wl,-EB -Wl,-X -o $@ -Wl,-soname,lib${LIB}.so ${SH_OBJS} ${CRYPTO_LDFLAGS} ${DIVX_DRM_LIBS} |
|---|
| 415 | else |
|---|
| 416 | ${Q_}$(CC) ${LDFLAGS} -shared -Wl,-Map,${SH_MAP} -Wl,--cref -o $@ -Wl,-soname,lib${LIB}.so ${SH_OBJS} ${LIBS} ${CRYPTO_LDFLAGS} ${DIVX_DRM_LIBS} |
|---|
| 417 | ifneq (${CMD_BUILD_DONE},) |
|---|
| 418 | ${Q_}${CMD_BUILD_DONE} ${SH_LIB} ${SH_MAP} |
|---|
| 419 | endif |
|---|
| 420 | endif |
|---|
| 421 | |
|---|
| 422 | ${ST_LIB}: ${ST_OBJS} |
|---|
| 423 | @echo [Linking... $(notdir $@)] |
|---|
| 424 | ${Q_}$(RM) $@ |
|---|
| 425 | ${Q_}$(AR) cr $@ $(ST_OBJS) ${CRYPTO_LDFLAGS} ${DIVX_DRM_LIBS} |
|---|
| 426 | ${Q_}$(RANLIB) $@ |
|---|
| 427 | |
|---|
| 428 | target-clean: |
|---|
| 429 | ${Q_}${RM} ${RMOPTS} ${SH_LIB} ${ST_LIB} |
|---|
| 430 | |
|---|
| 431 | endif |
|---|
| 432 | |
|---|
| 433 | # Dependency file checking (created with gcc -M command) |
|---|
| 434 | -include $(ODIR)/*.d |
|---|
| 435 | |
|---|
| 436 | # Clean Rules |
|---|
| 437 | # Use OTHER_CLEANS to extend the clean rule for app-specific stuff. |
|---|
| 438 | # It's ok to leave it undefined. |
|---|
| 439 | |
|---|
| 440 | .PHONY: clean target-clean veryclean $(OTHER_CLEANS) |
|---|
| 441 | clean: target-clean $(OTHER_CLEANS) |
|---|
| 442 | ifdef OBJS |
|---|
| 443 | ${Q_}$(RM) ${RMOPTS} $(OBJS) |
|---|
| 444 | ${Q_}$(RM) ${RMOPTS} $(OBJS:%.o=%.d) |
|---|
| 445 | endif |
|---|
| 446 | ifdef APP_OBJS |
|---|
| 447 | ${Q_}$(RM) ${RMOPTS} $(APP_OBJS) |
|---|
| 448 | ${Q_}$(RM) ${RMOPTS} $(APP_OBJS:%.o=%.d) |
|---|
| 449 | endif |
|---|
| 450 | ifdef SH_OBJS |
|---|
| 451 | ${Q_}$(RM) ${RMOPTS} $(SH_OBJS) |
|---|
| 452 | ${Q_}$(RM) ${RMOPTS} $(SH_OBJS:%.so=%.d) |
|---|
| 453 | endif |
|---|
| 454 | ifdef ST_OBJS |
|---|
| 455 | ${Q_}$(RM) ${RMOPTS} $(ST_OBJS) |
|---|
| 456 | ${Q_}$(RM) ${RMOPTS} $(ST_OBJS:%.o=%.d) |
|---|
| 457 | endif |
|---|
| 458 | |
|---|
| 459 | veryclean: clean |
|---|
| 460 | ifdef ODIR |
|---|
| 461 | ifeq ($(vxWorksVersion),6) |
|---|
| 462 | # VxWorks 6 command shell can't handle long commands (sic) -- need to do this in steps. |
|---|
| 463 | # By doing these deletes first, the wildcards below will have less files to delete and thus shorter command line. |
|---|
| 464 | -@$(RM) ${RMOPTS} $(ODIR)/*.o |
|---|
| 465 | -@$(RM) ${RMOPTS} $(ODIR)/*.d |
|---|
| 466 | -@$(RM) ${RMOPTS} $(ODIR)/*.so |
|---|
| 467 | endif |
|---|
| 468 | -@$(RM) ${RMOPTS} $(ODIR)/* |
|---|
| 469 | -@$(RM) -r ${RMOPTS} $(ODIR) |
|---|
| 470 | endif |
|---|
| 471 | |
|---|
| 472 | ifneq ($(SYSTEM),vxworks) |
|---|
| 473 | ifneq ($(ODIR),.) |
|---|
| 474 | ${ODIR_FLAG}: ${ODIR} |
|---|
| 475 | endif |
|---|
| 476 | endif |
|---|
| 477 | |
|---|
| 478 | $(ODIR): |
|---|
| 479 | ${Q_}$(MKDIR) "$(ODIR)" |
|---|
| 480 | ifneq ($(SYSTEM),vxworks) |
|---|
| 481 | ${Q_}${TOUCH} "${ODIR_FLAG}" |
|---|
| 482 | endif |
|---|
| 483 | |
|---|