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)/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)
14 OBJCOPY = $(TARGET_ROOTDIR)/usr/bin/arm-linux-gnueabihf-objcopy
16 ifneq (,$(findstring 86, $(UNAME_M)))
17 .DEFAULT_GOAL := cross
18 OBJCOPY = $(TOOLCHAIN_DIR)/arm-linux-gnueabihf/bin/objcopy
20 # In a cross compile environment we are assuming that the EVM file system
21 # is located on the build host and necessary ARM libraries are installed
22 # on that file system.
23 ifneq ($(MAKECMDGOALS),clean)
24 ifeq ($(TARGET_ROOTDIR),)
25 $(error Environment variable TARGET_ROOTDIR must be defined. Set it to point at the EVM root file system)
26 endif
27 endif
29 # gcc ARM cross compiler will not, by default, search the host's
30 # /usr/include. Explicitly specify here to find dependent vendor headers
31 cross: override CPP = arm-linux-gnueabihf-g++
32 cross: CPP_FLAGS += -I$(TARGET_ROOTDIR)/usr/include -idirafter /usr/include
33 #cross: CL6X_FLAGS += -I$(OMP_DIR)/packages/ti/runtime/openmp
35 # If cross-compilineg, provide path to dependent ARM libraries on the
36 # target filesystem
37 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
38 endif
40 %.o: %.cpp
41 @echo Compiling $<
42 $(CPP) -c $(CPP_FLAGS) $<
44 %.o: %.c
45 @echo Compiling $<
46 $(CPP) -c $(CPP_FLAGS) $<
48 %.obj: %.c
49 @echo Compiling $<
50 $(CL6X) -c $(CL6X_FLAGS) $<
52 %.out: %.cl
53 @echo Compiling $<
54 @$(CLOCL) $(CLOCL_FLAGS) $^
56 %.dsp_h: %.cl
57 @echo Compiling $<
58 @$(CLOCL) -t $(CLOCL_FLAGS) $^
60 $(EXE):
62 cross: $(EXE)
64 clean::
65 @rm -f $(EXE) *.o *.obj *.out *.asm *.if *.opt *.bc *.objc *.map *.bin *.dsp_h
67 test: clean $(EXE)
68 @echo Running $(EXE)
69 @./$(EXE) >> /dev/null
70 @if [ $$? -ne 0 ] ; then echo "FAILED !!!" ; fi