makefile hisi
原文链接: makefile hisi
####################################
# 所有与平台相关的编译参数全放在这里
####################################
#=======================================
#plateform
export CHIP_TYPE := HI_3531A
#=======================================
#tools chain
ifeq ($(CHIP_TYPE), HI_3531A)
TOOL_CHAIN_DIR := /home/share_disk/tool_chain/3531A_030/arm-hisiv300-linux/target/bin/
export CROSS_COMPILE := $(TOOL_CHAIN_DIR)arm-hisiv300-linux-
else
endif
#=======================================
export CC := $(CROSS_COMPILE)gcc
export CPP := $(CROSS_COMPILE)g++
export AR := $(CROSS_COMPILE)ar
export LD := $(CROSS_COMPILE)ld
export STRIP := $(CROSS_COMPILE)strip
export STRIPFLAGS:= -g --strip-unneeded
export MAKEDEPEND =$(CC) -MM -MT
export CFLAGS := -Wall
export CPPFLAGS := -Wall
export MACRO :=
include Makefile.param
include Makefile.srcs
include Makefile.libs
TARGET := SmartVC
all:$(TARGET)
$(TARGET):$(OBJS_C) $(OBJS_CPP)
$(CC) $(SRCS_MACRO) $(CFLAGS) $(CPPFLAGS) $(SRCS_INC) $(LIBS_INC) $(LIBS_LIB) $(OBJS_C) $(OBJS_CPP) $(LDFLAGS) -o $@ -g
#$(STRIP) $(STRIPFLAGS) $@
libmdd.so:$(OBJS_C) $(OBJS_CPP)
$(CC) $(SRCS_MACRO) $(CFLAGS) $(CPPFLAGS) $(OBJS_C) $(OBJS_CPP) $(LDFLAGS) -o $@ -shared -fPIC
#$(STRIP) $(STRIPFLAGS) $@
libmdd.a:$(OBJS_C) $(OBJS_CPP)
$(AR) rv $@ $(OBJS_C) $(OBJS_CPP)
#$(STRIP) $(STRIPFLAGS) $@
$(OBJS_C):%.o:%.c
$(CC) -o $@ -c $< $(SRCS_MACRO) $(CFLAGS) $(CPPFLAGS) $(SRCS_INC) $(LIBS_INC)
$(OBJS_CPP):%.o:%.cpp
$(CC) -o $@ -c $< $(SRCS_MACRO) $(CFLAGS) $(CPPFLAGS) $(SRCS_INC) $(LIBS_INC)
$(DEF_C):%.d:%.c
$(MAKEDEPEND) $(<:.c=.o) $< $(SRCS_INC) $(LIBS_INC) > $@
$(DEF_CPP):%.d:%.cpp
$(MAKEDEPEND) $(<:.cpp=.o) $< $(SRCS_INC) $(LIBS_INC) > $@
include $(DEF_C) $(DEF_CPP)
clean:
rm -rf $(OBJS_C) $(OBJS_CPP)
rm -rf $(TARGET)
depend:
rm -rf $(DEF_C) $(DEF_CPP)
distclean:
rm -rf $(OBJS_C) $(OBJS_CPP)
rm -rf $(TARGET)
rm -rf $(DEF_C) $(DEF_CPP)
install:
cp src/*.h /home/disk2/zp/work_space/thirdlib/mdd/inc -rf
cp *.so /home/disk2/zp/work_space/thirdlib/mdd/ -rf
.PHONY:$(TARGET)
.PHONY: clean
.PHONY: depend
.PHONY: distclean
.PHONY: install
####################################
# 所有与第三方库相关的参数全放在这里
####################################
##########include dir#############
LIBS_INC :=
#LIBS_INC += -I/home/disk2/sdk/Hi3531A_SDK_V1.0.3.0/mpp/include
#LIBS_INC += -I/home/disk2/sdk/Hi3531A_SDK_V1.0.3.0/mpp/include/mkp
#LIBS_INC += -I/home/disk2/zp/work_space/thirdlib/mdd/inc
LIBS_INC += -I/home/share_disk/sdk/Hi3531A_SDK_V1.0.3.0/mpp/include
LIBS_INC += -I/home/share_disk/sdk/Hi3531A_SDK_V1.0.3.0/mpp/include/mkp
LIBS_INC += -I/home/share_disk/workspace/thirdlib/mdd/inc
##########lib dir#############
LIBS_LIB :=
#LIBS_LIB += -L/home/disk2/sdk/Hi3531A_SDK_V1.0.3.0/mpp/lib
#LIBS_LIB += -L/home/disk2/zp/work_space/thirdlib/mdd
LIBS_LIB += -L/home/share_disk/sdk/Hi3531A_SDK_V1.0.3.0/mpp/lib
LIBS_LIB += -L/home/share_disk/workspace/thirdlib/mdd
##########load option#############
LDFLAGS :=
LDFLAGS += -lpthread -lm -lstdc++ -lmpi -ljpeg -lhdmi -ltde -lupvqe -lVoiceEngine -ldnvqe -ldl
####################################
# 所有与源码相关的参数全放在这里
####################################
SRCS_INC :=
SRCS_INC += -I.
SRCS_C :=
SRCS_C += $(wildcard ./*.c)
SRCS_CPP :=
SRCS_CPP += $(wildcard ./*.cpp)
############public source code############
#UTIL_TOOLS_DIR := /home/disk2/zp/work_space/code/util_tools/code
UTIL_TOOLS_DIR := /home/share_disk/workspace/code/util_tools/code
SRCS_INC += -I$(UTIL_TOOLS_DIR)/base64
SRCS_INC += -I$(UTIL_TOOLS_DIR)/cJSON
SRCS_INC += -I$(UTIL_TOOLS_DIR)/cross_platform
SRCS_INC += -I$(UTIL_TOOLS_DIR)/error
SRCS_INC += -I$(UTIL_TOOLS_DIR)/filefunc
SRCS_INC += -I$(UTIL_TOOLS_DIR)/inirw
SRCS_INC += -I$(UTIL_TOOLS_DIR)/list
SRCS_INC += -I$(UTIL_TOOLS_DIR)/log
SRCS_INC += -I$(UTIL_TOOLS_DIR)/strfunc
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/base64/*.c)
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/cJSON/*.c)
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/cross_platform/*.c)
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/error/*.c)
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/filefunc/*.c)
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/inirw/*.c)
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/list/*.c)
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/log/*.c)
SRCS_C += $(wildcard $(UTIL_TOOLS_DIR)/strfunc/*.c)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/base64/*.cpp)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/cJSON/*.cpp)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/cross_platform/*.cpp)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/error/*.cpp)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/filefunc/*.cpp)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/inirw/*.cpp)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/list/*.cpp)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/log/*.cpp)
SRCS_CPP += $(wildcard $(UTIL_TOOLS_DIR)/strfunc/*.cpp)
OBJS_C :=
OBJS_C += $(SRCS_C:.c=.o)
OBJS_CPP :=
OBJS_CPP += $(SRCS_CPP:.cpp=.o)
DEF_C :=
DEF_C += $(SRCS_C:.c=.d)
DEF_CPP :=
DEF_CPP += $(SRCS_CPP:.cpp=.d)
SRCS_MACRO :=
SRCS_MACRO += -DPLATFORM=1
export SRCS_INC #source code directory
export SRCS_C # c source code pathname
export SRCS_CPP # cpp source code pathname
export OBJS_C # The c suffix corresponding to the path name of the .o
export OBJS_CPP # The cpp suffix corresponding to the path name of the .o
export DEF_C # The c suffix corresponding to the path name of the .d
export DEF_CPP # The cpp suffix corresponding to the path name of the .d
export SRCS_MACRO # Source related macros