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 = arm-linux-gnueabihf-objcopy
16 ifneq (,$(findstring 86, $(UNAME_M)))
17 .DEFAULT_GOAL := cross
19 # In a cross compile environment we are assuming that the EVM file system
20 # is located on the build host and necessary ARM libraries are installed
21 # on that file system.
22 ifneq ($(MAKECMDGOALS),clean)
23 ifeq ($(TARGET_ROOTDIR),)
24 $(error Environment variable TARGET_ROOTDIR must be defined. Set it to point at the EVM root file system)
25 endif
26 ifeq ($(OMP_DIR),)
27 $(error Environment variable OMP_DIR must be defined. Set it to point at the OpenMP for DSP Installation Directory, or run the setup_hpc_env script available in the MCSDK-HPC installation)
28 endif
29 endif
31 # gcc ARM cross compiler will not, by default, search the host's
32 # /usr/include. Explicitly specify here to find dependent vendor headers
33 cross: override CPP = arm-linux-gnueabihf-g++
34 cross: CPP_FLAGS += -I$(TARGET_ROOTDIR)/usr/include -idirafter /usr/include
35 #cross: CL6X_FLAGS += -I$(OMP_DIR)/packages/ti/runtime/openmp
37 # If cross-compilineg, provide path to dependent ARM libraries on the
38 # target filesystem
39 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
40 endif
42 define FIND_DSP_PKG
43 export $(1)?=$$(patsubst %/$(3),%,$$(lastword $$(sort $$(wildcard $$(TI_SEARCH_PATH)/$(2)/$(3)))))
44 ifeq ($$($(1)),)
45 $$(error ERROR - $(1) is not defined and could not be found in $(TI_SEARCH_PATH)/ )
46 else
47 ifeq ($$(wildcard $$($(1))/$(3)),)
48 $$(error ERROR - "$(1) = $$($(1))" Is not valid!)
49 endif
50 endif
51 $$(info Using $(1) = $$($(1)))
52 endef
54 %.o: %.cpp
55 @echo Compiling $<
56 $(CPP) -c $(CPP_FLAGS) $<
58 %.o: %.c
59 @echo Compiling $<
60 $(CPP) -c $(CPP_FLAGS) $<
62 %.obj: %.c
63 @echo Compiling $<
64 $(CL6X) -c $(CL6X_FLAGS) $<
66 %.out: %.cl
67 @echo Compiling $<
68 @$(CLOCL) $(CLOCL_FLAGS) $^
70 %.dsp_h: %.cl
71 @echo Compiling $<
72 @$(CLOCL) -t $(CLOCL_FLAGS) $^
74 $(EXE):
76 cross: $(EXE)
78 clean::
79 @rm -f $(EXE) *.o *.obj *.out *.asm *.if *.opt *.bc *.objc *.map *.bin *.dsp_h
81 test: clean $(EXE)
82 @echo Running $(EXE)
83 @./$(EXE) >> /dev/null
84 @if [ $$? -ne 0 ] ; then echo "FAILED !!!" ; fi