1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
DSP_INCLUDE = -I$(TI_OCL_CGT_INSTALL)/include
DSP_INCLUDE += -I$(TARGET_ROOTDIR)/usr/share/ti/cgt-c6x/include
DSP_INCLUDE += -I$(TARGET_ROOTDIR)/usr/share/ti/opencl
TI_IMGLIB_DIR=${TARGET_ROOTDIR}/usr/share/ti/ti-imglib-c66x-tree
TI_VLIB_DIR=${TARGET_ROOTDIR}/usr/share/ti/ti-vlib-c66x-tree
CPP = g++
CL6X = cl6x -mv6600 --abi=eabi $(DSP_INCLUDE)
CLOCL = clocl
LIBS = -lOpenCL -locl_util
UNAME_M :=$(shell uname -m)
# ----------------------------------------------------------------------------
# If TI_OCL_INSTALL is set, setup make from that location
# ----------------------------------------------------------------------------
ifneq ($(TI_OCL_INSTALL),)
CPP = g++
CPP_FLAGS += -I$(TI_OCL_INSTALL)/usr/include
LD_FLAGS += -L$(TI_OCL_INSTALL)/usr/lib
LIBS += -lbfd
# ----------------------------------------------------------------------------
# Otherwise, if making on x86 assume cross compile for Arm host
# ----------------------------------------------------------------------------
else ifneq (,$(findstring 86, $(UNAME_M)))
.DEFAULT_GOAL := cross
# In a cross compile environment we are assuming that the EVM file system
# is located on the build host and necessary ARM libraries are installed
# on that file system.
ifneq ($(MAKECMDGOALS),clean)
ifeq ($(TARGET_ROOTDIR),)
$(error Environment variable TARGET_ROOTDIR must be defined. Set it to point at the EVM root file system)
endif
endif
# gcc ARM cross compiler will not, by default, search the host's
# /usr/include. Explicitly specify here to find dependent vendor headers
cross: override CPP = arm-linux-gnueabihf-g++
cross: CPP_FLAGS += -I$(TARGET_ROOTDIR)/usr/include -idirafter /usr/include
# If cross-compilineg, provide path to dependent ARM libraries on the
# target filesystem
cross: LD_FLAGS = -L$(TARGET_ROOTDIR)/lib -L$(TARGET_ROOTDIR)/usr/lib -Wl,-rpath-link,$(TARGET_ROOTDIR)/lib -Wl,-rpath-link,$(TARGET_ROOTDIR)/usr/lib
endif
%.o: %.cpp
@$(CPP) -c $(CPP_FLAGS) $<
@echo Compiling $<
%.o: %.c
@$(CPP) -c $(CPP_FLAGS) $<
@echo Compiling $<
%.obj: %.c
@$(CL6X) -c $(CL6X_FLAGS) $<
@echo Compiling $<
%.out: %.cl
@$(CLOCL) $(CLOCL_FLAGS) $^
@echo Compiling $<
%.dsp_h: %.cl
@$(CLOCL) -t $(CLOCL_FLAGS) $^
@echo Compiling $<
$(EXE):
cross: $(EXE)
clean::
@rm -f $(EXE) *.o *.obj *.out *.asm *.if *.opt *.bc *.objc *.map *.bin *.dsp_h
test: clean $(EXE)
@echo Running $(EXE)
@./$(EXE) >> /dev/null
@if [ $$? -ne 0 ] ; then echo "FAILED !!!" ; fi
|