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 DSP_INCLUDE += -I$(TI_OCL_INSTALL_DIR)/opencl/include
6 CPP = g++
7 CL6X = cl6x -mv6600 --abi=eabi $(DSP_INCLUDE)
8 CLOCL = clocl
10 LIBS = -lOpenCL -locl_util #-lstdc++ -lrt
12 UNAME_M :=$(shell uname -m)
15 ifneq (,$(findstring 86, $(UNAME_M)))
16 .DEFAULT_GOAL := cross
18 # In a cross compile environment we are assuming that the EVM file system
19 # is located on the build host and necessary ARM libraries are installed
20 # on that file system.
21 ifneq ($(MAKECMDGOALS),clean)
22 ifeq ($(TARGET_ROOTDIR),)
23 $(error Environment variable TARGET_ROOTDIR must be defined. Set it to point at the EVM root file system)
24 endif
25 endif
27 # gcc ARM cross compiler will not, by default, search the host's
28 # /usr/include. Explicitly specify here to find dependent vendor headers
29 cross: override CPP = arm-linux-gnueabihf-g++
30 cross: CPP_FLAGS += -I$(TARGET_ROOTDIR)/usr/include -idirafter /usr/include
32 # If cross-compilineg, provide path to dependent ARM libraries on the
33 # target filesystem
34 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
35 endif
37 %.o: %.cpp
38 @echo Compiling $<
39 $(CPP) -c $(CPP_FLAGS) $<
41 %.o: %.c
42 @echo Compiling $<
43 $(CPP) -c $(CPP_FLAGS) $<
45 %.obj: %.c
46 @echo Compiling $<
47 $(CL6X) -c $(CL6X_FLAGS) $<
49 %.out: %.cl
50 @echo Compiling $<
51 @$(CLOCL) $(CLOCL_FLAGS) $^
53 %.dsp_h: %.cl
54 @echo Compiling $<
55 @$(CLOCL) -t $(CLOCL_FLAGS) $^
57 $(EXE):
59 cross: $(EXE)
61 clean::
62 @rm -f $(EXE) *.o *.obj *.out *.asm *.if *.opt *.bc *.objc *.map *.bin *.dsp_h
64 test: clean $(EXE)
65 @echo Running $(EXE)
66 @./$(EXE) >> /dev/null
67 @if [ $$? -ne 0 ] ; then echo "FAILED !!!" ; fi