27472ac354d0a3c264a05061434650db4cf329dd
1 #*******************************************************************************
2 #* FILE PURPOSE: Top level makefile for Creating Component Libraries and example
3 #* binaries of PDK
4 #*******************************************************************************
5 #* FILE NAME: makefile
6 #*
7 #* DESCRIPTION: Builds the PDK Drivers & Examples
8 #*
9 #*
10 #*******************************************************************************
11 #*
12 # (Mandatory) Specify where various tools are installed.
13 .NOTPARALLEL:
14 # This make file is not parallel in its highest level. This is done to serialize the multiple SOCS,BOARDS,CORES.
15 # However the subsequent makefiles invoked by this makefile have parallelism supported. i.e -j option given to this
16 # makefile will be passed on to the subsequent makefiles resulting in parallel builds.
18 ifeq ($(RULES_MAKE), )
19 include $(PDK_INSTALL_PATH)/ti/build/Rules.make
20 else
21 include $(RULES_MAKE)
22 endif
24 ifndef MAKE
25 export MAKE = make
26 endif
28 ifndef ECHO
29 export ECHO = echo
30 endif
32 ifndef RM
33 export RM = rm -f
34 endif
36 ifndef CP
37 export CP = cp
38 endif
40 ifneq ($(LIMIT_SOCS),)
41 SOC_LIST = $(LIMIT_SOCS)
42 else
43 SOC_LIST = $(SOC)
44 endif
46 ifneq ($(LIMIT_BOARDS),)
47 BOARD_LIST = $(LIMIT_BOARDS)
48 else
49 BOARD_LIST = $(BOARD)
50 endif
53 ifneq ($(LIMIT_CORES),)
54 # PRU cores are not built directly
55 CORE_LIST = $(filter-out $(PRUCORE_LIST),$(LIMIT_CORES))
56 else
57 CORE_LIST = $(CORE)
58 endif
60 .PHONY: all all_libs all_examples clean env_check help xdc_meta \
61 buildinfra_all buildinfra_clean buildinfra_pdk_examples \
62 non-buildinfra_all non-buildinfra_clean buildinfra_pdk_libs non-buildinfra_pdk_examples \
63 cplusplus_build
65 # Default BUILD profile is release
66 BUILD_PROFILE ?= release
67 #The top level makefile two kinds of sub modules. Ones which are supported by the 'build infrastructure' and which are not.
68 # i.e The modules which supports 'build infrastructure' are included in ti/build/component.mk and follow a standard set of conventions and targets.
69 # They can be built using ti/build/makefile. Many newer targets such as AM3/4/5/6/7 have their modules in this category.
70 # Those targets in this makefile has the 'buildinfra_' prefix in them.
72 # The non-build infrastructure modules are the ones which do not adhere to the ti/build/component.mk . They have custom makefiles which are either RTSC generated or custom written makefiles with custom targets & build options.
73 # Many legacy components for K1/K2 follow this methodology.
74 # Those non-build infrastructure targets in this makefile has 'non-buildinfra_' prefix in them.
77 ### Common targets for build infra and non-build infra
78 all: env_check buildinfra_all non-buildinfra_all
79 all_libs: env_check buildinfra_pdk_libs non-buildinfra_pdk_libs
80 all_examples: env_check buildinfra_pdk_examples non-buildinfra_pdk_examples
81 clean: env_check buildinfra_clean non-buildinfra_clean
83 ### Targets which are built by build infrastructure (ti/build/makefile
84 # The below builds for each SOC, its applicable BOARDS and CORES, filtered by the LIMIT_SOCS/BOARDS/CORES
86 buildinfra_all buildinfra_pdk_libs buildinfra_pdk_examples buildinfra_clean :
87 $(foreach current_soc, $(SOC_LIST),\
88 $(foreach current_board, $(filter $(BOARD_LIST),$(BOARD_LIST_$(current_soc)) ), \
89 $(foreach current_core, $(filter $(CORE_LIST),$(CORE_LIST_$(current_soc)) ), \
90 $(MAKE) -C $(PDK_INSTALL_PATH)/ti/build -f makefile $(subst buildinfra_,,$@) CORE=$(current_core) BOARD=$(current_board) SOC=$(current_soc) BUILD_PROFILE=$(BUILD_PROFILE);\
91 )))
93 # echo "$@ called with CORE=$(current_core) BOARD=$(current_board) SOC=$(current_soc) BUILD_PROFILE=$(BUILD_PROFILE)";\
95 ### Targets which are not built by build infrastructure, (eg legacy rtsc generated makefiles,custom makefiles
96 non-buildinfra_all non-buildinfra_pdk_libs non-buildinfra_pdk_examples:
97 $(MAKE) -C $(PDK_INSTALL_PATH)/ti/build -f makefile_non-buildinfra $(subst non-buildinfra_,,$@) PDK_SOC=$(PDK_SOC)
99 ### Non library/example targets
101 env_check:
102 ifneq ($(PDK_SOC),$(filter $(PDK_SOC), $(PROCSDK_SUPPORTED_PDK_SOCS)))
103 $(ECHO) "Warning !! PDK_SOC is not set properly!!!"
104 $(ECHO) "PDK_SOC should be set to any of the values: $(PROCSDK_SUPPORTED_PDK_SOCS)"
105 endif
107 help: env_check
108 $(ECHO) "------------------------------------------------------"
109 $(ECHO) "\# Top level make help"
110 $(ECHO) "------------------------------------------------------"
111 $(ECHO) "make <target> [OPTIONAL ARGUMENTS]"
112 $(ECHO) ""
113 $(ECHO) "------------------"
114 $(ECHO) "TARGETS <target>"
115 $(ECHO) "------------------"
116 $(ECHO) " all: Builds all modules (includes library & applications). Available modules are "
117 $(ECHO) " Example: \"make all \""
118 $(ECHO) ""
119 $(ECHO) " clean: Cleans libraries & applications of all modules. Available modules are "
120 $(ECHO) " Example: \"make clean \""
121 $(ECHO) ""
122 $(ECHO) " all_libs: Builds all pdk driver libraries"
123 $(ECHO) " Example: \"make all_libs \""
124 $(ECHO) ""
125 $(ECHO) " clean: Cleans libraries & applications of all modules."
126 $(ECHO) " Example: \"make clean \""
127 $(ECHO) ""
128 $(ECHO) " xdc_meta/xdc_meta: Generates xdc meta file (used if pdk is cloned from pdk.git)."
129 $(ECHO) " Example: \"make xdc_meta \""
130 $(ECHO) ""
131 $(ECHO) "------------------"
132 $(ECHO) "OPTIONAL ARGUMENTS "
133 $(ECHO) "------------------"
134 $(ECHO) "LIMIT_SOCS=<socs> This will restrict the building of libraries/apps to the particular SOC(s) specified"
135 $(ECHO) "Valid values of LIMIT_SOCS are $(LIMIT_SOCS)"
136 $(ECHO) ""
137 $(ECHO) "LIMIT_BOARDS=<boards> This will restrict the building of libraries/apps to the particular BOARD(s) specified"
138 $(ECHO) "Valid values of LIMIT_BOARDS are $(LIMIT_BOARDS)"
139 $(ECHO) ""
140 $(ECHO) "LIMIT_CORES=<cores> This will restrict the building of libraries/apps to the particular CORE(s) specified"
141 $(ECHO) "Valid values of LIMIT_CORES are $(LIMIT_CORES)"
142 $(ECHO) ""
143 $(ECHO) "PDK_SOC=<soc> This will specify the SOC version if the pdk directory does not specify it (if git clone pdk.git is used)"
144 $(ECHO) "If pdk is git cloned, PDK_SOC should be set to the <soc> where the original PDK directory from the installer was pdk_<soc>_<version>)"
145 $(ECHO) "For example if the original PDK installed directory (which got replaced by pdk.git) was <procsdk_install_dir>/pdk_am65xx_1_0_5, PDK_SOC=am65xx"
146 $(ECHO) " PDK_SOC should be set to any of the values: $(PROCSDK_SUPPORTED_PDK_SOCS)"
147 $(ECHO) ""
148 $(ECHO) "BUILD_PROFILE=<release/debug> This will determine the type of libraries/examples generated (release/debug friendly). Default is 'release "
149 $(ECHO) "Valid values of LIMIT_CORES are $(LIMIT_CORES)"
150 $(ECHO) ""
151 $(ECHO) "SOC=<soc> CORE=<core> BOARD=<board> This will build libraries/examples for the specified combination of <soc,core,board>"
152 $(ECHO) "Valid values of SOC/BOARD/CORE are found from LIMIT_SOC/BOARD/CORES above"
157 # if PDK.git is initiated from a fresh clone, the XDC meta headers will not have been generated. (xdc meta headers are used for CCS based projects)
158 # These headers are usually generated during the procsdk installer building process ('make release' from within a component's directory)
159 # This xdc_meta target will help enable the user to generate the same meta files after a fresh git clone of pdk
161 # Find all the directories with package.xdc and run xdc_meta on them to generate the rtsc meta files
162 PACKAGE_XDC_LOC := $(wildcard */package.xdc)
163 PACKAGE_XDC_LOC += $(wildcard */*/package.xdc)
164 PACKAGE_XDC_LOC += $(wildcard */*/*/package.xdc)
165 PACKAGE_XDC_LOC += $(wildcard */*/*/*/package.xdc)
166 SUBDIRS = $(filter-out ./,$(dir $(PACKAGE_XDC_LOC)))
167 xdc_meta:
168 $(foreach xdcdir, $(SUBDIRS),\
169 $(MAKE) -C $(xdcdir) $@; \
170 )
172 cplusplus_build:
173 $(MAKE) all BUILD_PROFILE=debug CPLUSPLUS_BUILD=yes