Skip CBLAS DSP initializtion if OFFLOAD is disabled.
[dense-linear-algebra-libraries/linalg.git] / build / Makefile
1 ##
2 ##  Copyright (c) 2015, Texas Instruments Incorporated
3 ##
4 ##  Redistribution and use in source and binary forms, with or without
5 ##  modification, are permitted provided that the following conditions
6 ##  are met:
7 ##
8 ##  *  Redistributions of source code must retain the above copyright
9 ##     notice, this list of conditions and the following disclaimer.
10 ##
11 ##  *  Redistributions in binary form must reproduce the above copyright
12 ##     notice, this list of conditions and the following disclaimer in the
13 ##     documentation and/or other materials provided with the distribution.
14 ##
15 ##  *  Neither the name of Texas Instruments Incorporated nor the names of
16 ##     its contributors may be used to endorse or promote products derived
17 ##     from this software without specific prior written permission.
18 ##
19 ##  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 ##  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 ##  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 ##  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 ##  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 ##  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 ##  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 ##  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 ##  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29 ##  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 ##
32 # Path to C6000 compiler tools
33 ifeq ($(CGTROOT),)
34 $(call error,ERROR - CGTROOT NOT DEFINED)
35 endif
37 ifeq ($(XDC_DIR),)
38 $(call error,ERROR - XDC_DIR NOT DEFINED)
39 endif
41 ifeq ($(LINALG_BASE_DIR),)
42 LINALG_BASE_DIR := $(shell pwd)
43 endif
45 ifeq ($(SRC_PATH),)
46 SRC_PATH = $(LINALG_BASE_DIR)/src/ti/linalg
47 endif
49 SRC_FOLDERS  = $(LINALG_BASE_DIR)/src/ti/linalg/cblas 
50 SRC_FOLDERS += $(LINALG_BASE_DIR)/src/ti/linalg/ticblas 
51 SRC_FOLDERS += $(LINALG_BASE_DIR)/src/ti/linalg/blis 
52 ifeq ($(LIBOS),LIB_OPENCL)
53 SRC_FOLDERS += $(LINALG_BASE_DIR)/src/ti/linalg/blasblisacc 
54 SRC_FOLDERS += $(LINALG_BASE_DIR)/src/ti/linalg/clapack 
55 SRC_FOLDERS += $(LINALG_BASE_DIR)/src/ti/linalg/tuning 
56 endif
58 ifeq ($(LIBOS),LIB_RTOS)
59 BUILD_MESSAGE = "building linalg for TI-RTOS"
60 MAKE_TARGET = DSPlibs
61 CLEAN_TARGET = cleanDSPlibs
62 else ifeq ($(LIBOS),LIB_OPENCL)
63 BUILD_MESSAGE = "building linalg for TI-OpenCL"
64 MAKE_TARGET = ARMplusDSP
65 CLEAN_TARGET = cleanARMplusDSP
66 else
67 $(call error, ERROR - LIBOS NOT DEFINED. Must specify one of: LIBOS=LIB_RTOS, or LIBOS=LIB_OPENCL)
68 endif
70 XDCPATH = $(PDK_DIR)/packages;$(OMP_DIR)/packages;$(BIOS_DIR)/packages;$(IPC_DIR)/packages;$(FC_DIR)/packages;$(XDAIS_DIR)/packages;$(EDMA3_DIR)/packages;
72 XDC=$(XDC_DIR)/xdc
73 XS=$(XDC_DIR)/xs
74 XDCPKG=$(XDC_DIR)/bin/xdcpkg
75         
76 PACKAGE_NAME = linalg_1_2_0_0
78 all: package
80 .lib:
81         @echo $(BUILD_MESSAGE)
82         cd $(LINALG_BASE_DIR)/src/ti/linalg; \
83         make $(MAKE_TARGET) MEM_MODEL=$(MEM_MODEL) TARGET=$(TARGET) LIBOS=$(LIBOS)
85 .platforms:
86         @echo "making platform directories ..."
87         $(XDC) clean --xdcpath="$(BIOS_DIR)/packages" -PR $(SRC_PATH)/platforms
88         $(XDC) --xdcpath "$(XDCPATH)" -PR $(SRC_PATH)/platforms
89         @cp -R $(LINALG_BASE_DIR)/src/ti/linalg/platforms exports/$(PACKAGE_NAME)/packages/ti/linalg
91 .eclipse: .exports
92         @echo creating product plugin
93         $(XDC) clean -P $(LINALG_BASE_DIR)/build/eclipse
94         $(XDC) -P $(LINALG_BASE_DIR)/build/eclipse
95         $(XS) --xdcpath "$(XDCPATH);$(LINALG_BASE_DIR)/build" xdc.tools.product.plugingen -p exports/$(PACKAGE_NAME) -m eclipse.Product
97 .exports:
98         @echo "making product directories ..."
99         @rm -f exports/$(PACKAGE_NAME).zip
100         @rm -rf exports/$(PACKAGE_NAME)
101         @mkdir -p exports/$(PACKAGE_NAME)
102         @mkdir -p exports/$(PACKAGE_NAME)/examples
103         @mkdir -p exports/$(PACKAGE_NAME)/packages
104         @mkdir -p exports/$(PACKAGE_NAME)/packages/ti/linalg
105         @cp -R $(SRC_FOLDERS) exports/$(PACKAGE_NAME)/packages/ti/linalg
106         @cp    $(LINALG_BASE_DIR)/src/ti/linalg/Makefile exports/$(PACKAGE_NAME)/packages/ti/linalg
107         @cp    $(LINALG_BASE_DIR)/src/ti/linalg/make.inc exports/$(PACKAGE_NAME)/packages/ti/linalg
108         @cp    $(LINALG_BASE_DIR)/src/ti/linalg/package.xdc exports/$(PACKAGE_NAME)/packages/ti/linalg
109         @cp    $(LINALG_BASE_DIR)/src/ti/linalg/package.xs exports/$(PACKAGE_NAME)/packages/ti/linalg
111 .docs:
112         @echo "generating Doxygen document"
113         cd $(LINALG_BASE_DIR)/src/ti/linalg; doxygen ./docs/doxygen/doxycfg.txt
115 ifeq ($(LIBOS),LIB_RTOS)
116 package: .exports .lib .docs .platforms .eclipse
117 else
118 package: .exports .lib .docs
119 endif
120         @echo "copying files ..."
121         @cp -R $(LINALG_BASE_DIR)/src/ti/linalg/lib exports/$(PACKAGE_NAME)/packages/ti/linalg
122         @cp    $(LINALG_BASE_DIR)/src/ti/linalg/include/* exports/$(PACKAGE_NAME)/packages/ti/linalg
123         @cp -R $(LINALG_BASE_DIR)/src/ti/linalg/include exports/$(PACKAGE_NAME)/packages/ti/linalg
124         @cp -R $(LINALG_BASE_DIR)/src/ti/linalg/docs exports/$(PACKAGE_NAME)
125         @cp -R $(LINALG_BASE_DIR)/examples/* exports/$(PACKAGE_NAME)/examples/
126         @echo "archive files to tar ball ..."
127         @cd exports; zip -q -r $(PACKAGE_NAME).zip $(PACKAGE_NAME)
129 clean: 
130         cd $(LINALG_BASE_DIR)/src/ti/linalg; \
131         make $(CLEAN_TARGET) MEM_MODEL=$(MEM_MODEL) TARGET=$(TARGET) LIBOS=$(LIBOS); cd -;\
132         rm -r exports/$(PACKAGE_NAME); rm exports/$(PACKAGE_NAME).zip