1 2################################################################################ 3# 4# Copyright (c) 2008-2009 MStar Semiconductor, Inc. 5# All rights reserved. 6# 7# Unless otherwise stipulated in writing, any and all information contained 8# herein regardless in any format shall remain the sole proprietary of 9# MStar Semiconductor Inc. and be kept in strict confidence 10# ("MStar Confidential Information") by the recipient. 11# Any unauthorized act including without limitation unauthorized disclosure, 12# copying, use, reproduction, sale, distribution, modification, disassembling, 13# reverse engineering and compiling of the contents of MStar Confidential 14# Information is unlawful and strictly prohibited. MStar hereby reserves the 15# rights to any and all damages, losses, costs and expenses resulting therefrom. 16# 17# 18# Makefile used for building DDI 19# 20# 21################################################################################ 22 23export 24unexport DRV_DIR 25unexport API_SRC 26unexport API_CC_INCS 27unexport VPATH 28 29 30# ********************************************** 31# DRV Name 32# ********************************************** 33#API_NAME = aaa 34 35# ********************************************** 36# DRV Source Files 37# ********************************************** 38#DRV_DIR = \ 39# ddd \ 40 41 42# ********************************************** 43# Rules 44# ********************************************** 45LIB_NAME = api$(API_NAME) 46 47ifeq ($(API_NAME),HDMITX) 48ifeq ($(CHIP),keltic) 49API_SRC = $(filter-out $(wildcard $(CURDIR)/apiHDMITx.c), $(wildcard $(CURDIR)/*.c)) 50else 51API_SRC = $(filter-out $(wildcard $(CURDIR)/apiHDMITx_Wrap.c), $(wildcard $(CURDIR)/*.c)) 52endif 53else 54API_SRC = $(wildcard $(CURDIR)/*.c) 55endif 56 57API_OBJ = $(foreach file, $(notdir $(patsubst %.c, %.o, $(API_SRC))), $(OBJ_PATH)/$(file)) 58API_IMPORT_SRC = $(wildcard $(CURDIR)/obj_import/$(OS_TYPE)/$(MCU_TYPE)/*.src) 59API_IMPORT_OBJ = $(foreach file, $(notdir $(patsubst %.src, %.o, $(API_IMPORT_SRC))), $(OBJ_PATH)/$(file)) 60API_INCDIR = $(foreach dir,$(DRV_DIR),$(DDIDRV)/$(dir)) 61API_CC_INCS = $(foreach dir,$(API_INCDIR),-I$(dir) -I$(PUBINC)) 62 63ifeq ($(MAKE_TYPE),lint) 64ifeq ($(shell uname -o),Cygwin) 65LINT_INC += $(foreach dir,$(shell cygpath -m $(API_INCDIR)),-i"$(dir)") 66else 67LINT_INC += $(foreach dir,$(API_INCDIR),-i"$(dir)") 68endif 69endif 70 71VPATH = 72 73ifeq ("$(UTOPIA_BSP_VERSION)", "") 74UTOPIA_BSP_VERSION = 000000 75endif 76 77ifeq ("$(P4PORT)", "") 78SW_VERSION_API_$(API_NAME) = 0 79else 80SW_VERSION_API_$(API_NAME) := $(shell p4 changes -m1 "./...\#have" | egrep Change | awk '{print $$2}') 81ifeq ("$(SW_VERSION_API_$(API_NAME))", "") 82SW_VERSION_API_$(API_NAME) = 0 83endif 84endif 85SW_API_FLOW_ENABLE = TRUE 86CC_DEFS += -DSW_VERSION_API_$(API_NAME)=$(SW_VERSION_API_$(API_NAME)) 87 88VDEC_USE_NEW_LAYOUT = nike madison miami edison eiffel einstein einstein3 napoli kaiser monaco munich keres kirin clippers muji monet manhattan messi maserati maxim kano curry k6 k6lite k7u M7821 M7621 89ifeq ($(CHIP), $(filter $(CHIP),$(VDEC_USE_NEW_LAYOUT))) 90CC_DEFS += -DSUPPORT_NEW_MEM_LAYOUT 91#CC_DEFS += -DSUPPORT_NEW_VDEC_FLOW # Use old layout but with new share mem handshake flow 92endif 93 94#ifeq ($(V3_DECODE),true) 95CC_DEFS += -DVDEC3 96CC_DEFS += -DVDEC3_FB 97#endif 98 99# Note: Use old layout *CANNOT* enable EVD 100VDEC_SUPPORT_EVD = einstein napoli madison monaco munich keres kirin clippers muji monet manhattan messi maserati maxim kano curry k6 k6lite k7u M7821 M7621 101ifeq ($(CHIP), $(filter $(CHIP),$(VDEC_SUPPORT_EVD))) 102CC_DEFS += -DSUPPORT_EVD=1 103else 104CC_DEFS += -DSUPPORT_EVD=0 105endif 106 107VDEC_SUPPORT_G2VP9 = monaco muji 108ifeq ($(CHIP), $(filter $(CHIP),$(VDEC_SUPPORT_G2VP9))) 109CC_DEFS += -DSUPPORT_G2VP9=1 110else 111CC_DEFS += -DSUPPORT_G2VP9=0 112endif 113 114VDEC_SUPPORT_MSVP9 = manhattan messi maserati maxim kano curry k6 k6lite k7u M7821 M7621 115ifeq ($(CHIP), $(filter $(CHIP),$(VDEC_SUPPORT_MSVP9))) 116CC_DEFS += -DSUPPORT_MSVP9=1 117else 118CC_DEFS += -DSUPPORT_MSVP9=0 119endif 120 121.NOTPARALLEL : hvd_v3 mjpeg_v3 mvd_v3 122.PHONY : all clean $(DRV_DIR) depend 123 124all : $(API_OBJ) $(API_IMPORT_OBJ) $(DRV_DIR) 125 126lib : setup all 127ifeq ($(OS_TYPE),nos) 128endif 129ifeq ($(OS_TYPE),linux) 130ifeq ($(PLATFORM),android) 131endif 132endif 133 134ifeq ($(LINK_TYPE),dynamic) 135 ifeq ($(CONFIG_INCREMENTAL_BUILD),y) 136 @$(CC) $(CFG_CC_OPTS) $(LD_LIBS_INC) $(LD_OPTS) $(wildcard $(OBJ_PATH)/$(LIB_NAME)_T/*.T) $(API_OBJ) $(API_IMPORT_OBJ) $(HAL_IMPORT_OBJ) $(MLOG_LIB_PATH) -o $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) ; 137 ifeq ($(CONFIG_VERSION_INFO_EMBADE), y) 138 @sh $(VERSION)/versionembadder.sh $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT).temp ./version_info 139 @rm -f $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 140 @mv -f $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT).temp $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 141 endif 142 else 143 @$(CC) $(CFG_CC_OPTS) $(LD_OPTS) $(wildcard $(OBJ_PATH)/$(LIB_NAME)_T/*.T) $(API_OBJ) $(API_IMPORT_OBJ) $(MLOG_LIB_PATH) -o $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) ; 144 @$(OBJCOPY) --add-section .mmodule_version=./version_info $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 145 ifeq ($(CONFIG_VERSION_INFO_EMBADE), y) 146 @sh $(VERSION)/versionembadder.sh $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT).temp ./version_info 147 @rm -f $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 148 @mv -f $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT).temp $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 149 endif 150 endif 151# @rm -f $(OBJ_PATH)/*.T 152endif 153 154ifeq ($(TOOLCHAIN),mips-linux-gnu) 155ifeq ($(OS_TYPE),nos) 156SW_MBOOT_FLOW = TRUE 157endif 158endif 159 160$(DRV_DIR) : 161ifeq ($(LINK_TYPE),dynamic) 162 @$(MAKE) BUILDING_API=1 -s -C $(DDIDRV)/$@ 163else 164 @$(MAKE) -C $(DDIDRV)/$@ 165endif 166 167$(API_IMPORT_OBJ) : 168 echo find api import_obj cp from $(filter %$(notdir $*).src,$(API_IMPORT_SRC)) to $@ 169 cp $(filter %$(notdir $*).src,$(API_IMPORT_SRC)) $@ 170ifneq ($(LINK_TYPE),dynamic) 171 @$(AR) cru $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) $@; 172 ifeq ($(CONFIG_VERSION_INFO_EMBADE), y) 173 @sh $(VERSION)/versionembadder.sh $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT).temp ./version_info 174 @rm -f $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 175 @mv -f $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT).temp $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 176 endif 177ifeq ($(BLT_TYPE),retail) 178 @$(STRIP) -S $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 179endif 180endif 181 182$(API_OBJ) : $(OBJ_PATH)/%.o : %.c 183ifneq ($(MAKE_TYPE),lint) 184 @echo [CC] $(notdir $<) 185 @$(CC) $(CC_OPTS) $(CC_DEFS) $(CC_INCS) $(API_CC_INCS) -o $@ $<; 186ifneq ($(LINK_TYPE),dynamic) 187 @$(AR) cru $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) $@; 188 ifeq ($(CONFIG_VERSION_INFO_EMBADE), y) 189 @sh $(VERSION)/versionembadder.sh $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT).temp ./version_info 190 @rm -f $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 191 @mv -f $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT).temp $(DDI_PATH)/lib$(LIB_NAME).$(LIB_EXT) 192 endif 193endif 194else 195 @echo [LINT] $(notdir $<) 196ifeq ($(shell uname -o),Cygwin) 197 @$(LINT_CMD) $(CC_DEFS) $(LINT_INC) $(shell cygpath -m $<) >>$(LINT_LOG) 198# echo $(shell cygpath -m $<) >>$(LINT_FILES) 199else 200 @$(LINT_CMD) $(CC_DEFS) $(LINT_INC) $< >>$(LINT_LOG) 201# echo $< >>$(LINT_FILES) 202endif 203endif 204 205ifeq ($(PARA), 1) 206 @if [ ! -f $(CURDIR)/cpptestscan.bdf ]; then \ 207 echo ERROR! No $(CURDIR)/cpptestscan.bdf; \ 208 fi 209 @if [ -f $(CURDIR)/cpptestscan.bdf ]; then \ 210 cat $(CURDIR)/cpptestscan.bdf >> $(PROJ)/cpptestscan.bdf; \ 211 rm -f $(CURDIR)/cpptestscan.bdf; \ 212 fi 213endif 214 215setup : 216ifeq ($(LINK_TYPE),dynamic) 217 @echo [api_rule.mk][lib$(LIB_NAME).$(LIB_EXT)] 218# @rm -f $(OBJ_PATH)/*.T 219else 220 @echo [api_rule.mk][lib$(LIB_NAME).$(LIB_EXT)] 221endif 222 223clean : 224 @$(foreach dir, $(DRV_DIR), $(MAKE) -s -C $(DDIDRV)/$(dir) clean;) 225 @rm -f $(API_OBJ) 226 @rm -f $(API_IMPORT_OBJ) 227 @rm -f $(DDI_PATH)/lib$(LIB_NAME).a 228 @rm -f $(DDI_PATH)/lib$(LIB_NAME).so 229 230 231