| 1 | ############################################################ |
|---|
| 2 | # (c)2003-2011 Broadcom Corporation |
|---|
| 3 | # |
|---|
| 4 | # This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | # and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | # conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | # (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | # no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | # Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | # intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | # HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | # NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | # |
|---|
| 14 | # Except as expressly set forth in the Authorized License, |
|---|
| 15 | # |
|---|
| 16 | # 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | # secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | # and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | # |
|---|
| 20 | # 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | # AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | # WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | # THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | # OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | # LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | # OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | # USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | # |
|---|
| 29 | # 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | # LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | # EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | # USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | # THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | # ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | # LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | # ANY LIMITED REMEDY. |
|---|
| 37 | # |
|---|
| 38 | # $brcm_Workfile: Makefile $ |
|---|
| 39 | # $brcm_Revision: 22 $ |
|---|
| 40 | # $brcm_Date: 9/22/11 12:27p $ |
|---|
| 41 | # |
|---|
| 42 | # Module Description: |
|---|
| 43 | # |
|---|
| 44 | # Revision History: |
|---|
| 45 | # |
|---|
| 46 | # Created: 08/28/2007 by Jon Garrett |
|---|
| 47 | # |
|---|
| 48 | # $brcm_Log: /nexus/utils/Makefile $ |
|---|
| 49 | # |
|---|
| 50 | # 22 9/22/11 12:27p jtna |
|---|
| 51 | # SW7425-1333: use MEDIA_RMFF_SUPPORT flag |
|---|
| 52 | # |
|---|
| 53 | # 21 4/27/11 6:20p vsilyaev |
|---|
| 54 | # SW7425-232: Promote ATOM module to separate component |
|---|
| 55 | # |
|---|
| 56 | # 20 1/28/11 2:35p jtna |
|---|
| 57 | # SW7422-232: merge Android changes |
|---|
| 58 | # |
|---|
| 59 | # 19 9/29/10 9:33a erickson |
|---|
| 60 | # SW7420-1123: add linux usermode IPC |
|---|
| 61 | # |
|---|
| 62 | # 18 9/8/10 12:05p vsilyaev |
|---|
| 63 | # SW7468-129: Added video decoder on ZSP |
|---|
| 64 | # |
|---|
| 65 | # 17 5/12/10 11:25a erickson |
|---|
| 66 | # SW7405-4162: cancel implicit compile&link rule so we can do two |
|---|
| 67 | # implicit rules to compile and link separately |
|---|
| 68 | # |
|---|
| 69 | # 16 4/2/10 2:26p erickson |
|---|
| 70 | # SW7405-4162: some bmedia, bfile and tspsi code is now built into nexus |
|---|
| 71 | # |
|---|
| 72 | # 15 4/1/10 2:19p erickson |
|---|
| 73 | # SW7405-3833: add NEXUS_PREBUILT_BINARY=y support |
|---|
| 74 | # |
|---|
| 75 | # 14 2/22/10 5:33p vsilyaev |
|---|
| 76 | # SW3556-913: Added option to plug Custom File I/O routines to inject |
|---|
| 77 | # errors |
|---|
| 78 | # |
|---|
| 79 | # 13 12/8/09 3:00p gmohile |
|---|
| 80 | # SW7408-1 : Add support for platforms with no frontend |
|---|
| 81 | # |
|---|
| 82 | # 12 10/27/09 3:43p erickson |
|---|
| 83 | # SW3548-2574: add video test app |
|---|
| 84 | # |
|---|
| 85 | # 11 9/16/09 1:42p erickson |
|---|
| 86 | # SW7400-2511: add B_REFSW_ or NEXUS_ namespace to build variables |
|---|
| 87 | # |
|---|
| 88 | # 10 6/16/09 5:13p jtna |
|---|
| 89 | # PR54802: added record |
|---|
| 90 | # |
|---|
| 91 | # 9 5/22/09 10:11a vsilyaev |
|---|
| 92 | # PR 48944: Removed unneded dependency |
|---|
| 93 | # |
|---|
| 94 | # 8 5/19/09 12:38p vsilyaev |
|---|
| 95 | # PR 48944: Fixed dependency on OBJDIR |
|---|
| 96 | # |
|---|
| 97 | # 7 5/4/09 2:38p erickson |
|---|
| 98 | # PR54807: added message util |
|---|
| 99 | # |
|---|
| 100 | # 6 3/19/09 10:54a erickson |
|---|
| 101 | # PR48944: allow for no ASF and no AVI |
|---|
| 102 | # |
|---|
| 103 | # 5 3/13/09 2:44p vsilyaev |
|---|
| 104 | # PR 53225: Adeed NEXUS_BIN_DIR_SUFFIX and NEXUS_BIN_DIR |
|---|
| 105 | # |
|---|
| 106 | # 4 2/5/09 2:08p erickson |
|---|
| 107 | # PR51151: update |
|---|
| 108 | # |
|---|
| 109 | # 3 2/5/09 1:49p erickson |
|---|
| 110 | # PR51151: added media probe option for playback |
|---|
| 111 | # |
|---|
| 112 | # 2 11/17/08 2:19p erickson |
|---|
| 113 | # PR48944: update |
|---|
| 114 | # |
|---|
| 115 | # 1 11/17/08 12:33p erickson |
|---|
| 116 | # PR48944: add utils |
|---|
| 117 | # |
|---|
| 118 | ############################################################ |
|---|
| 119 | # Nexus examples |
|---|
| 120 | |
|---|
| 121 | ifdef COMSPEC |
|---|
| 122 | # Any DOS environment |
|---|
| 123 | NEXUS_TOP := $(shell cd .. && cd) |
|---|
| 124 | else |
|---|
| 125 | NEXUS_TOP := $(shell cd ../; pwd) |
|---|
| 126 | endif |
|---|
| 127 | |
|---|
| 128 | ifndef PLATFORM |
|---|
| 129 | $(error PLATFORM is not defined) |
|---|
| 130 | endif |
|---|
| 131 | |
|---|
| 132 | ifeq ($(NEXUS_PREBUILT_BINARY),y) |
|---|
| 133 | # do "make api" and "make nexus_headers" first, then "make NEXUS_PREBUILT_BINARY=y" |
|---|
| 134 | include $(NEXUS_TOP)/bin/include/platform_app.inc |
|---|
| 135 | Q_ ?= @ |
|---|
| 136 | else |
|---|
| 137 | # include cross-compiler definitions |
|---|
| 138 | include $(NEXUS_TOP)/platforms/$(PLATFORM)/build/platform_app.inc |
|---|
| 139 | endif |
|---|
| 140 | |
|---|
| 141 | THEAPPS = \ |
|---|
| 142 | playback \ |
|---|
| 143 | message \ |
|---|
| 144 | record |
|---|
| 145 | |
|---|
| 146 | ifneq ($(filter $(PLATFORM), 97408),$(PLATFORM)) |
|---|
| 147 | THEAPPS += decode \ |
|---|
| 148 | video |
|---|
| 149 | endif |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | ifeq ($(B_REFSW_OS),vxworks) |
|---|
| 153 | # VxWorks needs a wrapper function to call main. |
|---|
| 154 | VXOBJS = vxworks_cmd.o |
|---|
| 155 | # We like to use .out for loadable objects. |
|---|
| 156 | APPSUFFIX = .out |
|---|
| 157 | APPS = $(addsuffix .out, $(THEAPPS)) |
|---|
| 158 | else |
|---|
| 159 | ifeq ($(B_REFSW_OS),linuxkernel) |
|---|
| 160 | APPSUFFIX = .ko |
|---|
| 161 | APPS = $(addsuffix ${APPSUFFIX}, $(THEAPPS)) |
|---|
| 162 | else |
|---|
| 163 | APPS = $(THEAPPS) |
|---|
| 164 | endif |
|---|
| 165 | endif |
|---|
| 166 | |
|---|
| 167 | .PHONY: api clean |
|---|
| 168 | OBJDIR=./obj |
|---|
| 169 | |
|---|
| 170 | all: $(APPS) |
|---|
| 171 | |
|---|
| 172 | $(OBJDIR)/exists: |
|---|
| 173 | mkdir -p $(OBJDIR) |
|---|
| 174 | @touch $@ |
|---|
| 175 | |
|---|
| 176 | ifneq ($(NEXUS_PREBUILT_BINARY),y) |
|---|
| 177 | $(APPS): api |
|---|
| 178 | endif |
|---|
| 179 | |
|---|
| 180 | ifneq ($(findstring linux,$(B_REFSW_OS)),) |
|---|
| 181 | LDFLAGS := -lnexus${NEXUS_LIB_SUFFIX} -L${NEXUS_BIN_DIR} -lpthread -lm |
|---|
| 182 | endif |
|---|
| 183 | |
|---|
| 184 | # For VxWorks builds, link in the nexus library. |
|---|
| 185 | ifeq ($(B_REFSW_OS),vxworks) |
|---|
| 186 | LDFLAGS := -lnexus${NEXUS_LIB_SUFFIX} -L${NEXUS_BIN_DIR} |
|---|
| 187 | endif |
|---|
| 188 | |
|---|
| 189 | # For Android builds |
|---|
| 190 | ifeq ($(B_REFSW_ANDROID),y) |
|---|
| 191 | |
|---|
| 192 | # The following script assumes the gcc version number is the last field on the first line |
|---|
| 193 | GCC_VERSION ?= $(shell $(CC) --version | $(AWK) 'NR == 1 { print $$NF }') |
|---|
| 194 | |
|---|
| 195 | ANDROID_LIB = $(ANDROID)/out/target/product/bcm$(BCHP_CHIP)/obj/lib |
|---|
| 196 | LDFLAGS := -EL \ |
|---|
| 197 | -lnexus${NEXUS_LIB_SUFFIX} -L${NEXUS_BIN_DIR} $(EXTRA_DRM_OBJS) \ |
|---|
| 198 | -Bdynamic \ |
|---|
| 199 | -Wl,-T,$(ANDROID)/build/core/mipself.x \ |
|---|
| 200 | -Wl,-dynamic-linker,/system/bin/linker \ |
|---|
| 201 | -Wl,--gc-sections \ |
|---|
| 202 | -Wl,-z,nocopyreloc \ |
|---|
| 203 | -Wl,--no-undefined \ |
|---|
| 204 | -Wl,-rpath-link=$(ANDROID_LIB) \ |
|---|
| 205 | -L$(ANDROID_LIB) \ |
|---|
| 206 | -nostdlib \ |
|---|
| 207 | $(ANDROID_LIB)/crtbegin_dynamic.o \ |
|---|
| 208 | $(B_REFSW_TOOLCHAIN_DIR)/lib/gcc/mipsel-linux-uclibc/$(GCC_VERSION)/libgcc.a \ |
|---|
| 209 | $(B_REFSW_TOOLCHAIN_DIR)/lib/gcc/mipsel-linux-uclibc/$(GCC_VERSION)/libgcc_eh.a \ |
|---|
| 210 | $(ANDROID_LIB)/crtend_android.o \ |
|---|
| 211 | -lc -lm |
|---|
| 212 | endif |
|---|
| 213 | |
|---|
| 214 | # This builds the Nexus api |
|---|
| 215 | api: |
|---|
| 216 | $(MAKE) -C $(NEXUS_TOP)/build |
|---|
| 217 | |
|---|
| 218 | # This cleans nexus and local apps |
|---|
| 219 | clean: clean_apps |
|---|
| 220 | $(MAKE) -C $(NEXUS_TOP)/build clean |
|---|
| 221 | |
|---|
| 222 | clean_apps: |
|---|
| 223 | -$(RM) -r $(APPS) $(OBJDIR) |
|---|
| 224 | |
|---|
| 225 | # This is the minimum needed to compile and link with Nexus |
|---|
| 226 | CFLAGS += $(NEXUS_CFLAGS) $(addprefix -I,$(NEXUS_APP_INCLUDE_PATHS)) $(addprefix -D,$(NEXUS_APP_DEFINES)) |
|---|
| 227 | |
|---|
| 228 | # Always build with debug |
|---|
| 229 | CFLAGS += -g |
|---|
| 230 | |
|---|
| 231 | # media probe (only needed for playback and record) |
|---|
| 232 | BSEAV = $(NEXUS_TOP)/../BSEAV |
|---|
| 233 | include $(BSEAV)/lib/bfile/bfile.inc |
|---|
| 234 | ifeq ($(MEDIA_AVI_SUPPORT),y) |
|---|
| 235 | include $(BSEAV)/lib/avi/bavi.inc |
|---|
| 236 | endif |
|---|
| 237 | ifeq ($(MEDIA_ASF_SUPPORT),y) |
|---|
| 238 | include $(BSEAV)/lib/asf/basf.inc |
|---|
| 239 | endif |
|---|
| 240 | ifeq ($(MEDIA_RMFF_SUPPORT),y) |
|---|
| 241 | include $(BSEAV)/lib/media/rmff/brmff.inc |
|---|
| 242 | endif |
|---|
| 243 | include $(BSEAV)/lib/utils/batom.inc |
|---|
| 244 | include $(BSEAV)/lib/media/bmedia.inc |
|---|
| 245 | CFLAGS += $(addprefix -I,$(BMEDIA_INCLUDES) $(BFILE_MEDIA_INCLUDES)) -I$(BSEAV)/lib/mpeg2_ts_parse -I$(BSEAV)/lib/tspsi |
|---|
| 246 | CFLAGS += $(addprefix -D,$(BMEDIA_PROBE_DEFINES)) |
|---|
| 247 | |
|---|
| 248 | DECODE_SRCS += ./cmdline_args.c ./fileio_custom.c |
|---|
| 249 | |
|---|
| 250 | DECODE_OBJS = $(foreach file, $(DECODE_SRCS), $(OBJDIR)/$(notdir $(patsubst %.c, %.o, $(file)))) |
|---|
| 251 | |
|---|
| 252 | vpath %.c $(foreach file, $(DECODE_SRCS) $(MESSAGE_SRCS), $(dir $(patsubst %.c, %.o, $(file)))) |
|---|
| 253 | |
|---|
| 254 | test: |
|---|
| 255 | @echo $(EXTRA_OBJS) |
|---|
| 256 | @echo $(foreach file, $(EXTRA_SRCS), $(dir $(patsubst %.c, %.o, $(file)))) |
|---|
| 257 | |
|---|
| 258 | $(OBJDIR)/%.o: %.c ${OBJDIR}/exists |
|---|
| 259 | @echo [Compile... $<] |
|---|
| 260 | $(Q_)$(CC) -c -o $@ $< $(CFLAGS) |
|---|
| 261 | |
|---|
| 262 | # this is not implicit because we don't link in $(DECODE_OBJS) |
|---|
| 263 | message: $(OBJDIR)/message.o $(VXOBJS) |
|---|
| 264 | @echo [Link... $@] |
|---|
| 265 | ifeq ($(B_REFSW_OS),linuxkernel) |
|---|
| 266 | ${Q_}$(LD) ${LDFLAGS} --strip-debug -r $(filter %.o, $^) ${NEXUS_BIN_DIR}/libnexus.a -o $@ |
|---|
| 267 | else |
|---|
| 268 | $(Q_)$(CC) -o $@ $(filter %.o, $^) $(LDFLAGS) |
|---|
| 269 | endif |
|---|
| 270 | cp $@ ${NEXUS_BIN_DIR} |
|---|
| 271 | |
|---|
| 272 | # cancel this implicit rule so we can do separate compile & link w/ implicit rules |
|---|
| 273 | %: %.c |
|---|
| 274 | |
|---|
| 275 | %: $(OBJDIR)/%.o $(DECODE_OBJS) $(VXOBJS) |
|---|
| 276 | @echo [Link... $@] |
|---|
| 277 | ifeq ($(B_REFSW_OS),linuxkernel) |
|---|
| 278 | ${Q_}$(LD) ${LDFLAGS} --strip-debug -r $(filter %.o, $^) ${NEXUS_BIN_DIR}/libnexus.a -o $@ |
|---|
| 279 | else |
|---|
| 280 | $(Q_)$(CC) -o $@ $(filter %.o, $^) $(LDFLAGS) |
|---|
| 281 | endif |
|---|
| 282 | cp $@ ${NEXUS_BIN_DIR} |
|---|
| 283 | |
|---|
| 284 | ifeq ($(B_REFSW_OS),vxworks) |
|---|
| 285 | # Explicit rule for building vxworks wrapper app |
|---|
| 286 | vxworks_cmd.o: vxworks_cmd.c |
|---|
| 287 | @echo [Compile... $<] |
|---|
| 288 | $(Q_)$(CC) -o $@ $< $(CFLAGS) |
|---|
| 289 | endif |
|---|
| 290 | |
|---|
| 291 | install: all |
|---|
| 292 | |
|---|