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