Build system: Add PREBUILD definition

Add PREBUILD definition and `prebuild` recipe to call it before
the `mkconfig` tool, at the beginning of the build process. This
`prebuild` step enables running CPU/board-specific operations
before building the firmware, like tweaking or overriding configs
that need to be set after the board configuration.
This commit is contained in:
Tiago Medicci Serrano 2023-07-31 16:28:13 -03:00 committed by Xiang Xiao
parent 0fcf6f2e41
commit ea2ec888b8
3 changed files with 31 additions and 2 deletions

View File

@ -458,6 +458,15 @@ define PRELINK
endef
endif
# PREBUILD -- Perform pre build operations
# Some architectures require the use of special tools and special handling
# BEFORE building NuttX. The `Make.defs` files for those architectures
# should override the following define with the correct operations for
# that platform.
define PREBUILD
endef
# POSTBUILD -- Perform post build operations
# Some architectures require the use of special tools and special handling
# AFTER building the NuttX binary. Make.defs files for those architectures

View File

@ -244,7 +244,7 @@ include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion$(HOSTEXEEXT)
# part of the overall NuttX configuration sequence. Notice that the
# tools/mkconfig tool is built and used to create include/nuttx/config.h
tools/mkconfig$(HOSTEXEEXT):
tools/mkconfig$(HOSTEXEEXT): prebuild
$(Q) $(MAKE) -C tools -f Makefile.host mkconfig$(HOSTEXEEXT)
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig$(HOSTEXEEXT)
@ -486,6 +486,16 @@ clean_context: clean_dirlinks
include tools/LibTargets.mk
# prebuild
#
# Some architectures require the use of special tools and special handling
# BEFORE building NuttX. The `Make.defs` files for those architectures
# should override the following define with the correct operations for
# that platform.
prebuild:
$(call PREBUILD, $(TOPDIR))
# pass1 and pass2
#
# If the 2 pass build option is selected, then this pass1 target is

View File

@ -231,7 +231,7 @@ include\nuttx\version.h: $(TOPDIR)\.version tools\mkversion$(HOSTEXEEXT)
# part of the overall NuttX configuration sequence. Notice that the
# tools\mkconfig tool is built and used to create include\nuttx\config.h
tools\mkconfig$(HOSTEXEEXT):
tools\mkconfig$(HOSTEXEEXT): prebuild
$(Q) $(MAKE) -C tools -f Makefile.host mkconfig$(HOSTEXEEXT)
include\nuttx\config.h: $(TOPDIR)\.config tools\mkconfig$(HOSTEXEEXT)
@ -473,6 +473,16 @@ clean_context:
include tools/LibTargets.mk
# prebuild
#
# Some architectures require the use of special tools and special handling
# BEFORE building NuttX. The `Make.defs` files for those architectures
# should override the following define with the correct operations for
# that platform.
prebuild:
$(call PREBUILD, $(TOPDIR))
# pass1 and pass2
#
# If the 2 pass build option is selected, then this pass1 target is