carlife

makefile
需要用到的库交叉编译即可
如这些库:protobuf

#Author:
#	Liu CaiQuan
#Date:
#	7th Semptember 2015
#CarLife Protocol version:
#	V0.15
#
#rule for Linux
#
#                   Copyright (C) Under BaiDu, Inc.

#TOPDIR:=~/EddyWorkSpace/CarLifeLibSourceCode/trunk



TOPDIR:=$(shell pwd)
export TOPDIR

#CROSS_COMPILE=
CROSS_COMPILE ?=arm-linux-gnueabihf-
LD=$(CROSS_COMPILE)ld
CC=$(CROSS_COMPILE)g++

CP=cp

export LD CC 

#COM_FLAGS = -Wall -O2 -fPIC -mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -mthumb-interwork -marm
#CFLAGS	   = $(COM_FLAGS) -std=c++14

#CFLAGS = -g
CFLAGS:=-g -Wall -O2 -fPIC -mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -mthumb-interwork -marm -std=c++11 
CFLAGS+=-I protobuf/cc/include
CFLAGS+=-I $(TOPDIR)/include
CFLAGS+=-I $(TOPDIR)/protobuf/cc/include
#CFLAGS+=-I /usr/local/include

#CFLAGS+=-I /usr/protobuf/include

CFLAGS+=-I $(TOPDIR)/protobuf/include
CFLAGS+=-I $(TOPDIR)/H264Player/include
CFLAGS+=-I $(TOPDIR)/H264Player/ffmpeg-4.1.3/include
CFLAGS+=-I $(TOPDIR)/H264Player/sstar/include
CFLAGS+=-I $(TOPDIR)/protobuf/include/google/protobuf
CFLAGS+=-I $(TOPDIR)/protobuf/include/google/protobuf/io
CFLAGS+=-I $(TOPDIR)/protobuf/include/google/protobuf/stubs

#CFLAGS+=-I /usr/protobuf/include/google/protobuf
#CFLAGS+=-I /usr/protobuf/include/google/protobuf/io
#CFLAGS+=-I /usr/protobuf/include/google/protobuf/stubs

#CFLAGS+=-I /usr/include

#CFLAGS+=-I /usr/include/libxml2




#LFLAGS:=-fPIC -shared
#LFLAGS+=-L/usr/local/lib -lprotobuf
LFLAGS+=-L$(TOPDIR)/H264Player/ffmpeg-4.1.3/lib -L$(TOPDIR)/H264Player/sstar/lib  
LFLAGS+=-L$(TOPDIR)/protobuf/lib 

#LFLAGS+=-L/usr/protobuf/lib -L/usr/protobuf/lib/libprotobuf.a

ENABLE_HDMI = 0
USE_FFMPEG  = 1

ifeq ($(USE_FFMPEG), 1)
LIB_NAME  += -lavformat -lavcodec -lavutil
endif

ifeq ($(ENABLE_HDMI), 1)
LIB_PATH += -lmi_hdmi
else
LIB_NAME += -lmi_panel
endif

LIB_NAME += -lprotobuf -lm -lmi_vdec -lmi_sys -lmi_gfx -lmi_disp -lmi_ao -lmi_common -ldl -lcarlifevehicle -lpthread 



export CFLAGS LFLAGS

OBJDIR=obj

#obj-y+=CarLifeLibTest.o
obj-y+=H264Player/
obj-y+=core/
obj-y+=libwrapper/
obj-y+=modules/
obj-y+=protobuf/
obj-y+=utility/


TARGET-LIB=libcarlifevehicle.so
TARGET-APP=libtest 

all: carlifelib libtest

carlifelib: 
	make -C ./ -f $(TOPDIR)/Makefile.build
	$(CC) -shared -o $(TARGET-LIB) built-in.o
	$(CP) $(TARGET-LIB) $(OBJDIR)	

libtest:CarLifeLibTest.cpp
	$(CC) -o $(TARGET-APP) $< $(CFLAGS) -L./ $(LFLAGS) $(LIB_NAME) 
	$(CP) $(TARGET-APP) $(OBJDIR)
	$(CP) $(TOPDIR)/libtest $(TOPDIR)/out/bin/
	$(CP) $(TOPDIR)/libcarlifevehicle.so $(TOPDIR)/out/lib/
	$(CP) $(TOPDIR)/protobuf/lib/libprotobuf.so.8 $(TOPDIR)/out/lib/
	$(CP) $(TOPDIR)/H264Player/ffmpeg-4.1.3/lib/libavcodec.so.58 $(TOPDIR)/out/lib/
	$(CP) $(TOPDIR)/H264Player/ffmpeg-4.1.3/lib/libavformat.so.58 $(TOPDIR)/out/lib/
	$(CP) $(TOPDIR)/H264Player/ffmpeg-4.1.3/lib/libavutil.so.56 $(TOPDIR)/out/lib/

protoBuf:
	rm -f ./protobuf/pbGen/*
	protoc --proto_path=./protobuf/proto/ --cpp_out=./protobuf/pbGen ./protobuf/proto/*.proto
	rm -f ./protobuf/cc/src/*.cc
	rm -f ./protobuf/cc/include/*.h
	mv ./protobuf/pbGen/*.cc ./protobuf/cc/src/
	mv ./protobuf/pbGen/*.h ./protobuf/cc/include/

clean:
	rm -f $(shell find -name "*.o")
	rm -f $(TARGET-LIB)
	rm -f $(TARGET-APP)
	rm -f $(OBJDIR)/*
	rm -f $(TOPDIR)/out/bin/*
	rm -f $(TOPDIR)/out/lib/*

distclean:
	rm -f $(shell find -name "*.o")
	rm -f $(shell find -name "*.d")
	rm -f $(TARGET-LIB)
	rm -f $(TARGET-APP)
	rm -f $(OBJDIR)/*
	rm -f $(TOPDIR)/out/bin/*
	rm -f $(TOPDIR)/out/lib/*
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值