1 # Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/\r
2 #\r
3 #\r
4 # Redistribution and use in source and binary forms, with or without\r
5 # modification, are permitted provided that the following conditions\r
6 # are met:\r
7 #\r
8 # Redistributions of source code must retain the above copyright\r
9 # notice, this list of conditions and the following disclaimer.\r
10 #\r
11 # Redistributions in binary form must reproduce the above copyright\r
12 # notice, this list of conditions and the following disclaimer in the\r
13 # documentation and/or other materials provided with the\r
14 # distribution.\r
15 #\r
16 # Neither the name of Texas Instruments Incorporated nor the names of\r
17 # its contributors may be used to endorse or promote products derived\r
18 # from this software without specific prior written permission.\r
19 #\r
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
31 \r
32 export USEDYNAMIC_LIB ?= "no"\r
33 \r
34 # ROOT Directory\r
35 ifndef PDK_INSTALL_PATH\r
36 export ROOTDIR := ../..\r
37 else\r
38 export ROOTDIR = $(PDK_INSTALL_PATH)\r
39 endif\r
40 \r
41 # PDK Board Library\r
42 ifndef PDK_DIAG_DIR\r
43 export PDK_DIAG_DIR = $(ROOTDIR)/ti/board\r
44 endif\r
45 \r
46 ifeq ($(BOARD), evmK2G)\r
47 export DEVICE=K2G\r
48 endif\r
49 \r
50 # Common Macros used in make\r
51 ifndef RM\r
52 export RM = rm -f\r
53 endif\r
54 \r
55 ifndef CP\r
56 export CP = cp -p\r
57 endif\r
58 \r
59 export MKDIR = mkdir -p\r
60 \r
61 ifndef RMDIR\r
62 export RMDIR = rm -rf\r
63 endif\r
64 \r
65 ifndef SED\r
66 export SED = sed\r
67 endif\r
68 \r
69 ifndef MAKE\r
70 export MAKE = make\r
71 endif\r
72 \r
73 # PHONY Targets\r
74 .PHONY: all build_example clean\r
75 \r
76 # all rule\r
77 all: build_example\r
78 \r
79 # Check for board variable to exist\r
80 check-board:\r
81 ifndef BOARD\r
82 @echo BOARD NOT DEFINED, exiting...\r
83 @exit 1\r
84 else\r
85 @if [ ! -d "./build/$(BOARD)" ]; then echo $(DIAGTEST) not supported for $(BOARD); exit 1; fi\r
86 endif\r
87 \r
88 # Check for target variable to exist\r
89 check-target:\r
90 ifndef TARGET\r
91 @echo TARGET NOT DEFINED, exiting...\r
92 @exit 1\r
93 else\r
94 @if [ ! -d "./build/$(BOARD)/$(TARGET)" ]; then echo $(DIAGTEST) not supported for target $(TARGET) using board $(BOARD); exit 1; fi\r
95 endif\r
96 \r
97 build_example: check-board check-target\r
98 $(MAKE) -f ./build/$(BOARD)/$(TARGET)/makefile \r
99 \r
100 clean: check-board check-target\r
101 $(MAKE) -f ./build/$(BOARD)/$(TARGET)/makefile clean\r