summaryrefslogtreecommitdiff
path: root/kBuild/tools/GXX32.kmk
diff options
context:
space:
mode:
Diffstat (limited to 'kBuild/tools/GXX32.kmk')
-rw-r--r--kBuild/tools/GXX32.kmk55
1 files changed, 47 insertions, 8 deletions
diff --git a/kBuild/tools/GXX32.kmk b/kBuild/tools/GXX32.kmk
index 1dea597..6c5b82e 100644
--- a/kBuild/tools/GXX32.kmk
+++ b/kBuild/tools/GXX32.kmk
@@ -1,10 +1,10 @@
-# $Id: GXX32.kmk 2246 2009-01-18 02:08:37Z bird $
+# $Id: GXX32.kmk 2541 2011-08-03 09:51:30Z bird $
## @file
# kBuild Tool Config - Generic 32-bit GCC v3.2.x or later using the system GCC, for building C++ code.
#
#
-# Copyright (c) 2004-2009 knut st. osmundsen <bird-kBuild-spamix@anduin.net>
+# Copyright (c) 2004-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
#
# This file is part of kBuild.
#
@@ -58,9 +58,15 @@ TOOL_GXX32_LD_SYSMOD_MAP ?= -Zmap=$(1)
else
TOOL_GXX32_LD_SYSMOD_MAP ?=
endif
+if1of ($(KBUILD_HOST), solaris)
+ TOOL_GXX32_OBJCOPY ?= gobjcopy$(HOSTSUFF_EXE)
+else
+ TOOL_GXX32_OBJCOPY ?= objcopy$(HOSTSUFF_EXE)
+endif
+
ifdef SLKRUNS
-TOOL_GXX32_CC += -fmessage-length=0
-TOOL_GXX32_CXX += -fmessage-length=0
+ TOOL_GXX32_CC += -fmessage-length=0
+ TOOL_GXX32_CXX += -fmessage-length=0
endif
# General Properties used by kBuild
@@ -124,6 +130,7 @@ define TOOL_GXX32_COMPILE_C_CMDS
$(flags) -fpreprocessed -x c\
-o $(obj)\
-
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef
else # !KBUILD_USE_KOBJCACHE
TOOL_GXX32_COMPILE_C_OUTPUT =
@@ -133,6 +140,7 @@ define TOOL_GXX32_COMPILE_C_CMDS
-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-o $(obj)\
$(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef
endif # !KBUILD_USE_KOBJCACHE
@@ -166,6 +174,7 @@ define TOOL_GXX32_COMPILE_CXX_CMDS
$(flags) -fpreprocessed -x c++\
-o $(obj)\
-
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef
else # !KBUILD_USE_KOBJCACHE
TOOL_GXX32_COMPILE_CXX_OUTPUT =
@@ -175,6 +184,7 @@ define TOOL_GXX32_COMPILE_CXX_CMDS
-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-o $(obj)\
$(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef
endif # !KBUILD_USE_KOBJCACHE
@@ -201,6 +211,7 @@ define TOOL_GXX32_COMPILE_AS_CMDS
-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-o $(obj)\
$(abspath $(source))
+ $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef
@@ -220,7 +231,10 @@ define TOOL_GXX32_LINK_LIBRARY_CMDS
$(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
$(QUIET)$(APPEND) -n $(out).ar-script \
$(foreach o,$(objs), 'ADDMOD $(o)') \
- $(foreach o,$(othersrc), 'ADDLIB $(o)')
+ $(foreach o,$(filter-out %.def %.imp,$(othersrc)), 'ADDLIB $(o)')
+ $(if $(filter %.def %.imp,$(othersrc))\
+ ,$(TOOL_GXX3_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp,$(othersrc))\
+ $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
$(QUIET)$(APPEND) $(out).ar-script 'SAVE'
$(QUIET)$(APPEND) $(out).ar-script 'END'
$(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GXX32_AR) -M
@@ -242,13 +256,21 @@ endef
# @param $(outbase) Output basename (full). Use this for list files and such.
TOOL_GXX32_LINK_PROGRAM_OUTPUT =
TOOL_GXX32_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
-TOOL_GXX32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX32_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX32_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
TOOL_GXX32_LINK_PROGRAM_DEPORD =
define TOOL_GXX32_LINK_PROGRAM_CMDS
$(QUIET)$(TOOL_GXX32_LD) $(flags) -o $(out) $(objs)\
$(foreach p,$(libpath), -L$(p))\
$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
$(call TOOL_GXX32_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(CHMOD) a-x $(outbase).debug
+ $(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
endef
@@ -267,7 +289,10 @@ endef
# @param $(outbase) Output basename (full). Use this for list files and such.
TOOL_GXX32_LINK_DLL_OUTPUT =
TOOL_GXX32_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
-TOOL_GXX32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX32_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX32_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
TOOL_GXX32_LINK_DLL_DEPORD =
define TOOL_GXX32_LINK_DLL_CMDS
$(QUIET)$(TOOL_GXX32_LD) $(TOOL_GXX32_LDFLAGS.dll) $(flags) -o $(out)\
@@ -276,6 +301,11 @@ define TOOL_GXX32_LINK_DLL_CMDS
$(foreach p,$(libpath), -L$(p))\
$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
$(call TOOL_GXX32_LD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(CHMOD) a-x $(outbase).debug
+ $(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
endef
@@ -294,12 +324,21 @@ endef
# @param $(outbase) Output basename (full). Use this for list files and such.
TOOL_GXX32_LINK_SYSMOD_OUTPUT =
TOOL_GXX32_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
-TOOL_GXX32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
+TOOL_GXX32_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
+TOOL_GXX32_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
+TOOL_GXX32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
+ $(filter %.def, $(othersrc))
TOOL_GXX32_LINK_SYSMOD_DEPORD =
define TOOL_GXX32_LINK_SYSMOD_CMDS
$(QUIET)$(TOOL_GXX32_LD_SYSMOD) $(TOOL_GXX32_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
+ $(filter %.def, $(othersrc))\
$(foreach p,$(libpath), -L$(p))\
$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
$(call TOOL_GXX32_LD_SYSMOD_MAP,$(outbase).map)
+ ifeq ($(ld_debug),split)
+ $(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
+ $(CHMOD) a-x $(outbase).debug
+ $(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
+ endif
endef