TI Openmpacc Makefile讲解

Data: 2017.12.29

Author: cjh

Theme: TI Openmpacc Makefile讲解

 

本章节主要是对Makefile进行讲解,有利于读者后期对代码的修改和编译

Makefile讲解

#包含make.inc
include ../make.inc

#target编译选项
OA_TC_OPTS 			= -O3
ifeq ($(VERBOSE),1)
#主机编译选项 -fopenmp为openmp编译选项
OA_HC_OPTS 			= -O3 -Wall -Wextra -fopenmp

#-v -k --hc --tc详见TI Openmp clacc编译器讲解
OA_SHELL_OPTS 		= -v -k --hc="$(OA_HC_OPTS)" --tc="$(OA_TC_OPTS)"
else
OA_HC_OPTS 			= -O3 -fopenmp
OA_SHELL_OPTS 		= --hc="$(OA_HC_OPTS)" --tc="$(OA_TC_OPTS)"
endif

#CPP编译选项,有需求可以在这里添加
CXX_OPTS 			= -O3

#最终编译执行程序名字
EXE     	= dsplib_fft
#主机端代码
HOST_CODE 	= dsplib_fft_main.cpp dsplib_fft_host.cpp
#target端代码
TARGET_CODE = dsplib_fft_target.c
#调用dsplib库,需要调用别的库按此方法添加,不可想传统方法-L/-llib进行添加库
DSPLIB 		= ./dsplib.ae66
#具体意思可参见Makefile学习总结
OBJS 		= $(patsubst %.cpp,%.o,$(HOST_CODE)) 

#目标文件编译
$(EXE): $(OBJS) 
	$(OA_SHELL) $(OA_SHELL_OPTS) $(OBJS) $(TARGET_CODE) $(DSPLIB) -o $@

#.c文件编译
%.o: %.c
	$(CC) $(CXX_OPTS) -c $<

#.cpp文件编译	
%.o: %.cpp
	$(CXX) $(CXX_OPTS) -c $<

clean:
	@rm -f $(EXE) $(OA_SHELL_TMP_FILES) *.log

make.inc讲解

#opencl编译器
CL                    = cl6x -mv6600 --abi=eabi 
#clacc编译器
OA_SHELL 	          = clacc 
CXX 		          = arm-linux-gnueabihf-g++  
CC  		          = arm-linux-gnueabihf-gcc  
#CXX 		          = g++  
#CC  		          = gcc  
OA_SHELL_TMP_FILES    = *.out __TI_CLACC_KERNEL.c *.cl *.asm *.dsp_h *.bc *.objc *.if *.map *.opt *.int.c *.o *.obj __s2s_predef.gcc_h


#下面的内容不是很重要,不用管
# temporary workaround for locale bug
LC_ALL?=C
export LC_ALL

UNAME_M :=$(shell uname -m)
ifneq (,$(findstring x86, $(UNAME_M)))
 ifeq ($(TARGET_ROOTDIR),)
 $(call error,ERROR - TARGET_ROOTDIR must be set for cross compiling)
 endif
endif

ifeq ($(TI_OCL_CGT_INSTALL),)
  TI_OCL_CGT_INSTALL = $(TARGET_ROOTDIR)/usr/share/ti/cgt-c6x
endif

需要通用模板或者编译过程有问题的可以提问交流。




你可能感兴趣的:(AM5728)