]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/makefile
Merge pull request #72 in PROCESSOR-SDK/pdk from ~A0400828/pdk:prsdk-7564 to master
[processor-sdk/pdk.git] / packages / makefile
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
59  
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 ifeq ($(PDK_SOC),)
103         $(ECHO) "Warning !! PDK_SOC is not set!!! Please run 'help' and refer to 'Optional Arguments' in the help section"
104 endif
106 help: env_check
107         $(ECHO) "------------------------------------------------------"
108         $(ECHO) "\# Top level make help"
109         $(ECHO) "------------------------------------------------------"
110         $(ECHO) "make <target> [OPTIONAL ARGUMENTS]"
111         $(ECHO) ""
112         $(ECHO) "------------------"
113         $(ECHO) "TARGETS <target>"
114         $(ECHO) "------------------"
115         $(ECHO) " all: Builds all modules (includes library & applications). Available modules are "
116         $(ECHO) "     Example:  \"make all \""
117         $(ECHO) ""
118         $(ECHO) " clean: Cleans libraries & applications of all modules. Available modules are "
119         $(ECHO) "     Example:  \"make clean \""
120         $(ECHO) ""
121         $(ECHO) " all_libs: Builds all pdk driver libraries"
122         $(ECHO) "     Example:  \"make all_libs \""
123         $(ECHO) ""
124         $(ECHO) " clean: Cleans libraries & applications of all modules."
125         $(ECHO) "     Example:  \"make clean \""
126         $(ECHO) ""
127         $(ECHO) " xdc_meta/xdc_meta: Generates xdc meta file (used if pdk is cloned from pdk.git)."
128         $(ECHO) "     Example:  \"make xdc_meta \""
129         $(ECHO) ""
130         $(ECHO) "------------------"
131         $(ECHO) "OPTIONAL ARGUMENTS "
132         $(ECHO) "------------------"
133         $(ECHO) "LIMIT_SOCS=<socs>  This will restrict the building of libraries/apps to the particular SOC(s) specified"
134         $(ECHO) "Valid values of LIMIT_SOCS are $(LIMIT_SOCS)"
135         $(ECHO) ""
136         $(ECHO) "LIMIT_BOARDS=<boards>  This will restrict the building of libraries/apps to the particular BOARD(s) specified"
137         $(ECHO) "Valid values of LIMIT_BOARDS are $(LIMIT_BOARDS)"
138         $(ECHO) ""
139         $(ECHO) "LIMIT_CORES=<cores>  This will restrict the building of libraries/apps to the particular CORE(s) specified"
140         $(ECHO) "Valid values of LIMIT_CORES are $(LIMIT_CORES)"
141         $(ECHO) ""
142         $(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)"
143         $(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>)"
144         $(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"
145         $(ECHO) ""
146         $(ECHO) "BUILD_PROFILE=<release/debug>  This will determine the type of libraries/examples generated (release/debug friendly). Default is 'release "
147         $(ECHO) "Valid values of LIMIT_CORES are $(LIMIT_CORES)"
148         $(ECHO) ""
149         $(ECHO) "SOC=<soc> CORE=<core> BOARD=<board> This will build libraries/examples for the specified combination of <soc,core,board>"
150         $(ECHO) "Valid values of SOC/BOARD/CORE are found from LIMIT_SOC/BOARD/CORES above"
151         
152         
155 # 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)
156 # These headers are usually generated during the procsdk installer building process ('make release' from within a component's directory)
157 # This xdc_meta target will help enable the user to generate the same meta files after a fresh git clone of pdk
159 # Find all the directories with package.xdc and run xdc_meta on them to generate the rtsc meta files
160 PACKAGE_XDC_LOC := $(wildcard */package.xdc)
161 PACKAGE_XDC_LOC += $(wildcard */*/package.xdc)
162 PACKAGE_XDC_LOC += $(wildcard */*/*/package.xdc)
163 PACKAGE_XDC_LOC += $(wildcard */*/*/*/package.xdc)
164 SUBDIRS =  $(filter-out ./,$(dir $(PACKAGE_XDC_LOC)))
165 xdc_meta:
166         $(foreach xdcdir, $(SUBDIRS),\
167         $(MAKE) -C $(xdcdir) $@; \
168         )
170 cplusplus_build:
171         $(MAKE) all BUILD_PROFILE=debug CPLUSPLUS_BUILD=yes