build: support building host tools

To speed up builds, this change allows building the needed host tools
that are built for every application and stores them un
${ZEPHYR_BASE}/bin.

Run 'make host-tools' and then define PREBUILT_HOST_TOOLS to reuse the
host tools across multiple builds.

$ make host-tools
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/gen_idt/version.o
  HOSTCC  scripts/gen_idt/gen_idt.o
  HOSTLD  scripts/gen_idt/gen_idt
  HOSTCC  scripts/gen_offset_header/gen_offset_header.o
  HOSTLD  scripts/gen_offset_header/gen_offset_header
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf

$ export PREBUILT_HOST_TOOLS=${ZEPHYR_BASE}/bin

$ make -C samples/hello_world

Now you will notice a speedup when building the application!

Change-Id: Ie0aeee7f9a60b1fd49e7e32d78601f03473d73b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-04-22 08:10:44 -04:00 committed by Anas Nashif
commit 19ee5efa61
2 changed files with 15 additions and 2 deletions

View file

@ -478,7 +478,7 @@ endif
version_h := include/generated/version.h
no-dot-config-targets := pristine distclean clean mrproper help kconfig-help \
no-dot-config-targets := pristine distclean clean mrproper help kconfig-help host-tools \
cscope gtags TAGS tags help% %docs check% \
$(version_h) headers_% kernelversion %src-pkg
@ -1065,7 +1065,7 @@ CLEAN_FILES += include/generated/generated_dts_board.h \
*.bin *.hex *.stat *.strip staticIdt.o linker.cmd
# Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config usr/include include/generated \
MRPROPER_DIRS += bin include/config usr/include include/generated \
arch/*/include/generated .tmp_objdiff
MRPROPER_FILES += .config .config.old .version $(version_h) \
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
@ -1193,6 +1193,17 @@ $(help-board-dirs): help-%:
echo '')
host-tools:
$(Q)$(MAKE) $(build)=scripts/kconfig standalone
$(Q)$(MAKE) $(build)=scripts/basic
$(Q)$(MAKE) $(build)=scripts/gen_idt
$(Q)$(MAKE) $(build)=scripts/gen_offset_header
@mkdir -p ${ZEPHYR_BASE}/bin
@cp scripts/basic/fixdep scripts/gen_idt/gen_idt scripts/kconfig/conf \
scripts/gen_offset_header/gen_offset_header ${ZEPHYR_BASE}/bin
# Documentation targets
# ---------------------------------------------------------------------------
%docs: FORCE

View file

@ -34,6 +34,8 @@ gconfig: $(KCONFIG_BIN_PATH)/gconf
menuconfig: $(KCONFIG_BIN_PATH)/mconf
$< $(Kconfig)
standalone: $(obj)/conf
config: $(KCONFIG_BIN_PATH)/conf
$< --oldaskconfig $(Kconfig)