1 # Copyright (C) 2015 -2018 Texas Instruments Incorporated - http://www.ti.com/
2 #
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
14 # distribution.
15 #
16 # Neither the name of Texas Instruments Incorporated nor the names of
17 # its contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 export USEDYNAMIC_LIB ?= "no"
34 # ROOT Directory
35 ifndef PDK_INSTALL_PATH
36 export ROOTDIR := ../..
37 else
38 export ROOTDIR = $(PDK_INSTALL_PATH)
39 endif
41 # PDK Board Library
42 ifndef PDK_DIAG_DIR
43 export PDK_DIAG_DIR = $(ROOTDIR)/ti/board
44 endif
46 # Device based on board
47 ifeq ($(BOARD), idkAM571x)
48 export DEVICE=AM571x
49 endif
51 ifeq ($(BOARD), idkAM572x)
52 export DEVICE=AM572x
53 endif
55 ifeq ($(BOARD), idkAM574x)
56 export DEVICE=AM574x
57 endif
59 ifeq ($(BOARD), evmAM571x)
60 export DEVICE=AM571x
61 endif
63 ifeq ($(BOARD), evmAM572x)
64 export DEVICE=AM572x
65 endif
67 ifeq ($(BOARD), evmK2G)
68 export DEVICE=K2G
69 endif
71 ifeq ($(BOARD), iceK2G)
72 export DEVICE=K2G
73 endif
75 ifeq ($(BOARD), evmAM437x)
76 export DEVICE=AM437x
77 endif
79 ifeq ($(BOARD), evmAM335x)
80 export DEVICE=AM335x
81 endif
83 ifeq ($(BOARD), idkAM437x)
84 export DEVICE=AM437x
85 endif
87 ifeq ($(BOARD), skAM437x)
88 export DEVICE=AM437x
89 endif
91 ifeq ($(BOARD), icev2AM335x)
92 export DEVICE=AM335x
93 endif
95 ifeq ($(BOARD), bbbAM335x)
96 export DEVICE=AM335x
97 endif
99 ifeq ($(BOARD), skAM335x)
100 export DEVICE=AM335x
101 endif
103 ifeq ($(BOARD), iceAMIC110)
104 export DEVICE=AM335x
105 endif
107 ifeq ($(BOARD), am65xx_idk)
108 export DEVICE=AM65XX
109 endif
111 ifeq ($(BOARD), am65xx_evm)
112 export DEVICE=AM65XX
113 endif
115 # Common Macros used in make
116 ifndef RM
117 export RM = rm -f
118 endif
120 ifndef CP
121 export CP = cp -p
122 endif
124 export MKDIR = mkdir -p
126 ifndef RMDIR
127 export RMDIR = rm -rf
128 endif
130 ifndef SED
131 export SED = sed
132 endif
134 ifndef MAKE
135 export MAKE = make
136 endif
138 # PHONY Targets
139 .PHONY: all build_example clean
141 # all rule
142 all: build_example
144 # Check for board variable to exist
145 check-board:
146 ifndef BOARD
147 @echo BOARD NOT DEFINED, exiting...
148 @exit 1
149 else
150 @if [ ! -d "./build/$(BOARD)" ]; then echo $(DIAGTEST) not supported for $(BOARD); exit 1; fi
151 endif
153 # Check for target variable to exist
154 check-target:
155 ifndef TARGET
156 @echo TARGET NOT DEFINED, exiting...
157 @exit 1
158 else
159 @if [ ! -d "./build/$(BOARD)/$(TARGET)" ]; then echo $(DIAGTEST) not supported for target $(TARGET) using board $(BOARD); exit 1; fi
160 endif
162 build_example: check-board check-target
163 $(MAKE) -f ./build/$(BOARD)/$(TARGET)/makefile
165 clean: check-board check-target
166 $(MAKE) -f ./build/$(BOARD)/$(TARGET)/makefile clean