]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/mk/Makeconf
update
[l4.git] / l4 / mk / Makeconf
index 2e5ff4720d3416f53b86cb22658fde42fb565d25..817c35b99270bd7c5c9827b842997d2b8fe3702e 100644 (file)
@@ -1,8 +1,6 @@
 # -*- Makefile -*-
 # vim:set ft=make:
 #
-# DROPS (Dresden Realtime OPerating System) Component
-#
 # Make configuration file
 #
 # This file is included by all Makefile-templates. This file defines macros
@@ -27,7 +25,7 @@
 ifeq ($(origin _L4DIR_MK_MAKECONF),undefined)
 _L4DIR_MK_MAKECONF=y
 
-MAKEFLAGS        += -R
+MAKEFLAGS        += --no-print-directory -Rr
 
 # the default target is all
 all::
@@ -35,46 +33,52 @@ all::
 # make .general.d dependent on the role-file
 $(if $(ROLE),$(OBJ_DIR)/.general.d: $(L4DIR)/mk/$(ROLE))
 
-SYSTEM_TARGET_arm   = arm-linux-
-SYSTEM_TARGET_ppc32 = powerpc-linux-
-SYSTEM_TARGET      = $(SYSTEM_TARGET_$(ARCH))
+SYSTEM_TARGET_arm     = arm-linux-
+SYSTEM_TARGET_ppc32   = powerpc-linux-
+SYSTEM_TARGET_sparc   = $(if $(GCCIS_sparc_leon),sparc-elf-,sparc-linux-)
+SYSTEM_TARGET         = $(SYSTEM_TARGET_$(ARCH))
 
 CARCHFLAGS_amd64    = -mno-red-zone
 ASFLAGS_amd64       = -m64
 LDFLAGS_amd64      += -m elf_x86_64 -z max-page-size=0x1000 -z common-page-size=0x1000
 
-LD_EMULATION_CHOICE_amd64 = elf_x86_64
-LD_EMULATION_CHOICE_arm   = armelf armelf_linux_eabi
-LD_EMULATION_CHOICE_ppc32 = elf32ppc
-LD_EMULATION_CHOICE_x86   = elf_i386
+LD_EMULATION_CHOICE_amd64   = elf_x86_64
+LD_EMULATION_CHOICE_arm     = armelf armelf_linux_eabi
+LD_EMULATION_CHOICE_ppc32   = elf32ppc
+LD_EMULATION_CHOICE_x86     = elf_i386
+LD_EMULATION_CHOICE_sparc   = $(if $(GCCIS_sparc_leon),sparcleon,elf32_sparc)
 
 OFORMAT_amd64     = elf64-x86-64
 OFORMAT_arm       = elf32-littlearm
 OFORMAT_ppc32     = elf32-powerpc
 OFORMAT_x86       = elf32-i386
+OFORMAT_sparc     = elf32-sparc
 OFORMAT           = $(OFORMAT_$(ARCH))
 
 BFD_ARCH_amd64    = i386
 BFD_ARCH_arm      = arm
 BFD_ARCH_ppc32    = powerpc
 BFD_ARCH_x86      = i386
+BFD_ARCH_sparc    = sparc
 BFD_ARCH          = $(BFD_ARCH_$(ARCH))
 
-L4_KIP_ADDR_amd64  ?= 0x6ffff000
-L4_KIP_ADDR_arm    ?= 0xaffff000
-L4_KIP_ADDR_ppc32  ?= 0xaffff000
-L4_KIP_ADDR_x86    ?= 0xaffff000
-L4_KIP_ADDR        ?= $(L4_KIP_ADDR_$(ARCH))
+L4_KIP_ADDR_amd64   ?= 0x6ffff000
+L4_KIP_ADDR_arm     ?= 0xaffff000
+L4_KIP_ADDR_ppc32   ?= 0xaffff000
+L4_KIP_ADDR_x86     ?= 0xaffff000
+L4_KIP_ADDR_sparc   ?= 0xaffff000
+L4_KIP_ADDR         ?= $(L4_KIP_ADDR_$(ARCH))
 
 L4_KIP_OFFS_SYS_INVOKE   = 0x800
 L4_KIP_OFFS_SYS_DEBUGGER = 0x900
 
-L4_STACK_ADDR_amd64 ?= 0x70000000
-L4_STACK_ADDR_arm   ?= 0xb0000000
-L4_STACK_ADDR_ppc32 ?= 0xb0000000
-L4_STACK_ADDR_x86   ?= 0xb0000000
-L4_STACK_ADDR       ?= $(L4_STACK_ADDR_$(ARCH))
-L4_STACK_SIZE       ?= $(if $(L4_STACK_SIZE_MAIN_THREAD),$(L4_STACK_SIZE_MAIN_THREAD),0x8000)
+L4_STACK_ADDR_amd64     ?= 0x70000000
+L4_STACK_ADDR_arm       ?= 0xb0000000
+L4_STACK_ADDR_ppc32     ?= 0xb0000000
+L4_STACK_ADDR_x86       ?= 0xb0000000
+L4_STACK_ADDR_sparc     ?= 0xb0000000
+L4_STACK_ADDR           ?= $(L4_STACK_ADDR_$(ARCH))
+L4_STACK_SIZE           ?= $(if $(L4_STACK_SIZE_MAIN_THREAD),$(L4_STACK_SIZE_MAIN_THREAD),0x8000)
 
 # This is quite bad: There is no other chance to disable the page-alignedment
 # of the linker. The linker aligns the first section at 0x100000 for AMD64!
@@ -87,13 +91,11 @@ DEPEND_VERBOSE   = $(if $(CONFIG_DEPEND_VERBOSE),,@)
 DROPS_STDDIR     = $(patsubst "%",%,$(CONFIG_DROPS_STDDIR))
 DROPS_INSTDIR    = $(patsubst "%",%,$(CONFIG_DROPS_INSTDIR))
 RAM_SIZE_MB      = $(CONFIG_RAM_SIZE_MB)
-RAM_BASE         = $(CONFIG_RAM_BASE)
-ARM_PLATFORM_TYPE= $(patsubst "%",%,$(CONFIG_ARM_PLATFORM_TYPE))
-PPC_PLATFORM_TYPE= $(patsubst "%",%,$(CONFIG_PPC_PLATFORM_TYPE))
+PLATFORM_TYPE    = $(patsubst "%",%,$(CONFIG_PLATFORM_TYPE))
 CPU              = $(patsubst "%",%,$(CONFIG_CPU))
 BUILD_ABI        = $(patsubst "%",%,$(CONFIG_BUILD_ABI))
 BUILD_ARCH       = $(patsubst "%",%,$(CONFIG_BUILD_ARCH))
-LABEL            = $(patsubst "%",%,$(CONFIG_LABEL))
+MAKECONFS_ADD    = $(patsubst "%,%,$(patsubst %",%,$(CONFIG_MAKECONFS_ADD))) #"
 
 CARCHFLAGS_x86_586        = -march=i586
 CARCHFLAGS_x86_pentium    = -march=i586
@@ -113,28 +115,74 @@ CARCHFLAGS_x86_athlon4    = -march=athlon-4
 CARCHFLAGS_x86_K8         = -march=k8
 CARCHFLAGS_x86_opteron    = -march=opteron
 
-CARCHFLAGS_arm            = -march=$(CPU)
+CARCHFLAGS_amd64_K8       = -march=k8
+CARCHFLAGS_amd64_K10      = -march=k10
+CARCHFLAGS_amd64_opteron  = -march=opteron
+
+CARCHFLAGS_arm_armv4      = -march=armv4
+CARCHFLAGS_arm_armv4t     = -march=armv4t
+CARCHFLAGS_arm_armv5      = -march=armv5
+CARCHFLAGS_arm_armv5t     = -march=armv5t
+CARCHFLAGS_arm_armv5te    = -march=armv5te
+CARCHFLAGS_arm_armv6      = -march=armv6
+CARCHFLAGS_arm_armv6t2    = -march=armv6t2
+CARCHFLAGS_arm_armv6zk    = -march=armv6zk
+CARCHFLAGS_arm_armv7a     = -march=armv7-a
+CARCHFLAGS_arm_armv7r     = -march=armv7-r
+
+CARCHFLAGS_sparc_v7          = -mcpu=v7
+# the -Wa.. is probably a gcc buglet fix only, check again later
+CARCHFLAGS_sparc_leon        = -mcpu=leon -Wa,-Av8
+CARCHFLAGS_sparc_leon3       = -mcpu=leon3
+CARCHFLAGS_sparc_v8          = -mcpu=v8
+CARCHFLAGS_sparc_v9          = -mcpu=v9
+CARCHFLAGS_sparc_ultrasparc  = -mcpu=ultrasparc
+CARCHFLAGS_sparc_ultrasparc3 = -mcpu=ultrasparc3
+CARCHFLAGS_sparc_niagara     = -mcpu=niagara
+CARCHFLAGS_sparc_niagara2    = -mcpu=niagara2
+CARCHFLAGS_sparc_niagara3    = -mcpu=niagara3
+CARCHFLAGS_sparc_niagara4    = -mcpu=niagara4
 
 IDL_SYSTEMS    = x86-l4f
 
-CC_x86          = $(SYSTEM_TARGET)gcc -m32
-CC_amd64        = $(SYSTEM_TARGET)gcc -m64
+CCXX_FLAGS_arm   += -marm
+CCXX_FLAGS_amd64 += -m64
+CCXX_FLAGS_ppc32 += -m32
+CCXX_FLAGS_sparc += -m32
+CCXX_FLAGS_x86   += -m32
+CCXX_FLAGS        = $(CCXX_FLAGS_$(BUILD_ARCH))
+
+CC_x86          = $(SYSTEM_TARGET)gcc
+CC_amd64        = $(SYSTEM_TARGET)gcc
 CC_arm          = $(SYSTEM_TARGET)gcc
-CC_ppc32        = $(SYSTEM_TARGET)gcc -m32
-CXX_x86         = $(SYSTEM_TARGET)g++ -m32
-CXX_amd64       = $(SYSTEM_TARGET)g++ -m64
+CC_ppc32        = $(SYSTEM_TARGET)gcc
+CC_sparc        = $(SYSTEM_TARGET)gcc
+CXX_x86         = $(SYSTEM_TARGET)g++
+CXX_amd64       = $(SYSTEM_TARGET)g++
 CXX_arm         = $(SYSTEM_TARGET)g++
-CXX_ppc32       = $(SYSTEM_TARGET)g++ -m32
-
-AR             = $(SYSTEM_TARGET)ar
-AS             = $(SYSTEM_TARGET)as
-AWKP           = gawk --posix
-CC             = $(if $(USE_CCACHE),ccache) $(CC_$(BUILD_ARCH))
-CXX            = $(if $(USE_CCACHE),ccache) $(CXX_$(BUILD_ARCH))
-CP             = cp
+CXX_ppc32       = $(SYSTEM_TARGET)g++
+CXX_sparc       = $(SYSTEM_TARGET)g++
+FC_x86          = $(SYSTEM_TARGET)gfortran
+FC_amd64        = $(SYSTEM_TARGET)gfortran
+FC_arm          = $(SYSTEM_TARGET)gfortran
+FC_ppc32        = $(SYSTEM_TARGET)gfortran
+FC_sparc        = $(SYSTEM_TARGET)gfortran
+
+SYSTEMS_ABI    := x86-l4f amd64-l4f arm-l4f ppc32-l4f sparc-l4f
+SYSTEMS_PLAIN  := x86     amd64     arm     ppc32     sparc
+
+dv               = $(if $(filter-out default undefined,$(origin $(1))),$(1)-default,$(1))
+
+$(call dv,AR)   = $(SYSTEM_TARGET)ar
+$(call dv,AS)   = $(SYSTEM_TARGET)as
+AWKP           ?= gawk --posix
+$(call dv,CC)    = $(if $(USE_CCACHE),ccache )$(CC_$(BUILD_ARCH))
+$(call dv,CXX)   = $(if $(USE_CCACHE),ccache )$(CXX_$(BUILD_ARCH))
+$(call dv,FC)    = $(if $(USE_CCACHE),ccache )$(FC_$(BUILD_ARCH))
+CP             ?= cp
 DICE_SRCDIR    ?= $(L4DIR)/../dice
 DICE_OBJDIR    ?= $(DICE_SRCDIR)
-DICE           = $(firstword $(wildcard $(DICE_OBJDIR)/src/dice \
+DICE           ?= $(firstword $(wildcard $(DICE_OBJDIR)/src/dice \
                                $(DROPS_STDDIR)/tool/bin/dice \
                                 $(shell which dice 2>/dev/null) ) \
                                 did_not_find_dice___please_install_dice )
@@ -143,7 +191,7 @@ DICE_CPP_NAME       = cpp0
 DICE_INCDIR    ?= $(DICE_SRCDIR)/include
 
 DOXYGEN                ?= doxygen
-ECHO           = echo
+ECHO           ?= echo
 ELF_PATCHER     = $(OBJ_BASE)/tool/elf-patcher/elf-patcher
 
 GENOFFSETS     = $(L4DIR)/tool/bin/genoffsets.pl
@@ -151,48 +199,64 @@ GOSH              = $(firstword $(wildcard $(L4DIR)/../tools/gosh/gosh \
                                $(DROPS_STDDIR)/tool/bin/gosh \
                                 $(shell which gosh 2>/dev/null) ) \
                                 did_not_find_gosh___please_install_gosh )
-HOST_CC                = gcc
-HOST_CXX       = g++
-INDENT         = indent -sob
+HOST_CC                ?= gcc
+HOST_CXX       ?= g++
+HOST_LD                ?= ld
 INSTALL                = install
-LD             = $(SYSTEM_TARGET)ld
+$(call dv,LD)   = $(SYSTEM_TARGET)ld -m $(LD_EMULATION)
 LATEX          = latex
 PDFLATEX       = pdflatex
 GREP           = GREP_OPTIONS= grep
 LN             = ln
 MKDIR          = mkdir -p
 MKFLAGS                +=$(MKFLAGS_$@)
-NM             = $(SYSTEM_TARGET)nm
-OBJCOPY                = $(SYSTEM_TARGET)objcopy
-PKG_CONFIG      = pkg-config --silence-errors
-PWDCMD         = sh -c pwd
-RANLIB         = $(SYSTEM_TARGET)ranlib
-RM             = rm -f
+NM             ?= $(SYSTEM_TARGET)nm
+OBJCOPY                ?= $(SYSTEM_TARGET)objcopy
+PKG_CONFIG      = pkg-config
+PWDCMD         = pwd -P
+RANLIB         ?= $(SYSTEM_TARGET)ranlib
+$(call dv,RM)   = rm -f
 SCRUB          = $(RM) $(wildcard *.old) $(wildcard *~) $(wildcard *.bak) \
-                        $(wildcard \#*\#)
+                       $(wildcard \#*\#)
 SED            = sed
-SHELL          = /bin/bash
-SIZE           = $(SYSTEM_TARGET)size
-STRIP          = $(SYSTEM_TARGET)strip
+SHELL          = bash
+SIZE           ?= $(SYSTEM_TARGET)size
+STRIP          ?= $(SYSTEM_TARGET)strip
 SVN            = svn
 TR             = tr
 GEN_DOPECODE   = $(L4DIR)/tool/gen_dopecode/gen_dopecode
 ABS2REL                = $(L4DIR)/tool/bin/abs2rel.sh
-# it's optional to be able to set it as environment variable
+# it is optional to be able to set it as environment variable
 FIASCOUX       ?= $(L4DIR)/../kernel/fiasco/build-ux/fiasco
 PAGER          ?= less
-DISASM_CMD      ?= $(SYSTEM_TARGET)objdump -ld $(1) | $(PAGER)
+DISASM_CMD      ?= $(SYSTEM_TARGET)objdump -lCSd $(1) | $(PAGER)
 IMAGES_DIR      ?= $(OBJ_BASE)/images
 
-
 # functions that are handy
 absfilename_target_dir_needs_to_exist = $(foreach w,$(1),$(addsuffix /$(notdir $(w)),$(shell cd $(dir $(w)) 2>/dev/null&&$(PWDCMD))))
-absfilename     = $(shell $(L4DIR)/mk/rel2abs.sh $(1))
+absfilename     = $(shell PWD=$$($(PWDCMD)) $(L4DIR)/mk/rel2abs.sh $(1))
 findfile       = $(firstword $(wildcard $(addsuffix /$(1),$(2))) $(1)_NOT_FOUND)
 is_dir          = $(shell test -d '$(1)' && echo yes)
+define create_dir
+  $(if $(wildcard $(1)),,$(VERBOSE)$(INSTALL) -d $(1))
+endef
+
+# Move $(2) to $(1) if content of both files differ
+define move_if_changed
+  $(VERBOSE)if test ! -r "$(1)" || ! cmp -s $(1) $(2); then \
+    mv $(2) $(1); \
+  else \
+    rm $(2); \
+  fi
+endef
+
+ifneq ($(PT),)
+  PLATFORM_TYPE := $(PT)
+endif
 
 # include this one early to be able to set OBJ_BASE
 -include $(L4DIR)/Makeconf.local
+-include $(L4DIR)/conf/Makeconf.local
 
 ifeq ($(filter $(IGNORE_OBJDIR_TARGETS),$(MAKECMDGOALS)),)
 # output directory
@@ -219,7 +283,7 @@ ifeq ($(origin PKGDIR_ABS),undefined)
 PKGDIR_ABS     := $(call absfilename,$(PKGDIR))
 endif
 ifeq ($(origin SRC_DIR),undefined)
-SRC_DIR        := $(shell pwd)
+SRC_DIR        := $(shell $(PWDCMD))
 endif
 ifeq ($(origin SRC_BASE_ABS),undefined)
 SRC_BASE     ?= $(L4DIR)
@@ -282,17 +346,44 @@ endif
 # if we're working on a program that wants the RAM_BASE be considered in its
 # linking address, source a possible privately configured one
 ifneq ($(RELOC_PHYS),)
--include $(OBJ_BASE)/Makeconf.ram_base
-EXTRA_GENERAL_D_DEP += $(if $(wildcard $(OBJ_BASE)/Makeconf.ram_base),$(OBJ_BASE)/Makeconf.ram_base)
+INCLUDE_BOOT_CONFIG := required
+endif
+
+ifneq ($(INCLUDE_BOOT_CONFIG),)
+ PLATFORM_CONF_FILE := $(wildcard $(L4DIR)/conf/platforms/$(PLATFORM_TYPE).conf $(L4DIR)/mk/platforms/$(PLATFORM_TYPE).conf)
+ ifneq ($(PLATFORM_TYPE),$(patsubst "%",%,$(CONFIG_PLATFORM_TYPE)))
+  include $(PLATFORM_CONF_FILE)
+ else
+  ifneq ($(CONFIG_PLATFORM_TYPE_custom),)
+   PLATFORM_RAM_BASE=$(CONFIG_PLATFORM_RAM_BASE)
+   PLATFORM_RAM_SIZE_MB=$(CONFIG_PLATFORM_RAM_SIZE_MB)
+  else
+   ifeq ($(INCLUDE_BOOT_CONFIG),optional)
+    -include $(PLATFORM_CONF_FILE)
+   else
+    include $(PLATFORM_CONF_FILE)
+   endif
+  endif
+ endif
+ -include $(L4DIR)/conf/Makeconf.boot
+ -include $(OBJ_BASE)/conf/Makeconf.boot
+ -include $(OBJ_BASE)/Makeconf.ram_base
+ BID_RAM_BASE_DEP := $(if $(wildcard $(OBJ_BASE)/Makeconf.ram_base),$(OBJ_BASE)/Makeconf.ram_base)
+ ifeq ($(RAM_BASE),)
+  RAM_BASE := 0
+ endif
+ RAM_SIZE_MB := $(if $(RAM_SIZE_MB),$(RAM_SIZE_MB),$(PLATFORM_RAM_SIZE_MB))
 endif
 
-INCLUDE_MAKE_RULES += $(if $(LABEL),$(L4DIR)/Makeconf.$(LABEL))
+INCLUDE_MAKE_RULES += $(foreach m,$(MAKECONFS_ADD),$(SRC_DIR)/Makeconf.$(m))
 
-ifneq ($(strip $(wildcard $(INCLUDE_MAKE_RULES))),)
--include $(wildcard $(INCLUDE_MAKE_RULES))
+INCLUDE_MAKE_RULES_EXPANDED := $(foreach m,$(INCLUDE_MAKE_RULES),$(wildcard $(m)))
+ifneq ($(strip $(INCLUDE_MAKE_RULES_EXPANDED)),)
+-include $(INCLUDE_MAKE_RULES_EXPANDED)
 endif
 
 -include $(OBJ_BASE)/Makeconf.local
+-include $(OBJ_BASE)/conf/Makeconf.local
 ifneq ($(PKGDIR_ABS),)
 -include $(PKGDIR_ABS)/Makeconf.local
 endif
@@ -301,9 +392,6 @@ MAKECONFLOCAL ?= Makeconf.local
 -include $(MAKECONFLOCAL)
 
 DROPS_STDDIR   ?= /home/drops
-ifeq ($(STATICFILE),)
-STATICFILE     = $(OBJ_BASE)/pkg/STATIC $(L4DIR)/pkg/STATIC
-endif
 
 # a nasty workaround for make-3.79/make-3.80. The former needs an additional
 # $$ for $-quotation when calling a function.
@@ -318,11 +406,6 @@ PL_j := -j $(PL)
 export PL
 endif
 
-BID_INT_NOEXC=n
-ifeq ($(MODE_NOEXC),y)
-BID_INT_NOEXC=y
-endif
-
 include $(L4DIR)/mk/config.inc
 
 ifneq ($(CONFIG_HAVE_LDSO),)
@@ -355,35 +438,56 @@ ifeq ($(HOST_SYSTEM),darwin)
 endif
 MAKEDEP=$(LD_GENDEP_PREFIX) \
                GENDEP_TARGET=$(if $(2),$(2),$@) \
-               GENDEP_BINARY=$(1) $(if $(3),GENDEP_DEPFILE=$(3)) \
+               GENDEP_BINARY=$(firstword $(1)) $(if $(3),GENDEP_DEPFILE=$(3)) \
                $(if $(4),GENDEP_BINARY_ALT1=$(4))
 endif
 
+# We recognize the following Fortran file extensions.
+FORTRAN_FILE_EXTENSIONS = .f .F .f90 .F90 .f95 .F95
+
 # macros used here and in packages
-checkcc   = $(shell if $(CC) $(1) -o /dev/null -c -x c \
+checkcc   = $(shell if $(CC)  $(CCXX_FLAGS) $(1) -o /dev/null -c -x c \
                     /dev/null > /dev/null 2>&1; then echo "$(1)"; fi)
-checkcxx  = $(shell if $(CXX) $(1) -o /dev/null -c -x c++ \
+checkcxx  = $(shell if $(CXX) $(CCXX_FLAGS) $(1) -o /dev/null -c -x c++ \
                     /dev/null > /dev/null 2>&1; then echo "$(1)"; fi)
 
-# the gcc specific variables: version, base dir, include dir, gcc lib
+callcc    = LC_ALL=C $(CC)  $(CCXX_FLAGS)
+callcxx   = LC_ALL=C $(CXX) $(CCXX_FLAGS)
+callfc    = LC_ALL=C $(FC)  $(CCXX_FLAGS)
+
+# the gcc specific variables: version, base dir, include dir, gcc lib, ...
 # note: determining these variables is slow, and the values should
 #       be set in .config.all. However, this is the place were
 #       they are determined on a 'make config' in $(L4DIR)
-GCCVERSION_f   = $(shell $(CC) -dumpversion | sed -e 's/\(.*\)\..*/\1/')
-GCCMAJORVERSION_f=$(shell $(CC) -dumpversion | sed -e 's/\([^.]*\).*/\1/')
-GCCMINORVERSION_f=$(shell $(CC) -dumpversion | sed -e 's/[^.]*\.\([^.]*\).*/\1/')
-GCCSUBVERSION_f        = $(shell $(CC) -dumpversion | sed -e 's/.*\.\(.*\)/\1/')
-LDVERSION_f     = $(shell $(LD) -v | sed -e 's/.* \([0-9]\)\.\([^. ]*\).*/\1\2/')
-GCCSYSLIBDIRS_f = $(shell LC_ALL=C $(CC) -print-search-dirs | sed '/^libraries:/{s/^libraries: /-L/;s/:/ -L/g;q;};d')
-GCCDIR_f       = $(shell LC_ALL=C $(CC) -print-search-dirs|sed -ne 's+^install: \(.*[^/][^/]*\)/+\1+p' )
-GCCLIBDIR_f    = $(shell LC_ALL=C $(CC) -print-file-name=)
-GCCLIB_f       = $(shell $(CC) -print-libgcc-file-name)
-GCCLIB_EH_f    = $(filter /%,$(shell $(CC) -print-file-name=libgcc_eh.a))
+GCCVERSION_f   = $(shell $(callcc) -dumpversion | sed -e 's/\([^.]\+\.[^.]\+\).*/\1/')
+GCCMAJORVERSION_f=$(shell $(callcc) -dumpversion | sed -e 's/\([^.]*\).*/\1/')
+GCCMINORVERSION_f=$(shell $(callcc) -dumpversion | sed -e 's/[^.]*\.\([^.]*\).*/\1/')
+GCCSUBVERSION_f        = $(shell $(callcc) -dumpversion | sed -e 's/.*\.\(.*\)/\1/')
+LDVERSION_f     = $(shell $(firstword $(LD)) -v | sed -e 's/.* \([0-9]\)\.\([^. ]*\).*/\1\2/')
+GCCSYSLIBDIRS_f = $(shell $(callcc) -print-search-dirs | sed '/^libraries:/{s/^libraries: =\?/-L/;s/:/ -L/g;q;};d')
+GCCDIR_f       = $(shell $(callcc) -print-search-dirs | sed -ne 's+^install: \(.*[^/][^/]*\)/+\1+p' )
+GCCLIB_file_f   = $(shell $(callcc) -print-file-name=$(1))
+GCCLIB_HOST_f  = $(shell $(callcc) -print-libgcc-file-name)
+GCCLIB_S_SO_f  = $(filter /%,$(shell $(callcc) -print-file-name=libgcc_s.so))
+GCCLIB_EH_f    = $(filter /%,$(shell $(callcc) -print-file-name=libgcc_eh.a))
 GCCINCDIR_f    = $(addprefix $(call GCCDIR_f),/include /include-fixed)
 GCCNOSTACKPROTOPT_f= $(call checkcc,-fno-stack-protector)
+GCCFORTRANAVAIL_f = $(shell echo | $(callfc) -dD -E - 2>&1 | grep -q __GNUC__ && echo y)
+GCCNOFPU_x86_f  = $(call checkcc,-mno-mmx) $(call checkcc,-mno-3dnow) \
+                  $(call checkcc,-mno-sse) $(call checkcc,-mno-sse2)  \
+                  $(call checkcc,-mno-sse3) $(call checkcc,-mno-sse4) \
+                  $(call checkcc,-mno-sse4a)
+GCC_HAS_ATOMICS_f = $(shell if echo '\#include <bits/c++config.h>' | \
+                              $(callcxx) -dD -E -x c++ - | \
+                              grep -q _GLIBCXX_ATOMIC_BUILTINS; then \
+                                echo y; fi)
+GCCIS_sparc_leon_f= $(shell if $(CC) -dD -E -x c /dev/null 2>&1 | grep -qw __leonbare__; then echo y; fi)
 
 GCCINCDIR      = $(GCCDIR)/include $(GCCDIR)/include-fixed
-I_GCCINCDIR    = $(addprefix -I,$(GCCINCDIR))
+I_GCCINCDIR    = $(addprefix -isystem ,$(GCCINCDIR))
+
+GCCLIB          = $(OBJ_BASE)/lib/$(subst -,/,$(SYSTEM))/libgcc.a
+GCCLIB_SO       = $(OBJ_BASE)/lib/$(subst -,/,$(SYSTEM))/libgcc.$(if $(filter %l4f,$(SYSTEM)),so,a)
 
 ifneq ($(PKGDIR),)
   ifeq ($(origin PKGNAME),undefined)
@@ -406,16 +510,14 @@ ifeq ($(CONFIG_RELEASE_MODE),y)
 DEFINES                += -DL4BID_RELEASE_MODE
 endif
 
-ifeq ($(ARCH),arm)
-ifeq ($(RAM_BASE),)
-$(error RAM_BASE not given, needed for ARM architecture builds.)
-endif
-else #arch != arm
-  RAM_BASE     = 0x0
+ifneq ($(filter linux host,$(MODE)),)
+HOST_LINK        := 1
+HOST_LINK_HOST   := 1
 endif
 
-ifneq ($(filter linux l4linux host,$(MODE)),)
-HOST_LINK      := 1
+ifneq ($(filter l4linux,$(MODE)),)
+HOST_LINK        := 1
+HOST_LINK_TARGET := 1
 endif
 
 #
@@ -491,6 +593,8 @@ $(GENERAL_D_LOC): $(L4DIR)/mk/Makeconf $(EXTRA_GENERAL_D_DEP)
                $(OBJ_BASE)/Makeconf.local)
        $(DEPEND_VERBOSE)$(call BID_DEPEND_GENERAL_D_COND,\
                $(L4DIR)/Makeconf.local)
+       $(DEPEND_VERBOSE)$(call BID_DEPEND_GENERAL_D_COND,\
+               $(L4DIR)/conf/Makeconf.local)
        $(DEPEND_VERBOSE)$(foreach m,$(wildcard $(INCLUDE_MAKE_RULES)),\
                $(call BID_DEPEND_GENERAL_D_COND,$(m)); )
        $(if $(PKGDIR_ABS),$(DEPEND_VERBOSE)$(call BID_DEPEND_GENERAL_D_COND,\
@@ -561,4 +665,27 @@ addfileheader:
 
 .PHONY: FORCE
 
+#
+# Common functions
+#
+
+# 1: name
+# 2: output file
+# 3: inc path (one only)
+# 4: libs
+# 5: requires_libs
+generate_pcfile =                                                            \
+       mkdir -p $(dir $(2))                                                 \
+       ;echo -n                                                    > $(2)   \
+       $(if $(3),;echo "incdir=/empty_incdir"                     >> $(2))  \
+       ;echo "Name: $(1)"                                         >> $(2)   \
+       ;echo "Version: 0"                                         >> $(2)   \
+       ;echo "Description: L4 library"                            >> $(2)   \
+       $(if $(3),;echo "Cflags: $(addprefix -I\$${incdir}/,$(3))" >> $(2))  \
+       $(if $(4),;echo "Libs: $(4)"                               >> $(2))  \
+       $(if $(5),;echo "Requires: $(5)"                           >> $(2))  \
+       $(if $(BID_GEN_CONTROL),;echo "Provides: $(1)"             >> $(PKGDIR)/Control) \
+       $(if $(BID_GEN_CONTROL),;echo "Requires: $(5)"             >> $(PKGDIR)/Control) ;
+
+
 endif  # _L4DIR_MK_MAKECONF undefined