VirtualBox

Changeset 2473 in vbox


Ignore:
Timestamp:
May 3, 2007 10:40:16 PM (18 years ago)
Author:
vboxsync
Message:

kmk startup is annoyingly slow because of all the GCC checks. Detect these once and cache the result in $(PATH_OUT).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r2472 r2473  
    805805#
    806806# GCC stuff properties.
    807 #
    808 # These will be resolved on the first kmk invocation and passed on to recursive
    809 # instances in the environment.
    810 #q
    811 # Note. If we add much more to here, we should seriously consider moving this to a
    812 #       gcc configure script which we invoke automatically.
     807# Most of this is resolved on first kmk invocation and cached in PATH_OUT.
     808#
     809# Note! That a harmless warning is printed if the file doesn't exist.
     810# Note! Changes in GCC are not detected automatically (yet).
    813811#
    814812include $(PATH_KBUILD)/tools/$(VBOX_GCC_TOOL).kmk
    815 
    816 ifndef VBOX_GCC_LIBGCC
    817  export VBOX_GCC_LIBGCC := $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)
    818 endif
    819 
    820 # HC compiler switch detction.
     813ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
     814 include $(PATH_KBUILD)/tools/$(VBOX_GCC32_TOOL).kmk
     815endif
     816
    821817VBOX_GCC_CHECK_CC = $(shell \
    822818   if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
    823819   then echo "$(1)"; \
    824820   else echo "$(2)"; fi; )
     821
    825822VBOX_GCC_CHECK_CXX = $(shell \
    826823   if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
    827824   then echo "$(1)"; \
    828825   else echo "$(2)"; fi; )
    829 ifeq ($(origin VBOX_GCC_Wno-pointer-sign),undefined)
    830  export VBOX_GCC_Wno-pointer-sign := $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)
    831 endif
    832 ifeq ($(origin VBOX_GCC_Wno-variadic-macros),undefined)
    833  export VBOX_GCC_Wno-variadic-macros := $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)
    834 endif
    835 ifeq ($(origin VBOX_GCC_Wno-invalid-offsetof),undefined)
    836  export VBOX_GCC_Wno-invalid-offsetof := $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)
    837 endif
    838 ifeq ($(origin VBOX_GCC_Wno-extra),undefined)
    839  export VBOX_GCC_Wno-extra := $(call VBOX_GCC_CHECK_CXX,-Wno-extra)
    840 endif
    841 ifeq ($(origin VBOX_GCC_fno-stack-protector),undefined)
    842  export VBOX_GCC_fno-stack-protector := $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)
    843 endif
    844 # Set default attribute for ELF symbols to ``hidden'' to reduce the number
    845 # of relocation entries and PLT indirections in shared libraries.
    846 ifeq ($(origin VBOX_GCC_fvisibility-hidden),undefined)
    847  export VBOX_GCC_fvisibility-hidden := $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN,)
    848 endif
    849 # Set default attribute for inline functions to ``hidden'' to reduce the number
    850 # of relocation entries and PLT indirections in shared libraries.
    851 ifeq ($(origin VBOX_GCC_fvisibility-inlines-hidden),undefined)
    852  export VBOX_GCC_fvisibility-inlines-hidden := $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)
    853 endif
    854 
    855 # 32-bit (GC) compiler switch detection.
     826
    856827VBOX_GCC32_CHECK_CXX = $(shell \
    857828   if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
    858829   then echo "$(1)"; \
    859830   else echo "$(2)"; fi; )
    860 ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
    861  include $(PATH_KBUILD)/tools/$(VBOX_GCC32_TOOL).kmk
    862  ifeq ($(origin VBOX_GCC32_Wno-variadic-macros),undefined)
    863   export VBOX_GCC32_Wno-variadic-macros := $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)
    864  endif
    865  ifndef VBOX_GCC32_LIBGCC
    866   export VBOX_GCC32_LIBGCC := $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)
    867  endif
    868 else
    869  VBOX_GCC32_Wno-variadic-macros ?= $(VBOX_GCC_Wno-variadic-macros)
    870  VBOX_GCC32_LIBGCC ?= $(VBOX_GCC_LIBGCC)
    871 endif
    872 
    873 # Find the compiler defines (for IPRT no-crt).
    874 ifndef VBOX_PATH_GCC_INCS
    875  export VBOX_PATH_GCC_INCS := $(abspath $(dir $(shell LC_ALL=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)))/include
    876 endif
    877 
    878 # L4
     831
     832# No $(QUIET) here as it's interesting to see what goes into the file.
     833$(PATH_OUT)/GCCConfig.kmk: $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG)
     834        $(call MSG_GENERATE,,$@,)
     835        $(QUIET)$(RM) -f "$@"
     836
     837        @# HC compiler switch detction.
     838        $(APPEND) "$@" "VBOX_GCC_LIBGCC                ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)"
     839        $(APPEND) "$@" "VBOX_GCC_Wno-pointer-sign      ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)"
     840        $(APPEND) "$@" "VBOX_GCC_Wno-variadic-macros   ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)"
     841        $(APPEND) "$@" "VBOX_GCC_Wno-invalid-offsetof  ?= $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)"
     842        $(APPEND) "$@" "VBOX_GCC_Wno-extra             ?= $(call VBOX_GCC_CHECK_CXX,-Wno-extra)"
     843        $(APPEND) "$@" "VBOX_GCC_fno-stack-protector   ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)"
     844        @# Set default attribute for ELF and MACH-O symbols to ``hidden'' to reduce the number
     845        @# of relocation entries and PLT indirections in shared libraries.
     846        $(APPEND) "$@" "VBOX_GCC_fvisibility-hidden    ?= $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN,)"
     847        @# Set default attribute for inline functions to ``hidden'' to reduce the number
     848        @# of relocation entries and PLT indirections in shared libraries.
     849        $(APPEND) "$@" "VBOX_GCC_fvisibility-inlines-hidden ?= $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)"
     850        @# Find the compiler includes for IPRT no-crt.
     851        $(APPEND) "$@" "VBOX_PATH_GCC_INCS             ?= $(abspath $(dir $(shell LC_ALL=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)))/include"
     852
     853        @# 32-bit (GC) compiler switch detection.
     854        $(APPEND) "$@" "VBOX_GCC32_LIBGCC              ?= $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)"
     855        $(APPEND) "$@" "VBOX_GCC32_Wno-variadic-macros ?= $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)"
     856
    879857ifeq ($(BUILD_TARGET),l4)
    880  ifndef VBOX_PATH_L4_GCC3_INSTALL
    881   export VBOX_PATH_L4_GCC3_INSTALL := $(shell LANG=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-search-dirs|sed -ne 's+^install: \(.*[^/][^/]*\)/\?+\1+p')
    882  endif
     858        @# L4
     859        $(APPEND) "$@" "VBOX_PATH_L4_GCC3_INSTALL      ?= $(shell LANG=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-search-dirs|sed -ne 's+^install: \(.*[^/][^/]*\)/\?+\1+p')"
     860endif
     861
     862include $(PATH_OUT)/GCCConfig.kmk
     863
     864ifeq ($(BUILD_TARGET),l4)
    883865 VBOX_L4_GCC3_INCS := $(VBOX_PATH_L4_GCC3_INSTALL)/include
    884866 # L4_GPP3_INCS := \
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette