Linalg examples working after RTSC packaging changes.
[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 ifeq ($(LIBOS),LIB_RTOS)
50 BUILD_MESSAGE = "building linalg for TI-RTOS"
51 MAKE_TARGET = DSPlibs
52 CLEAN_TARGET = cleanDSPlibs
53 EXAMPLES = examples/dsponly
54 else ifeq ($(LIBOS),LIB_OPENCL)
55 BUILD_MESSAGE = "building linalg for TI-OpenCL"
56 MAKE_TARGET = ARMplusDSP
57 CLEAN_TARGET = cleanARMplusDSP
58 EXAMPLES = examples/arm+dsp
59 else
60 $(call error, ERROR - LIBOS NOT DEFINED. Must specify one of: LIBOS=LIB_RTOS, or LIBOS=LIB_OPENCL)
61 endif
63 XDCPATH = $(PDK_DIR)/packages;$(OMP_DIR)/packages;$(BIOS_DIR)/packages;$(IPC_DIR)/packages;$(FC_DIR)/packages;$(XDAIS_DIR)/packages;$(EDMA3_DIR)/packages;
65 XDC=$(XDC_DIR)/xdc
66 XS=$(XDC_DIR)/xs
67 XDCPKG=$(XDC_DIR)/bin/xdcpkg
69 PACKAGE_NAME = linalg_1_2_0_0
71 all: package
73 .lib:
74         @echo $(BUILD_MESSAGE)
75         cd $(LINALG_BASE_DIR)/src/ti/linalg; \
76         make $(MAKE_TARGET) MEM_MODEL=$(MEM_MODEL) TARGET=$(TARGET) LIBOS=$(LIBOS)
78 .platforms:
79         @echo "making platform directories ..."
80         $(XDC) clean --xdcpath="$(BIOS_DIR)/packages" -PR $(SRC_PATH)/platforms
81         $(XDC) --xdcpath "$(XDCPATH)" -PR $(SRC_PATH)/platforms
83 .eclipse: .exports
84         @echo creating product plugin
85         $(XDC) clean -P $(LINALG_BASE_DIR)/build/eclipse
86         $(XDC) -P $(LINALG_BASE_DIR)/build/eclipse
87         $(XS) --xdcpath "$(XDCPATH);$(LINALG_BASE_DIR)/build" xdc.tools.product.plugingen -p exports/$(PACKAGE_NAME) -m eclipse.Product
89 .exports:
90         @echo "making product directories ..."
91         @rm -f exports/$(PACKAGE_NAME).zip
92         @rm -rf exports/$(PACKAGE_NAME)
93         @mkdir -p exports/$(PACKAGE_NAME)
94         @mkdir -p exports/$(PACKAGE_NAME)/examples
95         @mkdir -p exports/$(PACKAGE_NAME)/packages
96         @mkdir -p exports/$(PACKAGE_NAME)/packages/ti/linalg
98 .docs:
99         @echo "generating Doxygen document"
100         cd $(LINALG_BASE_DIR)/src/ti/linalg; doxygen ./docs/doxygen/doxycfg.txt
102 #.product: .libs_c6678 .exports .docs .platforms .examples
103 package: .lib .docs .platforms .exports .eclipse
104         @echo "copying files ..."
105         @cp -R $(LINALG_BASE_DIR)/src/ti/linalg/lib exports/$(PACKAGE_NAME)/packages/ti/linalg
106         @cp    $(LINALG_BASE_DIR)/src/ti/linalg/include/* exports/$(PACKAGE_NAME)/packages/ti/linalg
107         cd $(LINALG_BASE_DIR)/src/ti/linalg; make $(CLEAN_TARGET) MEM_MODEL=$(MEM_MODEL); rm -r include; cd -
108         @cp -R $(LINALG_BASE_DIR)/src/ti/linalg/* exports/$(PACKAGE_NAME)/packages/ti/linalg
109         @cp -R $(LINALG_BASE_DIR)/src/ti/linalg/docs exports/$(PACKAGE_NAME)
110         @ln -s doxygen/html/index.html exports/$(PACKAGE_NAME)/docs/linalg_user_guide.html
111         @cp -R $(LINALG_BASE_DIR)/$(EXAMPLES)/* exports/$(PACKAGE_NAME)/examples/
112         @echo "archive files to tar ball ..."
113         @cd exports; zip -q -r $(PACKAGE_NAME).zip $(PACKAGE_NAME)
115 installARMplusDSPlib:
116         cd $(LINALG_BASE_DIR)/src/ti/linalg; \
117         make installARMplusDSPlib DESTDIR=$(DESTDIR)