diff options
author | Felix Geyer <fgeyer@debian.org> | 2013-01-26 15:15:05 +0100 |
---|---|---|
committer | Felix Geyer <fgeyer@debian.org> | 2013-01-26 15:15:05 +0100 |
commit | b31bdef8a3eba48bf069962004794c7ca58a6b92 (patch) | |
tree | ff96a893bef3b0d60355ceed717ef44f04168114 | |
parent | 361f05c7a4ee30ae04d1168db696e7003bd43dfc (diff) | |
download | kbuild-b31bdef8a3eba48bf069962004794c7ca58a6b92.tar.gz |
Imported Upstream version 0.1.9998svn2577+dfsgupstream/0.1.9998svn2577+dfsg
71 files changed, 4135 insertions, 398 deletions
@@ -1,4 +1,4 @@ -# $Id: Config.kmk 2538 2011-08-02 20:00:46Z bird $ +# $Id: Config.kmk 2555 2011-11-30 20:01:57Z bird $ ## @file # Build Configuration. # @@ -48,7 +48,7 @@ ifneq ($(wildcard $(PATH_ROOT)/SvnInfo.kmk),) KBUILD_SVN_INFO_KMK := $(PATH_ROOT)/SvnInfo.kmk KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK) -else ifneq ($(wildcard $(PATH_ROOT)/.svn/entries),) +else ifneq ($(wildcard $(PATH_ROOT)/.svn/entries $(PATH_ROOT)/../.svn/entries),) # Generate from svn info KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK) @@ -99,7 +99,7 @@ PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk # # Various platform specific hacks. # -ifn1of ($(KBUILD_TARGET), openbsd) +ifn1of ($(KBUILD_TARGET), haiku openbsd) GCC_Wextra = -Wextra endif if1of ($(KBUILD_TARGET), openbsd) @@ -336,7 +336,7 @@ endif TEMPLATE_BIN-THREADED = Threaded command line binary TEMPLATE_BIN-THREADED_EXTENDS = BIN TEMPLATE_BIN-THREADED_EXTENDS_BY = appending -if1of ($(KBUILD_TARGET), dragonfly freebsd openbsd) +if1of ($(KBUILD_TARGET), dragonfly freebsd linux openbsd) TEMPLATE_BIN-THREADED_LIBS = pthread endif diff --git a/VSlickMacros/kkeys.e b/VSlickMacros/kkeys.e index ce6af56..d447ef3 100644 --- a/VSlickMacros/kkeys.e +++ b/VSlickMacros/kkeys.e @@ -1,4 +1,4 @@ -/* $Id: kkeys.e 2437 2011-03-28 19:17:08Z bird $ */ +/* $Id: kkeys.e 2558 2012-02-13 12:36:03Z bird $ */ /** @file * Bird's key additions to Visual Slickedit. */ @@ -137,7 +137,7 @@ _command kkeys_delete_right() { col=p_col; - /* virtual space hack*/ + /* virtual space hack */ keyin(" "); left(); _delete_char(); @@ -145,12 +145,23 @@ _command kkeys_delete_right() /* are we in a word, delete it? */ ch = get_text(); if (ch != ' ' && ch != "\t" && ch != "\r" && ch != "\n") + { + /* Delete word and any trailing spaces, but stop at new line. */ delete_word(); - /* delete spaces and newlines until the next word. */ - ch = get_text(); - if (ch == ' ' || ch == "\t" || ch == "\r" || ch == "\n") + ch = get_text(); + if (ch == ' ' || ch == "\t" || ch == "\r" || ch == "\n") + { + if (search('[ \t]#','r+') == 0) + { + _nrseek(match_length('s')); + _delete_text(match_length()); + } + } + } + else { + /* delete spaces and newlines until the next word. */ if (search('[ \t\n\r]#','r+') == 0) { _nrseek(match_length('s')); @@ -162,25 +173,6 @@ _command kkeys_delete_right() //retrieve_command_results() } -_command kkeys_delete_left() -{ - //denne virker ikkje som den skal!!! - message "not implemented" -/* - return; - col=p_col - search('[ \t]#|?|$|^','r-'); - if ( match_length()&& get_text(1,match_length('s'))=='' ) - { - _nrseek(match_length('s')); - _delete_text(match_length()); - } - else - delete_word(); - p_col=col -*/ -} - _command kkeys_scroll_up() { if (p_cursor_y == 0) diff --git a/kBuild/env.sh b/kBuild/env.sh index c0f2eb5..b832cf2 100755 --- a/kBuild/env.sh +++ b/kBuild/env.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: env.sh 2413 2010-09-11 17:43:04Z bird $ +# $Id: env.sh 2546 2011-10-01 19:49:54Z bird $ ## @file # Environment setup script. # @@ -264,6 +264,10 @@ if test -z "$KBUILD_HOST"; then KBUILD_HOST=freebsd ;; + Haiku) + KBUILD_HOST=haiku + ;; + linux|Linux|GNU/Linux|LINUX) KBUILD_HOST=linux ;; @@ -322,7 +326,7 @@ if test -z "$KBUILD_HOST_ARCH"; then x86_64|AMD64|amd64|k8|k8l|k9|k10) KBUILD_HOST_ARCH='amd64' ;; - x86|i86pc|ia32|i[3456789]86) + x86|i86pc|ia32|i[3456789]86|BePC) KBUILD_HOST_ARCH='x86' ;; sparc32|sparc|sparcv8|sparcv7|sparcv8e) diff --git a/kBuild/footer-pass1.kmk b/kBuild/footer-pass1.kmk index 6b31599..34144e9 100644 --- a/kBuild/footer-pass1.kmk +++ b/kBuild/footer-pass1.kmk @@ -1,4 +1,4 @@ -# $Id: footer-pass1.kmk 2523 2011-07-31 23:45:20Z bird $ +# $Id: footer-pass1.kmk 2551 2011-11-09 13:28:02Z bird $ ## @file # kBuild - Footer - Target lists - Pass 1. # @@ -180,9 +180,6 @@ endif $(target)_1_DEBUG_INSTTYPE := $(debug_insttype) if1of ($(debug_insttype), stage both) - ifn1of ($(insttype), stage both) - $(error kBuild: DEBUG_INSTTYPE=$(debug_insttype) and INSTTYPE=$(insttype) for target '$(target)' are not compatible) - endif local debug_stage := $(firstdefined \ $(target)_DEBUG_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \ $(target)_DEBUG_STAGE.$(bld_trg).$(bld_trg_arch) \ @@ -213,9 +210,6 @@ else endif if1of ($(debug_insttype), both) - ifn1of ($(insttype), both) - $(error kBuild: DEBUG_INSTTYPE=$(debug_insttype) and INSTTYPE=$(insttype) for target '$(target)' are not compatible) - endif local debug_inst := $(firstdefined \ $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \ $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch) \ diff --git a/kBuild/footer-pass2-compiling-targets.kmk b/kBuild/footer-pass2-compiling-targets.kmk index 172aed9..9796a9e 100644 --- a/kBuild/footer-pass2-compiling-targets.kmk +++ b/kBuild/footer-pass2-compiling-targets.kmk @@ -1,4 +1,4 @@ -# $Id: footer-pass2-compiling-targets.kmk 2537 2011-08-02 19:44:43Z bird $ +# $Id: footer-pass2-compiling-targets.kmk 2551 2011-11-09 13:28:02Z bird $ ## @file # kBuild - Footer - Target lists - Pass 2 - Compiling Targets. # @@ -347,7 +347,8 @@ endef # @param $(typevar) The name of the variable with all the root targets of its type. # @param $(target_type_mode) The default file mode implied by the target type. define def_target_install_only -ifneq ($($(target)_1_INSTTYPE),none) +if1of ($($(target)_1_INSTTYPE) $($(target)_1_DEBUG_INSTTYPE), both stage) + # Determin common variables. local mode := $(firstword \ $($(target)_MODE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \ $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \ @@ -375,7 +376,9 @@ ifneq ($($(target)_1_INSTTYPE),none) $($(target)_GID) ) local pre_install_cmds := $(evalcall def_fn_prop_get_first_defined,PRE_INST_CMDS) local post_install_cmds := $(evalcall def_fn_prop_get_first_defined,POST_INST_CMDS) +endif +ifneq ($($(target)_1_INSTTYPE),none) # Generate the rules ifeq ($($(target)_1_INSTTYPE),both) $(eval $(def_link_install_rule)) diff --git a/kBuild/header.kmk b/kBuild/header.kmk index d4c3aad..a4f51f3 100644 --- a/kBuild/header.kmk +++ b/kBuild/header.kmk @@ -1,4 +1,4 @@ -# $Id: header.kmk 2537 2011-08-02 19:44:43Z bird $ +# $Id: header.kmk 2577 2012-06-04 11:01:00Z bird $ ## @file # kBuild - File included at top of a makefile. # @@ -79,7 +79,7 @@ endif # The revision in which this file was last modified. # This can be useful when using development versions of kBuild. # -KMK_REVISION := $(patsubst %:,, $Rev: 2537 $ ) +KMK_REVISION := $(patsubst %:,, $Rev: 2577 $ ) # @@ -188,8 +188,10 @@ KBUILD_BLD_TYPES := release profile debug # this keyword namespace is shared between OSes, architectures, cpus and # build types. (PORTME) # -KBUILD_OSES := darwin dos dragonfly freebsd l4 linux netbsd nt openbsd os2 solaris win os-agnostic -KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha +KBUILD_OSES := darwin dos dragonfly freebsd haiku l4 linux netbsd nt openbsd os2 solaris win os-agnostic +KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha +KBUILD_ARCHES_64 := amd64 sparc64 s390x ppc64 mips64 ia64 hppa64 alpha +KBUILD_ARCHES_32 := x86 sparc32 s390 ppc32 mips32 hppa32 arm # @@ -961,10 +963,7 @@ PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_ MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE ## PROPS_SINGLE_LNK # Subset of PROPS_SINGLE which applies to all linkable targets. -PROPS_SINGLE_LNK := TOOL TEMPLATE CTOOL CXXTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL \ - INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \ - OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF \ - MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE +PROPS_SINGLE_LNK := $(filter-out FETCHTOOL UNPACKTOOL PATCHTOOL FETCHDIR, $(PROPS_SINGLE)) ## PROPS_DEFERRED # This list of non-accumulative target properties which are or may be @@ -992,15 +991,7 @@ PROPS_ACCUMULATE_R := \ FETCHFLAGS UNPACKFLAGS PATCHFLAGS ## PROPS_ACCUMULATE_R_LNK # Subset of PROPS_ACCUMULATE_R which applies to all linkable targets. -PROPS_ACCUMULATE_R_LNK := \ - DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \ - CFLAGS CDEFS \ - CXXFLAGS CXXDEFS \ - OBJCFLAGS OBJCDEFS \ - OBJCXXFLAGS OBJCXXDEFS \ - ASFLAGS ASDEFS \ - RCFLAGS RCDEFS \ - IDFLAGS IFFLAGS ISFLAGS +PROPS_ACCUMULATE_R_LNK := $(filter-out ARFLAGS LDFLAGS EXEC_IFFLAGS FETCHFLAGS UNPACKFLAGS PATCHFLAGS, $(PROPS_ACCUMULATE_R)) ## PROPS_ACCUMULATE # The list of accumulative target properties where the left most value/flag @@ -1014,10 +1005,7 @@ PROPS_ACCUMULATE_L := \ DIRS BLDDIRS CLEAN ## PROPS_ACCUMULATE_L_LNK # Subset of PROPS_ACCUMULATE_L which applies to all linkable targets. -PROPS_ACCUMULATE_L_LNK := \ - SDKS USES SOURCES SRC_HANDLERS INTERMEDIATES \ - INCS CINCS CXXINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \ - BLDDIRS CLEAN +PROPS_ACCUMULATE_L_LNK := $(filter-out LIBS LIBPATH EXEC_SOURCES DIRS, $(PROPS_ACCUMULATE_L)) ## PROPS_ALL # List of all the properties. @@ -1065,7 +1053,7 @@ PROPS_MISCBINS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH ## @name Properties valid on installs (INSTALLS) ## @{ -PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU MODE UID GID +PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU MODE UID GID PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS \ PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS GOALS INST_ONLY_GOALS STAGE_ONLY_GOALS IFFLAGS EXEC_IFFLAGS @@ -1268,6 +1256,68 @@ endif # +# Library path searching hints (target OS + arch). +# +# KBUILD_LIB_SEARCH_SUBS - Subdirs typically containing the right libraries. +# KBUILD_LIB_SEARCH_ROOTS - Roots to search for library subdirs. +# KBUILD_LIB_SEARCH_PATHS - ROOTS + SUBS. +# +ifeq ($(KBUILD_TARGET),darwin) + KBUILD_LIB_SEARCH_ROOTS := \ + /usr/ \ + /Developer/usr/ + KBUILD_LIB_SEARCH_SUBS := lib/ + +else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd dragonfly) + KBUILD_LIB_SEARCH_ROOTS := \ + / \ + /usr/ \ + /usr/local/ + KBUILD_LIB_SEARCH_SUBS := lib/ + +else ifeq ($(KBUILD_TARGET),linux) + KBUILD_LIB_SEARCH_ROOTS := \ + / \ + /usr/ \ + /usr/local/ + ifeq ($(KBUILD_TARGET_ARCH),amd64) + KBUILD_LIB_SEARCH_SUBS := \ + lib/x86_64-linux-gnu/ \ + lib64/ \ + lib/ + else ifeq ($(KBUILD_TARGET_ARCH),x86) + KBUILD_LIB_SEARCH_SUBS := \ + lib/i686-linux-gnu/ \ + lib/i386-linux-gnu/ \ + lib32/ \ + lib/ + else + KBUILD_LIB_SEARCH_SUBS := lib/ + endif + +else ifeq ($(KBUILD_TARGET),solaris) + KBUILD_LIB_SEARCH_ROOTS := \ + / \ + /usr/ \ + /usr/sfw/ \ + /usr/local/ \ + /sw/ + ifeq ($(KBUILD_TARGET_ARCH),amd64) + KBUILD_LIB_SEARCH_SUBS := lib/amd64/ lib/ + else ifeq ($(KBUILD_TARGET_ARCH),sparc64) + KBUILD_LIB_SEARCH_SUBS := lib/sparcv9/ lib/ + else + KBUILD_LIB_SEARCH_SUBS := lib/ + endif + +else + KBUILD_LIB_SEARCH_SUBS := + KBUILD_LIB_SEARCH_ROOTS := +endif +KBUILD_LIB_SEARCH_PATHS := $(foreach root, $(KBUILD_LIB_SEARCH_ROOTS), $(addprefix $(root),$(KBUILD_LIB_SEARCH_SUBS))) + + +# # This is how we find the closest config.kmk. # It's a little hacky but I think it works fine. # diff --git a/kBuild/sdks/LIBSDL.kmk b/kBuild/sdks/LIBSDL.kmk index 4e70de7..dbec4c2 100644 --- a/kBuild/sdks/LIBSDL.kmk +++ b/kBuild/sdks/LIBSDL.kmk @@ -1,4 +1,4 @@ -# $Id: LIBSDL.kmk 2413 2010-09-11 17:43:04Z bird $ +# $Id: LIBSDL.kmk 2566 2012-03-02 12:58:25Z bird $ ## @file # kBuild SDK - Simple DirectMedia Layer, targeting $(KBUILD_TARGET). # @@ -57,40 +57,12 @@ ifndef PATH_SDK_LIBSDL endif ifeq ($(PATH_SDK_LIBSDL),) - # Search in the typical unix places. - ifeq ($(filter-out %64,$(KBUILD_TARGET_ARCH)),) - PATH_SDK_LIBSDL := $(firstword $(wildcard \ - /lib64/libSDL.* \ - /lib/libSDL.* \ - /usr/lib64/libSDL.* \ - /usr/lib/libSDL.* \ - /usr/local/lib64/libSDL.* \ - /usr/local/lib/libSDL.* \ - /opt/lib64/libSDL.* \ - /opt/lib/libSDL.* \ - /opt/local/lib64/libSDL.* \ - /opt/local/lib/libSDL.* \ - /sw/lib64/libSDL.* \ - /sw/lib/libSDL.* \ - ) ) - else - PATH_SDK_LIBSDL := $(firstword $(wildcard \ - /lib32/libSDL.* \ - /lib/libSDL.* \ - /usr/lib32/libSDL.* \ - /usr/lib/libSDL.* \ - /usr/local/lib32/libSDL.* \ - /usr/local/lib/libSDL.* \ - /opt/lib32/libSDL.* \ - /opt/lib/libSDL.* \ - /opt/local/lib32/libSDL.* \ - /opt/local/lib/libSDL.* \ - /sw/lib32/libSDL.* \ - /sw/lib/libSDL.* \ - ) ) - endif - ifneq ($(PATH_SDK_LIBSDL),) - PATH_SDK_LIBSDL := $(patsubst %/,%,$(dir $(patsubst %/,%,$(dir $(PATH_SDK_LIBSDL))))) + PATH_SDK_LIBSDL := $(firstword $(foreach root,$(KBUILD_LIB_SEARCH_ROOTS) \ + ,$(if $(wildcard $(addsuffix libSDL.*,$(addprefix $(root),$(KBUILD_LIB_SEARCH_SUBS)))),$(root),) )) + ifeq ($(PATH_SDK_LIBSDL),/) + PATH_SDK_LIBSDL := /. + else ifneq ($(PATH_SDK_LIBSDL),) + PATH_SDK_LIBSDL := $(patsubst %/,%,$(PATH_SDK_LIBSDL)) else $(warning kBuild: PATH_SDK_LIBSDL couldn't be determined!) PATH_SDK_LIBSDL := $(PATH_DEVTOOLS_TRG)/libsdl/not/found diff --git a/kBuild/tools/GCC.kmk b/kBuild/tools/GCC.kmk index 9a1c6cd..482e421 100644 --- a/kBuild/tools/GCC.kmk +++ b/kBuild/tools/GCC.kmk @@ -1,4 +1,4 @@ -# $Id: GCC.kmk 2541 2011-08-03 09:51:30Z bird $ +# $Id: GCC.kmk 2545 2011-09-13 19:09:05Z bird $ ## @file # kBuild Tool Config - Generic GCC Using The System GCC. # @@ -205,9 +205,6 @@ TOOL_GCC_LINK_PROGRAM_DEPORD = define TOOL_GCC_LINK_PROGRAM_CMDS $(QUIET)$(TOOL_GCC_LD) $(flags) -o $(out) $(objs) \ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GCC.) -endif endef @@ -230,8 +227,5 @@ TOOL_GCC_LINK_DLL_DEPORD = define TOOL_GCC_LINK_DLL_CMDS $(QUIET)$(TOOL_GCC_LD) $(TOOL_GCC_LDFLAGS.dll) $(flags) -o $(out) $(objs) \ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GCC.) -endif endef diff --git a/kBuild/tools/GCC3OMF.kmk b/kBuild/tools/GCC3OMF.kmk index 1d2ecb2..eb86dfd 100644 --- a/kBuild/tools/GCC3OMF.kmk +++ b/kBuild/tools/GCC3OMF.kmk @@ -1,4 +1,4 @@ -# $Id: GCC3OMF.kmk 2534 2011-08-02 14:13:06Z bird $ +# $Id: GCC3OMF.kmk 2545 2011-09-13 19:09:05Z bird $ ## @file # kBuild Tool Config - GCC v3 targeting OS/2 OMF. # @@ -252,9 +252,6 @@ define TOOL_GCC3OMF_LINK_PROGRAM_CMDS $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\ -Zmap=$(outbase).map $(QUIET)$(TOOL_GCC3OMF_LD) @$(outbase).rsp -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requrested for $(target), but this feature is not supported by GCC3OMF.) -endif endef @@ -286,9 +283,6 @@ define TOOL_GCC3OMF_LINK_DLL_CMDS $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\ -Zmap=$(outbase).map $(TOOL_GCC3OMF_LD) @$(outbase).rsp -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requrested for $(target), but this feature is not supported by GCC3OMF.) -endif endef @@ -320,8 +314,5 @@ define TOOL_GCC3OMF_LINK_SYSMOD_CMDS $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\ -Zmap=$(outbase).map $(QUIET)$(TOOL_GCC3OMF_LD_SYSMOD) @$(outbase).rsp -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requrested for $(target), but this feature is not supported by GCC3OMF.) -endif endef diff --git a/kBuild/tools/GCC3PLAIN.kmk b/kBuild/tools/GCC3PLAIN.kmk index 30c7673..0793f83 100644 --- a/kBuild/tools/GCC3PLAIN.kmk +++ b/kBuild/tools/GCC3PLAIN.kmk @@ -1,4 +1,4 @@ -# $Id: GCC3PLAIN.kmk 2541 2011-08-03 09:51:30Z bird $ +# $Id: GCC3PLAIN.kmk 2545 2011-09-13 19:09:05Z bird $ ## @file # kBuild Tool Config - Generic GCC v3.2.x or later Using The System GCC, any Unix Linker and Unix Archiver. # @@ -257,9 +257,6 @@ define TOOL_GCC3PLAIN_LINK_PROGRAM_CMDS $(filter %.def, $(othersrc))\ $(foreach p,$(libpath), -L$(p))\ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GCC3PLAIN.) -endif endef @@ -288,9 +285,6 @@ define TOOL_GCC3PLAIN_LINK_DLL_CMDS $(filter %.def, $(othersrc))\ $(foreach p,$(libpath), -L$(p))\ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GCC3PLAIN.) -endif endef @@ -322,8 +316,5 @@ define TOOL_GCC3PLAIN_LINK_SYSMOD_CMDS $(filter %.def, $(othersrc))\ $(foreach p,$(libpath), -L$(p))\ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GCC3PLAIN.) -endif endef diff --git a/kBuild/tools/GCC42MACHO.kmk b/kBuild/tools/GCC42MACHO.kmk new file mode 100644 index 0000000..d0f0a31 --- /dev/null +++ b/kBuild/tools/GCC42MACHO.kmk @@ -0,0 +1,465 @@ +# $Id: GCC42MACHO.kmk 2547 2011-11-04 21:58:53Z bird $ +## @file +# kBuild Tool Config - GCC v4.2.x targeting Darwin (Mac OS X) Mach-O. +# + +# +# Copyright (c) 2004-2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net> +# +# This file is part of kBuild. +# +# kBuild is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# kBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with kBuild; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# As a special exception you are granted permission to include this file, via +# the kmk include directive, as you wish without this in itself causing the +# resulting makefile, program or whatever to be covered by the GPL license. +# This exception does not however invalidate any other reasons why the makefile, +# program, whatever should not be covered the GPL. +# +# + +TOOL_GCC42MACHO := GCC v4.2.x targeting Darwin (Mac OS X) Mach-O. + +# Tool Specific Properties +TOOL_GCC42MACHO_PREFIX ?= +TOOL_GCC42MACHO_SUFFIX ?= -4.2$(HOSTSUFF_EXE) +TOOL_GCC42MACHO_CC ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX) +TOOL_GCC42MACHO_CXX ?= $(TOOL_GCC42MACHO_PREFIX)g++$(TOOL_GCC42MACHO_SUFFIX) +TOOL_GCC42MACHO_OBJC ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX) +TOOL_GCC42MACHO_OBJCXX ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX) +TOOL_GCC42MACHO_AS ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX) +TOOL_GCC42MACHO_LD ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX) +TOOL_GCC42MACHO_LD_SYSMOD ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX) +ifndef TOOL_GCC42MACHO_LDFLAGS.$(KBUILD_TARGET) +TOOL_GCC42MACHO_LDFLAGS.dll ?= -dynamiclib +else +TOOL_GCC42MACHO_LDFLAGS.dll ?= $(TOOL_GCC42MACHO_LDFLAGS.$(KBUILD_TARGET)) +endif +TOOL_GCC42MACHO_LDFLAGS.sysmod ?= -r +#TOOL_GCC42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2))) +TOOL_GCC42MACHO_DSYMUTIL ?= dsymutil + +ifdef SLKRUNS +TOOL_GCC42MACHO_CC += -fmessage-length=0 +TOOL_GCC42MACHO_CXX += -fmessage-length=0 +TOOL_GCC42MACHO_OBJC += -fmessage-length=0 +TOOL_GCC42MACHO_OBJCXX += -fmessage-length=0 +endif + +# General Properties used by kBuild +TOOL_GCC42MACHO_COBJSUFF ?= .o +TOOL_GCC42MACHO_CFLAGS ?= +TOOL_GCC42MACHO_CFLAGS.debug ?= -g +TOOL_GCC42MACHO_CFLAGS.profile ?= -g -O2 #-pg +TOOL_GCC42MACHO_CFLAGS.release ?= -O2 +TOOL_GCC42MACHO_CINCS ?= +TOOL_GCC42MACHO_CDEFS ?= + +TOOL_GCC42MACHO_CXXOBJSUFF ?= .o +TOOL_GCC42MACHO_CXXFLAGS ?= +TOOL_GCC42MACHO_CXXFLAGS.debug ?= -g +TOOL_GCC42MACHO_CXXFLAGS.profile ?= -g -O2 #-pg +TOOL_GCC42MACHO_CXXFLAGS.release ?= -O2 +TOOL_GCC42MACHO_CXXINCS ?= +TOOL_GCC42MACHO_CXXDEFS ?= + +TOOL_GCC42MACHO_OBJCOBJSUFF ?= .o +TOOL_GCC42MACHO_OBJCFLAGS ?= +TOOL_GCC42MACHO_OBJCFLAGS.debug ?= -g +TOOL_GCC42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg +TOOL_GCC42MACHO_OBJCFLAGS.release?= -O2 +TOOL_GCC42MACHO_OBJCINCS ?= +TOOL_GCC42MACHO_OBJCDEFS ?= + +TOOL_GCC42MACHO_OBJCXXOBJSUFF ?= .o +TOOL_GCC42MACHO_OBJCXXFLAGS ?= +TOOL_GCC42MACHO_OBJCXXFLAGS.debug ?= -g +TOOL_GCC42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg +TOOL_GCC42MACHO_OBJCXXFLAGS.release ?= -O2 +TOOL_GCC42MACHO_OBJCXXINCS ?= +TOOL_GCC42MACHO_OBJCXXDEFS ?= + +TOOL_GCC42MACHO_ASFLAGS ?= -x assembler-with-cpp +TOOL_GCC42MACHO_ASFLAGS.debug ?= -g +TOOL_GCC42MACHO_ASFLAGS.profile ?= -g +TOOL_GCC42MACHO_ASOBJSUFF ?= .o + +TOOL_GCC42MACHO_AR ?= ar$(HOSTSUFF_EXE) +TOOL_GCC42MACHO_ARFLAGS ?= -c -rs +TOOL_GCC42MACHO_ARLIBSUFF ?= .a + +TOOL_GCC42MACHO_LDFLAGS ?= +TOOL_GCC42MACHO_LDFLAGS.debug ?= -g +TOOL_GCC42MACHO_LDFLAGS.profile ?= -g + +TOOL_GCC42MACHO_STRIP_PROGRAM ?= strip -SXxru +TOOL_GCC42MACHO_STRIP_DLL ?= strip -Sxru +TOOL_GCC42MACHO_STRIP_SYSMOD ?= strip -Sru + + +## +# Calculate the files in the debug bundle. +# @param 1 The whole output filename. +# @param 2 The output filename sans suffix. +TOOL_GCC42MACHO_DEBUG_BUNDLE_FN = \ + $(1).dSYM/ \ + $(1).dSYM/Contents/ \ + $(1).dSYM/Contents/Resources/ \ + $(1).dSYM/Contents/Resources/DWARF/ \ + $(1).dSYM/Contents/Info.plist \ + $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1)) + +## +# Calculate the files in the debug bundle. +# @param 1 The whole linker output filename. +# @param 2 The linker output filename sans suffix. +# @param 3 The desired install name (no dir slash). +# @remarks The Info.plist has some reference to the original name, but gdb +# does not care and only check for a symbol file in the DWARF +# directory with the same name as the debugged module. +TOOL_GCC42MACHO_DEBUG_INSTALL_FN= \ + $(3).dSYM/ \ + $(3).dSYM/Contents/ \ + $(3).dSYM/Contents/Resources/ \ + $(3).dSYM/Contents/Resources/DWARF/ \ + $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \ + $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3)) + + +## Compile C source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_GCC42MACHO_COMPILE_C_DEPEND = +TOOL_GCC42MACHO_COMPILE_C_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_GCC42MACHO_COMPILE_C_USES_KOBJCACHE = 1 +TOOL_GCC42MACHO_COMPILE_C_OUTPUT = $(outbase).i +define TOOL_GCC42MACHO_COMPILE_C_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).i\ + $(TOOL_GCC42MACHO_CC) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_GCC42MACHO_CC) -c\ + $(flags) -fpreprocessed -x c\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_GCC42MACHO_COMPILE_C_OUTPUT = +define TOOL_GCC42MACHO_COMPILE_C_CMDS + $(QUIET)$(TOOL_GCC42MACHO_CC) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KUSE_OBJCACHE + + +## Compile C++ source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_GCC42MACHO_COMPILE_CXX_DEPEND = +TOOL_GCC42MACHO_COMPILE_CXX_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_GCC42MACHO_COMPILE_CXX_USES_KOBJCACHE = 1 +TOOL_GCC42MACHO_COMPILE_CXX_OUTPUT = $(outbase).ii +define TOOL_GCC42MACHO_COMPILE_CXX_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).ii\ + $(TOOL_GCC42MACHO_CXX) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_GCC42MACHO_CXX) -c\ + $(flags) -fpreprocessed -x c++\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_GCC42MACHO_COMPILE_CXX_OUTPUT = +define TOOL_GCC42MACHO_COMPILE_CXX_CMDS + $(QUIET)$(TOOL_GCC42MACHO_CXX) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Objective-C source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_GCC42MACHO_COMPILE_OBJC_DEPEND = +TOOL_GCC42MACHO_COMPILE_OBJC_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_GCC42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1 +TOOL_GCC42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi +define TOOL_GCC42MACHO_COMPILE_OBJC_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).ii\ + $(TOOL_GCC42MACHO_OBJC) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_GCC42MACHO_OBJC) -c\ + $(flags) -fpreprocessed -x cbjective-c\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_GCC42MACHO_COMPILE_OBJC_OUTPUT = +define TOOL_GCC42MACHO_COMPILE_OBJC_CMDS + $(QUIET)$(TOOL_GCC42MACHO_OBJC) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Objective-C++ source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_GCC42MACHO_COMPILE_OBJCXX_DEPEND = +TOOL_GCC42MACHO_COMPILE_OBJCXX_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_GCC42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1 +TOOL_GCC42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii +define TOOL_GCC42MACHO_COMPILE_OBJCXX_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).mii\ + $(TOOL_GCC42MACHO_OBJCXX) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_GCC42MACHO_OBJCXX) -c\ + $(flags) -fpreprocessed -x objective-c++\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_GCC42MACHO_COMPILE_OBJCXX_OUTPUT = +define TOOL_GCC42MACHO_COMPILE_OBJCXX_CMDS + $(QUIET)$(TOOL_GCC42MACHO_OBJCXX) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Assembly source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +# +TOOL_GCC42MACHO_COMPILE_AS_OUTPUT = +TOOL_GCC42MACHO_COMPILE_AS_DEPEND = +TOOL_GCC42MACHO_COMPILE_AS_DEPORD = +define TOOL_GCC42MACHO_COMPILE_AS_CMDS + $(QUIET)$(TOOL_GCC42MACHO_AS) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef + + +## Link library +# @param $(target) Normalized main target name. +# @param $(out) Library name. +# @param $(objs) Object files to put in the library. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_GCC42MACHO_LINK_LIBRARY_OUTPUT = +TOOL_GCC42MACHO_LINK_LIBRARY_DEPEND = $(othersrc) +TOOL_GCC42MACHO_LINK_LIBRARY_DEPORD = +define TOOL_GCC42MACHO_LINK_LIBRARY_CMDS + $(if $(strip $(objs)),$(call xargs,$(QUIET)$(TOOL_GCC42MACHO_AR) $(flags) $(out),$(objs))) + $(foreach lib,$(othersrc)\ + ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \ + $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \ + $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \ + $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \ + && $(TOOL_GCC42MACHO_AR) -x $(abspath $(lib)) \ + && $(RM_EXT) -f ./__.SYMDEF* \ + && $(TOOL_GCC42MACHO_AR) $(flags) $(out) *) \ + $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \ + $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/) +endef + + +## Link program +# @param $(target) Normalized main target name. +# @param $(out) Program name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_GCC42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp +TOOL_GCC42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_GCC42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN) +TOOL_GCC42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_GCC42MACHO_LINK_PROGRAM_DEPORD = +define TOOL_GCC42MACHO_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_GCC42MACHO_LD) $(flags) -o $(out)\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_GCC42MACHO_STRIP_PROGRAM) $(out) + endif +endef + + + +## Link DLL +# @param $(target) Normalized main target name. +# @param $(out) Program name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_GCC42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp +TOOL_GCC42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_GCC42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN) +TOOL_GCC42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_GCC42MACHO_LINK_DLL_DEPORD = +define TOOL_GCC42MACHO_LINK_DLL_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_GCC42MACHO_LD) $(TOOL_GCC42MACHO_LDFLAGS.dll) $(flags) -o $(out)\ + $(call TOOL_GCC42MACHO_LD_SONAME,$(target),$(out))\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_GCC42MACHO_STRIP_DLL) $(out) + endif +endef + + +## Link system module (windows aka driver, linux aka kernel module) +# @param $(target) Normalized main target name. +# @param $(out) System module name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_GCC42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp +TOOL_GCC42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_GCC42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN) +TOOL_GCC42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_GCC42MACHO_LINK_SYSMOD_DEPORD = +define TOOL_GCC42MACHO_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_GCC42MACHO_LD_SYSMOD) $(TOOL_GCC42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_GCC42MACHO_STRIP_SYSMOD) $(out) + endif +endef + diff --git a/kBuild/tools/GCC4MACHO.kmk b/kBuild/tools/GCC4MACHO.kmk index b288e75..307e2b1 100644 --- a/kBuild/tools/GCC4MACHO.kmk +++ b/kBuild/tools/GCC4MACHO.kmk @@ -1,6 +1,6 @@ -# $Id: GCC4MACHO.kmk 2535 2011-08-02 19:05:34Z bird $ +# $Id: GCC4MACHO.kmk 2547 2011-11-04 21:58:53Z bird $ ## @file -# kBuild Tool Config - GCC v4 targeting Darwin (Mac OS X) Mach-o. +# kBuild Tool Config - GCC v4 targeting Darwin (Mac OS X) Mach-O. # # @@ -31,7 +31,7 @@ # # -TOOL_GCC4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-o. +TOOL_GCC4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-O. # Tool Specific Properties TOOL_GCC4MACHO_PREFIX ?= diff --git a/kBuild/tools/GXX.kmk b/kBuild/tools/GXX.kmk index 2b87513..c543238 100644 --- a/kBuild/tools/GXX.kmk +++ b/kBuild/tools/GXX.kmk @@ -1,4 +1,4 @@ -# $Id: GXX.kmk 2541 2011-08-03 09:51:30Z bird $ +# $Id: GXX.kmk 2545 2011-09-13 19:09:05Z bird $ ## @file # kBuild Tool Config - Generic GCC using the system GCC, for building C++ code. # @@ -205,9 +205,6 @@ TOOL_GXX_LINK_PROGRAM_DEPORD = define TOOL_GXX_LINK_PROGRAM_CMDS $(QUIET)$(TOOL_GXX_LD) $(flags) -o $(out) $(objs) \ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GXX.) -endif endef @@ -230,8 +227,5 @@ TOOL_GXX_LINK_DLL_DEPORD = define TOOL_GXX_LINK_DLL_CMDS $(QUIET)$(TOOL_GXX_LD) $(TOOL_GXX_LDFLAGS.dll) $(flags) -o $(out) $(objs) \ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GXX.) -endif endef diff --git a/kBuild/tools/GXX3OMF.kmk b/kBuild/tools/GXX3OMF.kmk index 3e413a5..bb38527 100644 --- a/kBuild/tools/GXX3OMF.kmk +++ b/kBuild/tools/GXX3OMF.kmk @@ -1,4 +1,4 @@ -# $Id: GXX3OMF.kmk 2534 2011-08-02 14:13:06Z bird $ +# $Id: GXX3OMF.kmk 2545 2011-09-13 19:09:05Z bird $ ## @file # kBuild Tool Config - GCC v3 targeting OS/2 OMF, for building C++ code. # @@ -252,9 +252,6 @@ define TOOL_GXX3OMF_LINK_PROGRAM_CMDS $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\ -Zmap=$(outbase).map $(QUIET)$(TOOL_GXX3OMF_LD) @$(outbase).rsp -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requrested for $(target), but this feature is not supported by GXX3OMF.) -endif endef @@ -286,9 +283,6 @@ define TOOL_GXX3OMF_LINK_DLL_CMDS $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\ -Zmap=$(outbase).map $(TOOL_GXX3OMF_LD) @$(outbase).rsp -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requrested for $(target), but this feature is not supported by GXX3OMF.) -endif endef @@ -320,8 +314,5 @@ define TOOL_GXX3OMF_LINK_SYSMOD_CMDS $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\ -Zmap=$(outbase).map $(QUIET)$(TOOL_GXX3OMF_LD_SYSMOD) @$(outbase).rsp -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requrested for $(target), but this feature is not supported by GXX3OMF.) -endif endef diff --git a/kBuild/tools/GXX3PLAIN.kmk b/kBuild/tools/GXX3PLAIN.kmk index 733014e..92ab12b 100644 --- a/kBuild/tools/GXX3PLAIN.kmk +++ b/kBuild/tools/GXX3PLAIN.kmk @@ -1,4 +1,4 @@ -# $Id: GXX3PLAIN.kmk 2541 2011-08-03 09:51:30Z bird $ +# $Id: GXX3PLAIN.kmk 2545 2011-09-13 19:09:05Z bird $ ## @file # kBuild Tool Config - Generic GCC v3.2.x or later using the system GCC, any Unix linker and Unix archiver to build C++ code. # @@ -257,9 +257,6 @@ define TOOL_GXX3PLAIN_LINK_PROGRAM_CMDS $(filter %.def, $(othersrc))\ $(foreach p,$(libpath), -L$(p))\ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GXX3PLAIN.) -endif endef @@ -288,9 +285,6 @@ define TOOL_GXX3PLAIN_LINK_DLL_CMDS $(filter %.def, $(othersrc))\ $(foreach p,$(libpath), -L$(p))\ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GXX3PLAIN.) -endif endef @@ -322,8 +316,5 @@ define TOOL_GXX3PLAIN_LINK_SYSMOD_CMDS $(filter %.def, $(othersrc))\ $(foreach p,$(libpath), -L$(p))\ $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) -if1of ($(ld_debug), split) - $(warning kBuild: Debug splitting is requested for $(target), but this feature is not supported by GXX3PLAIN.) -endif endef diff --git a/kBuild/tools/GXX42MACHO.kmk b/kBuild/tools/GXX42MACHO.kmk new file mode 100644 index 0000000..df2077b --- /dev/null +++ b/kBuild/tools/GXX42MACHO.kmk @@ -0,0 +1,464 @@ +# $Id: GXX42MACHO.kmk 2547 2011-11-04 21:58:53Z bird $ +## @file +# kBuild Tool Config - GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code. +# + +# +# Copyright (c) 2004-2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net> +# +# This file is part of kBuild. +# +# kBuild is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# kBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with kBuild; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# As a special exception you are granted permission to include this file, via +# the kmk include directive, as you wish without this in itself causing the +# resulting makefile, program or whatever to be covered by the GPL license. +# This exception does not however invalidate any other reasons why the makefile, +# program, whatever should not be covered the GPL. +# +# + +TOOL_GXX42MACHO := GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code. + +# Tool Specific Properties +TOOL_GXX42MACHO_PREFIX ?= +TOOL_GXX42MACHO_SUFFIX ?= -4.2$(HOSTSUFF_EXE) +TOOL_GXX42MACHO_CC ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX) +TOOL_GXX42MACHO_CXX ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX) +TOOL_GXX42MACHO_OBJC ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX) +TOOL_GXX42MACHO_OBJCXX ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX) +TOOL_GXX42MACHO_AS ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX) +TOOL_GXX42MACHO_LD ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX) +TOOL_GXX42MACHO_LD_SYSMOD ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX) +ifndef TOOL_GXX42MACHO_LDFLAGS.$(KBUILD_TARGET) +TOOL_GXX42MACHO_LDFLAGS.dll ?= -dynamiclib +else +TOOL_GXX42MACHO_LDFLAGS.dll ?= $(TOOL_GXX42MACHO_LDFLAGS.$(KBUILD_TARGET)) +endif +TOOL_GXX42MACHO_LDFLAGS.sysmod ?= -r +#TOOL_GXX42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2))) +TOOL_GXX42MACHO_DSYMUTIL ?= dsymutil + +ifdef SLKRUNS +TOOL_GXX42MACHO_CC += -fmessage-length=0 +TOOL_GXX42MACHO_CXX += -fmessage-length=0 +TOOL_GXX42MACHO_OBJC += -fmessage-length=0 +TOOL_GXX42MACHO_OBJCXX += -fmessage-length=0 +endif + +# General Properties used by kBuild +TOOL_GXX42MACHO_COBJSUFF ?= .o +TOOL_GXX42MACHO_CFLAGS ?= +TOOL_GXX42MACHO_CFLAGS.debug ?= -g +TOOL_GXX42MACHO_CFLAGS.profile ?= -O2 #-g -pg +TOOL_GXX42MACHO_CFLAGS.release ?= -O2 +TOOL_GXX42MACHO_CINCS ?= +TOOL_GXX42MACHO_CDEFS ?= + +TOOL_GXX42MACHO_CXXOBJSUFF ?= .o +TOOL_GXX42MACHO_CXXFLAGS ?= +TOOL_GXX42MACHO_CXXFLAGS.debug ?= -g +TOOL_GXX42MACHO_CXXFLAGS.profile ?= -O2 #-g -pg +TOOL_GXX42MACHO_CXXFLAGS.release ?= -O2 +TOOL_GXX42MACHO_CXXINCS ?= +TOOL_GXX42MACHO_CXXDEFS ?= + +TOOL_GXX42MACHO_OBJCOBJSUFF ?= .o +TOOL_GXX42MACHO_OBJCFLAGS ?= +TOOL_GXX42MACHO_OBJCFLAGS.debug ?= -g +TOOL_GXX42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg +TOOL_GXX42MACHO_OBJCFLAGS.release?= -O2 +TOOL_GXX42MACHO_OBJCINCS ?= +TOOL_GXX42MACHO_OBJCDEFS ?= + +TOOL_GXX42MACHO_OBJCXXOBJSUFF ?= .o +TOOL_GXX42MACHO_OBJCXXFLAGS ?= +TOOL_GXX42MACHO_OBJCXXFLAGS.debug ?= -g +TOOL_GXX42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg +TOOL_GXX42MACHO_OBJCXXFLAGS.release ?= -O2 +TOOL_GXX42MACHO_OBJCXXINCS ?= +TOOL_GXX42MACHO_OBJCXXDEFS ?= + +TOOL_GXX42MACHO_ASFLAGS ?= -x assembler-with-cpp +TOOL_GXX42MACHO_ASFLAGS.debug ?= -g +TOOL_GXX42MACHO_ASFLAGS.profile ?= -g +TOOL_GXX42MACHO_ASOBJSUFF ?= .o + +TOOL_GXX42MACHO_AR ?= ar$(HOSTSUFF_EXE) +TOOL_GXX42MACHO_ARFLAGS ?= -c -rs +TOOL_GXX42MACHO_ARLIBSUFF ?= .a + +TOOL_GXX42MACHO_LDFLAGS ?= +TOOL_GXX42MACHO_LDFLAGS.debug ?= -g +TOOL_GXX42MACHO_LDFLAGS.profile ?= -g + +TOOL_GXX42MACHO_STRIP_PROGRAM ?= strip -SXxru +TOOL_GXX42MACHO_STRIP_DLL ?= strip -Sxru +TOOL_GXX42MACHO_STRIP_SYSMOD ?= strip -Sru + + +## +# Calculate the files in the debug bundle. +# @param 1 The whole output filename. +# @param 2 The output filename sans suffix. +TOOL_GXX42MACHO_DEBUG_BUNDLE_FN = \ + $(1).dSYM/ \ + $(1).dSYM/Contents/ \ + $(1).dSYM/Contents/Resources/ \ + $(1).dSYM/Contents/Resources/DWARF/ \ + $(1).dSYM/Contents/Info.plist \ + $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1)) + +## +# Calculate the files in the debug bundle. +# @param 1 The whole linker output filename. +# @param 2 The linker output filename sans suffix. +# @param 3 The desired install name (no dir slash). +# @remarks The Info.plist has some reference to the original name, but gdb +# does not care and only check for a symbol file in the DWARF +# directory with the same name as the debugged module. +TOOL_GXX42MACHO_DEBUG_INSTALL_FN= \ + $(3).dSYM/ \ + $(3).dSYM/Contents/ \ + $(3).dSYM/Contents/Resources/ \ + $(3).dSYM/Contents/Resources/DWARF/ \ + $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \ + $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3)) + + +## Compile C source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_GXX42MACHO_COMPILE_C_DEPEND = +TOOL_GXX42MACHO_COMPILE_C_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_GXX42MACHO_COMPILE_C_USES_KOBJCACHE = 1 +TOOL_GXX42MACHO_COMPILE_C_OUTPUT = $(outbase).i +define TOOL_GXX42MACHO_COMPILE_C_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).i\ + $(TOOL_GXX42MACHO_CC) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_GXX42MACHO_CC) -c\ + $(flags) -fpreprocessed -x c\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_GXX42MACHO_COMPILE_C_OUTPUT = +define TOOL_GXX42MACHO_COMPILE_C_CMDS + $(QUIET)$(TOOL_GXX42MACHO_CC) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KUSE_OBJCACHE + + +## Compile C++ source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_GXX42MACHO_COMPILE_CXX_DEPEND = +TOOL_GXX42MACHO_COMPILE_CXX_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_GXX42MACHO_COMPILE_CXX_USES_KOBJCACHE = 1 +TOOL_GXX42MACHO_COMPILE_CXX_OUTPUT = $(outbase).ii +define TOOL_GXX42MACHO_COMPILE_CXX_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).ii\ + $(TOOL_GXX42MACHO_CXX) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_GXX42MACHO_CXX) -c\ + $(flags) -fpreprocessed -x c++\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_GXX42MACHO_COMPILE_CXX_OUTPUT = +define TOOL_GXX42MACHO_COMPILE_CXX_CMDS + $(QUIET)$(TOOL_GXX42MACHO_CXX) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Objective-C source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_GXX42MACHO_COMPILE_OBJC_DEPEND = +TOOL_GXX42MACHO_COMPILE_OBJC_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_GXX42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1 +TOOL_GXX42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi +define TOOL_GXX42MACHO_COMPILE_OBJC_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).ii\ + $(TOOL_GXX42MACHO_OBJC) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_GXX42MACHO_OBJC) -c\ + $(flags) -fpreprocessed -x objective-c \ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_GXX42MACHO_COMPILE_OBJC_OUTPUT = +define TOOL_GXX42MACHO_COMPILE_OBJC_CMDS + $(QUIET)$(TOOL_GXX42MACHO_OBJC) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Objective-C++ source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_GXX42MACHO_COMPILE_OBJCXX_DEPEND = +TOOL_GXX42MACHO_COMPILE_OBJCXX_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_GXX42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1 +TOOL_GXX42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii +define TOOL_GXX42MACHO_COMPILE_OBJCXX_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).mii\ + $(TOOL_GXX42MACHO_OBJCXX) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_GXX42MACHO_OBJCXX) -c\ + $(flags) -fpreprocessed -x objective-c++ \ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_GXX42MACHO_COMPILE_OBJCXX_OUTPUT = +define TOOL_GXX42MACHO_COMPILE_OBJCXX_CMDS + $(QUIET)$(TOOL_GXX42MACHO_OBJCXX) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Assembly source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +# +TOOL_GXX42MACHO_COMPILE_AS_OUTPUT = +TOOL_GXX42MACHO_COMPILE_AS_DEPEND = +TOOL_GXX42MACHO_COMPILE_AS_DEPORD = +define TOOL_GXX42MACHO_COMPILE_AS_CMDS + $(QUIET)$(TOOL_GXX42MACHO_AS) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef + + +## Link library +# @param $(target) Normalized main target name. +# @param $(out) Library name. +# @param $(objs) Object files to put in the library. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_GXX42MACHO_LINK_LIBRARY_OUTPUT = +TOOL_GXX42MACHO_LINK_LIBRARY_DEPEND = $(othersrc) +TOOL_GXX42MACHO_LINK_LIBRARY_DEPORD = +define TOOL_GXX42MACHO_LINK_LIBRARY_CMDS + $(if $(strip $(objs)),$(call xargs,$(QUIET)$(TOOL_GXX42MACHO_AR) $(flags) $(out),$(objs))) + $(foreach lib,$(othersrc)\ + ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \ + $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \ + $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \ + $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \ + && $(TOOL_GXX42MACHO_AR) -x $(abspath $(lib)) \ + && $(RM_EXT) -f ./__.SYMDEF* \ + && $(TOOL_GXX42MACHO_AR) $(flags) $(out) *) \ + $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \ + $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/) +endef + + +## Link program +# @param $(target) Normalized main target name. +# @param $(out) Program name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_GXX42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp +TOOL_GXX42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_GXX42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN) +TOOL_GXX42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_GXX42MACHO_LINK_PROGRAM_DEPORD = +define TOOL_GXX42MACHO_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_GXX42MACHO_LD) $(flags) -o $(out)\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_GXX42MACHO_STRIP_PROGRAM) $(out) + endif +endef + + +## Link DLL +# @param $(target) Normalized main target name. +# @param $(out) Program name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_GXX42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp +TOOL_GXX42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_GXX42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN) +TOOL_GXX42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_GXX42MACHO_LINK_DLL_DEPORD = +define TOOL_GXX42MACHO_LINK_DLL_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_GXX42MACHO_LD) $(TOOL_GXX42MACHO_LDFLAGS.dll) $(flags) -o $(out)\ + $(call TOOL_GXX42MACHO_LD_SONAME,$(target),$(out))\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_GXX42MACHO_STRIP_DLL) $(out) + endif +endef + + +## Link system module (windows aka driver, linux aka kernel module) +# @param $(target) Normalized main target name. +# @param $(out) System module name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_GXX42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp +TOOL_GXX42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_GXX42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN) +TOOL_GXX42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_GXX42MACHO_LINK_SYSMOD_DEPORD = +define TOOL_GXX42MACHO_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_GXX42MACHO_LD_SYSMOD) $(TOOL_GXX42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_GXX42MACHO_STRIP_SYSMOD) $(out) + endif +endef + diff --git a/kBuild/tools/GXX4MACHO.kmk b/kBuild/tools/GXX4MACHO.kmk index 81789b9..a3df1d5 100644 --- a/kBuild/tools/GXX4MACHO.kmk +++ b/kBuild/tools/GXX4MACHO.kmk @@ -1,6 +1,6 @@ -# $Id: GXX4MACHO.kmk 2535 2011-08-02 19:05:34Z bird $ +# $Id: GXX4MACHO.kmk 2547 2011-11-04 21:58:53Z bird $ ## @file -# kBuild Tool Config - GCC v4 targeting Darwin (Mac OS X) Mach-o, for building C++ code. +# kBuild Tool Config - GCC v4 targeting Darwin (Mac OS X) Mach-O, for building C++ code. # # @@ -31,7 +31,7 @@ # # -TOOL_GXX4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-o, for building C++ code. +TOOL_GXX4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-O, for building C++ code. # Tool Specific Properties TOOL_GXX4MACHO_PREFIX ?= diff --git a/kBuild/tools/LLVMGCC42MACHO.kmk b/kBuild/tools/LLVMGCC42MACHO.kmk new file mode 100644 index 0000000..4511ca5 --- /dev/null +++ b/kBuild/tools/LLVMGCC42MACHO.kmk @@ -0,0 +1,465 @@ +# $Id: LLVMGCC42MACHO.kmk 2547 2011-11-04 21:58:53Z bird $ +## @file +# kBuild Tool Config - LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O. +# + +# +# Copyright (c) 2004-2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net> +# +# This file is part of kBuild. +# +# kBuild is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# kBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with kBuild; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# As a special exception you are granted permission to include this file, via +# the kmk include directive, as you wish without this in itself causing the +# resulting makefile, program or whatever to be covered by the GPL license. +# This exception does not however invalidate any other reasons why the makefile, +# program, whatever should not be covered the GPL. +# +# + +TOOL_LLVMGCC42MACHO := LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O. + +# Tool Specific Properties +TOOL_LLVMGCC42MACHO_PREFIX ?= llvm- +TOOL_LLVMGCC42MACHO_SUFFIX ?= -4.2$(HOSTSUFF_EXE) +TOOL_LLVMGCC42MACHO_CC ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX) +TOOL_LLVMGCC42MACHO_CXX ?= $(TOOL_LLVMGCC42MACHO_PREFIX)g++$(TOOL_LLVMGCC42MACHO_SUFFIX) +TOOL_LLVMGCC42MACHO_OBJC ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX) +TOOL_LLVMGCC42MACHO_OBJCXX ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX) +TOOL_LLVMGCC42MACHO_AS ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX) +TOOL_LLVMGCC42MACHO_LD ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX) +TOOL_LLVMGCC42MACHO_LD_SYSMOD ?= $(TOOL_LLVMGCC42MACHO_PREFIX)gcc$(TOOL_LLVMGCC42MACHO_SUFFIX) +ifndef TOOL_LLVMGCC42MACHO_LDFLAGS.$(KBUILD_TARGET) +TOOL_LLVMGCC42MACHO_LDFLAGS.dll ?= -dynamiclib +else +TOOL_LLVMGCC42MACHO_LDFLAGS.dll ?= $(TOOL_LLVMGCC42MACHO_LDFLAGS.$(KBUILD_TARGET)) +endif +TOOL_LLVMGCC42MACHO_LDFLAGS.sysmod ?= -r +#TOOL_LLVMGCC42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2))) +TOOL_LLVMGCC42MACHO_DSYMUTIL ?= dsymutil + +ifdef SLKRUNS +TOOL_LLVMGCC42MACHO_CC += -fmessage-length=0 +TOOL_LLVMGCC42MACHO_CXX += -fmessage-length=0 +TOOL_LLVMGCC42MACHO_OBJC += -fmessage-length=0 +TOOL_LLVMGCC42MACHO_OBJCXX += -fmessage-length=0 +endif + +# General Properties used by kBuild +TOOL_LLVMGCC42MACHO_COBJSUFF ?= .o +TOOL_LLVMGCC42MACHO_CFLAGS ?= +TOOL_LLVMGCC42MACHO_CFLAGS.debug ?= -g +TOOL_LLVMGCC42MACHO_CFLAGS.profile ?= -g -O2 #-pg +TOOL_LLVMGCC42MACHO_CFLAGS.release ?= -O2 +TOOL_LLVMGCC42MACHO_CINCS ?= +TOOL_LLVMGCC42MACHO_CDEFS ?= + +TOOL_LLVMGCC42MACHO_CXXOBJSUFF ?= .o +TOOL_LLVMGCC42MACHO_CXXFLAGS ?= +TOOL_LLVMGCC42MACHO_CXXFLAGS.debug ?= -g +TOOL_LLVMGCC42MACHO_CXXFLAGS.profile ?= -g -O2 #-pg +TOOL_LLVMGCC42MACHO_CXXFLAGS.release ?= -O2 +TOOL_LLVMGCC42MACHO_CXXINCS ?= +TOOL_LLVMGCC42MACHO_CXXDEFS ?= + +TOOL_LLVMGCC42MACHO_OBJCOBJSUFF ?= .o +TOOL_LLVMGCC42MACHO_OBJCFLAGS ?= +TOOL_LLVMGCC42MACHO_OBJCFLAGS.debug ?= -g +TOOL_LLVMGCC42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg +TOOL_LLVMGCC42MACHO_OBJCFLAGS.release?= -O2 +TOOL_LLVMGCC42MACHO_OBJCINCS ?= +TOOL_LLVMGCC42MACHO_OBJCDEFS ?= + +TOOL_LLVMGCC42MACHO_OBJCXXOBJSUFF ?= .o +TOOL_LLVMGCC42MACHO_OBJCXXFLAGS ?= +TOOL_LLVMGCC42MACHO_OBJCXXFLAGS.debug ?= -g +TOOL_LLVMGCC42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg +TOOL_LLVMGCC42MACHO_OBJCXXFLAGS.release ?= -O2 +TOOL_LLVMGCC42MACHO_OBJCXXINCS ?= +TOOL_LLVMGCC42MACHO_OBJCXXDEFS ?= + +TOOL_LLVMGCC42MACHO_ASFLAGS ?= -x assembler-with-cpp +TOOL_LLVMGCC42MACHO_ASFLAGS.debug ?= -g +TOOL_LLVMGCC42MACHO_ASFLAGS.profile ?= -g +TOOL_LLVMGCC42MACHO_ASOBJSUFF ?= .o + +TOOL_LLVMGCC42MACHO_AR ?= ar$(HOSTSUFF_EXE) +TOOL_LLVMGCC42MACHO_ARFLAGS ?= -c -rs +TOOL_LLVMGCC42MACHO_ARLIBSUFF ?= .a + +TOOL_LLVMGCC42MACHO_LDFLAGS ?= +TOOL_LLVMGCC42MACHO_LDFLAGS.debug ?= -g +TOOL_LLVMGCC42MACHO_LDFLAGS.profile ?= -g + +TOOL_LLVMGCC42MACHO_STRIP_PROGRAM ?= strip -SXxru +TOOL_LLVMGCC42MACHO_STRIP_DLL ?= strip -Sxru +TOOL_LLVMGCC42MACHO_STRIP_SYSMOD ?= strip -Sru + + +## +# Calculate the files in the debug bundle. +# @param 1 The whole output filename. +# @param 2 The output filename sans suffix. +TOOL_LLVMGCC42MACHO_DEBUG_BUNDLE_FN = \ + $(1).dSYM/ \ + $(1).dSYM/Contents/ \ + $(1).dSYM/Contents/Resources/ \ + $(1).dSYM/Contents/Resources/DWARF/ \ + $(1).dSYM/Contents/Info.plist \ + $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1)) + +## +# Calculate the files in the debug bundle. +# @param 1 The whole linker output filename. +# @param 2 The linker output filename sans suffix. +# @param 3 The desired install name (no dir slash). +# @remarks The Info.plist has some reference to the original name, but gdb +# does not care and only check for a symbol file in the DWARF +# directory with the same name as the debugged module. +TOOL_LLVMGCC42MACHO_DEBUG_INSTALL_FN= \ + $(3).dSYM/ \ + $(3).dSYM/Contents/ \ + $(3).dSYM/Contents/Resources/ \ + $(3).dSYM/Contents/Resources/DWARF/ \ + $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \ + $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3)) + + +## Compile C source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_LLVMGCC42MACHO_COMPILE_C_DEPEND = +TOOL_LLVMGCC42MACHO_COMPILE_C_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_LLVMGCC42MACHO_COMPILE_C_USES_KOBJCACHE = 1 +TOOL_LLVMGCC42MACHO_COMPILE_C_OUTPUT = $(outbase).i +define TOOL_LLVMGCC42MACHO_COMPILE_C_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).i\ + $(TOOL_LLVMGCC42MACHO_CC) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_LLVMGCC42MACHO_CC) -c\ + $(flags) -fpreprocessed -x c\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_LLVMGCC42MACHO_COMPILE_C_OUTPUT = +define TOOL_LLVMGCC42MACHO_COMPILE_C_CMDS + $(QUIET)$(TOOL_LLVMGCC42MACHO_CC) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KUSE_OBJCACHE + + +## Compile C++ source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_LLVMGCC42MACHO_COMPILE_CXX_DEPEND = +TOOL_LLVMGCC42MACHO_COMPILE_CXX_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_LLVMGCC42MACHO_COMPILE_CXX_USES_KOBJCACHE = 1 +TOOL_LLVMGCC42MACHO_COMPILE_CXX_OUTPUT = $(outbase).ii +define TOOL_LLVMGCC42MACHO_COMPILE_CXX_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).ii\ + $(TOOL_LLVMGCC42MACHO_CXX) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_LLVMGCC42MACHO_CXX) -c\ + $(flags) -fpreprocessed -x c++\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_LLVMGCC42MACHO_COMPILE_CXX_OUTPUT = +define TOOL_LLVMGCC42MACHO_COMPILE_CXX_CMDS + $(QUIET)$(TOOL_LLVMGCC42MACHO_CXX) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Objective-C source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_LLVMGCC42MACHO_COMPILE_OBJC_DEPEND = +TOOL_LLVMGCC42MACHO_COMPILE_OBJC_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_LLVMGCC42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1 +TOOL_LLVMGCC42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi +define TOOL_LLVMGCC42MACHO_COMPILE_OBJC_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).ii\ + $(TOOL_LLVMGCC42MACHO_OBJC) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_LLVMGCC42MACHO_OBJC) -c\ + $(flags) -fpreprocessed -x cbjective-c\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_LLVMGCC42MACHO_COMPILE_OBJC_OUTPUT = +define TOOL_LLVMGCC42MACHO_COMPILE_OBJC_CMDS + $(QUIET)$(TOOL_LLVMGCC42MACHO_OBJC) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Objective-C++ source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_DEPEND = +TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1 +TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii +define TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).mii\ + $(TOOL_LLVMGCC42MACHO_OBJCXX) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_LLVMGCC42MACHO_OBJCXX) -c\ + $(flags) -fpreprocessed -x objective-c++\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_OUTPUT = +define TOOL_LLVMGCC42MACHO_COMPILE_OBJCXX_CMDS + $(QUIET)$(TOOL_LLVMGCC42MACHO_OBJCXX) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Assembly source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +# +TOOL_LLVMGCC42MACHO_COMPILE_AS_OUTPUT = +TOOL_LLVMGCC42MACHO_COMPILE_AS_DEPEND = +TOOL_LLVMGCC42MACHO_COMPILE_AS_DEPORD = +define TOOL_LLVMGCC42MACHO_COMPILE_AS_CMDS + $(QUIET)$(TOOL_LLVMGCC42MACHO_AS) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef + + +## Link library +# @param $(target) Normalized main target name. +# @param $(out) Library name. +# @param $(objs) Object files to put in the library. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_LLVMGCC42MACHO_LINK_LIBRARY_OUTPUT = +TOOL_LLVMGCC42MACHO_LINK_LIBRARY_DEPEND = $(othersrc) +TOOL_LLVMGCC42MACHO_LINK_LIBRARY_DEPORD = +define TOOL_LLVMGCC42MACHO_LINK_LIBRARY_CMDS + $(if $(strip $(objs)),$(call xargs,$(QUIET)$(TOOL_LLVMGCC42MACHO_AR) $(flags) $(out),$(objs))) + $(foreach lib,$(othersrc)\ + ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \ + $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \ + $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \ + $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \ + && $(TOOL_LLVMGCC42MACHO_AR) -x $(abspath $(lib)) \ + && $(RM_EXT) -f ./__.SYMDEF* \ + && $(TOOL_LLVMGCC42MACHO_AR) $(flags) $(out) *) \ + $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \ + $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/) +endef + + +## Link program +# @param $(target) Normalized main target name. +# @param $(out) Program name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_LLVMGCC42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp +TOOL_LLVMGCC42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_LLVMGCC42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_LLVMGCC42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_LLVMGCC42MACHO_DEBUG_INSTALL_FN) +TOOL_LLVMGCC42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_LLVMGCC42MACHO_LINK_PROGRAM_DEPORD = +define TOOL_LLVMGCC42MACHO_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_LLVMGCC42MACHO_LD) $(flags) -o $(out)\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_LLVMGCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_LLVMGCC42MACHO_STRIP_PROGRAM) $(out) + endif +endef + + + +## Link DLL +# @param $(target) Normalized main target name. +# @param $(out) Program name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_LLVMGCC42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp +TOOL_LLVMGCC42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_LLVMGCC42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_LLVMGCC42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_LLVMGCC42MACHO_DEBUG_INSTALL_FN) +TOOL_LLVMGCC42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_LLVMGCC42MACHO_LINK_DLL_DEPORD = +define TOOL_LLVMGCC42MACHO_LINK_DLL_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_LLVMGCC42MACHO_LD) $(TOOL_LLVMGCC42MACHO_LDFLAGS.dll) $(flags) -o $(out)\ + $(call TOOL_LLVMGCC42MACHO_LD_SONAME,$(target),$(out))\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_LLVMGCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_LLVMGCC42MACHO_STRIP_DLL) $(out) + endif +endef + + +## Link system module (windows aka driver, linux aka kernel module) +# @param $(target) Normalized main target name. +# @param $(out) System module name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_LLVMGCC42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp +TOOL_LLVMGCC42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_LLVMGCC42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_LLVMGCC42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_LLVMGCC42MACHO_DEBUG_INSTALL_FN) +TOOL_LLVMGCC42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_LLVMGCC42MACHO_LINK_SYSMOD_DEPORD = +define TOOL_LLVMGCC42MACHO_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_LLVMGCC42MACHO_LD_SYSMOD) $(TOOL_LLVMGCC42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_LLVMGCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_LLVMGCC42MACHO_STRIP_SYSMOD) $(out) + endif +endef + diff --git a/kBuild/tools/LLVMGXX42MACHO.kmk b/kBuild/tools/LLVMGXX42MACHO.kmk new file mode 100644 index 0000000..9fab606 --- /dev/null +++ b/kBuild/tools/LLVMGXX42MACHO.kmk @@ -0,0 +1,464 @@ +# $Id: LLVMGXX42MACHO.kmk 2547 2011-11-04 21:58:53Z bird $ +## @file +# kBuild Tool Config - LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code. +# + +# +# Copyright (c) 2004-2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net> +# +# This file is part of kBuild. +# +# kBuild is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# kBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with kBuild; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# As a special exception you are granted permission to include this file, via +# the kmk include directive, as you wish without this in itself causing the +# resulting makefile, program or whatever to be covered by the GPL license. +# This exception does not however invalidate any other reasons why the makefile, +# program, whatever should not be covered the GPL. +# +# + +TOOL_LLVMGXX42MACHO := LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code. + +# Tool Specific Properties +TOOL_LLVMGXX42MACHO_PREFIX ?= llvm- +TOOL_LLVMGXX42MACHO_SUFFIX ?= -4.2$(HOSTSUFF_EXE) +TOOL_LLVMGXX42MACHO_CC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX) +TOOL_LLVMGXX42MACHO_CXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX) +TOOL_LLVMGXX42MACHO_OBJC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX) +TOOL_LLVMGXX42MACHO_OBJCXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX) +TOOL_LLVMGXX42MACHO_AS ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX) +TOOL_LLVMGXX42MACHO_LD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX) +TOOL_LLVMGXX42MACHO_LD_SYSMOD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX) +ifndef TOOL_LLVMGXX42MACHO_LDFLAGS.$(KBUILD_TARGET) +TOOL_LLVMGXX42MACHO_LDFLAGS.dll ?= -dynamiclib +else +TOOL_LLVMGXX42MACHO_LDFLAGS.dll ?= $(TOOL_LLVMGXX42MACHO_LDFLAGS.$(KBUILD_TARGET)) +endif +TOOL_LLVMGXX42MACHO_LDFLAGS.sysmod ?= -r +#TOOL_LLVMGXX42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2))) +TOOL_LLVMGXX42MACHO_DSYMUTIL ?= dsymutil + +ifdef SLKRUNS +TOOL_LLVMGXX42MACHO_CC += -fmessage-length=0 +TOOL_LLVMGXX42MACHO_CXX += -fmessage-length=0 +TOOL_LLVMGXX42MACHO_OBJC += -fmessage-length=0 +TOOL_LLVMGXX42MACHO_OBJCXX += -fmessage-length=0 +endif + +# General Properties used by kBuild +TOOL_LLVMGXX42MACHO_COBJSUFF ?= .o +TOOL_LLVMGXX42MACHO_CFLAGS ?= +TOOL_LLVMGXX42MACHO_CFLAGS.debug ?= -g +TOOL_LLVMGXX42MACHO_CFLAGS.profile ?= -O2 #-g -pg +TOOL_LLVMGXX42MACHO_CFLAGS.release ?= -O2 +TOOL_LLVMGXX42MACHO_CINCS ?= +TOOL_LLVMGXX42MACHO_CDEFS ?= + +TOOL_LLVMGXX42MACHO_CXXOBJSUFF ?= .o +TOOL_LLVMGXX42MACHO_CXXFLAGS ?= +TOOL_LLVMGXX42MACHO_CXXFLAGS.debug ?= -g +TOOL_LLVMGXX42MACHO_CXXFLAGS.profile ?= -O2 #-g -pg +TOOL_LLVMGXX42MACHO_CXXFLAGS.release ?= -O2 +TOOL_LLVMGXX42MACHO_CXXINCS ?= +TOOL_LLVMGXX42MACHO_CXXDEFS ?= + +TOOL_LLVMGXX42MACHO_OBJCOBJSUFF ?= .o +TOOL_LLVMGXX42MACHO_OBJCFLAGS ?= +TOOL_LLVMGXX42MACHO_OBJCFLAGS.debug ?= -g +TOOL_LLVMGXX42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg +TOOL_LLVMGXX42MACHO_OBJCFLAGS.release?= -O2 +TOOL_LLVMGXX42MACHO_OBJCINCS ?= +TOOL_LLVMGXX42MACHO_OBJCDEFS ?= + +TOOL_LLVMGXX42MACHO_OBJCXXOBJSUFF ?= .o +TOOL_LLVMGXX42MACHO_OBJCXXFLAGS ?= +TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.debug ?= -g +TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg +TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.release ?= -O2 +TOOL_LLVMGXX42MACHO_OBJCXXINCS ?= +TOOL_LLVMGXX42MACHO_OBJCXXDEFS ?= + +TOOL_LLVMGXX42MACHO_ASFLAGS ?= -x assembler-with-cpp +TOOL_LLVMGXX42MACHO_ASFLAGS.debug ?= -g +TOOL_LLVMGXX42MACHO_ASFLAGS.profile ?= -g +TOOL_LLVMGXX42MACHO_ASOBJSUFF ?= .o + +TOOL_LLVMGXX42MACHO_AR ?= ar$(HOSTSUFF_EXE) +TOOL_LLVMGXX42MACHO_ARFLAGS ?= -c -rs +TOOL_LLVMGXX42MACHO_ARLIBSUFF ?= .a + +TOOL_LLVMGXX42MACHO_LDFLAGS ?= +TOOL_LLVMGXX42MACHO_LDFLAGS.debug ?= -g +TOOL_LLVMGXX42MACHO_LDFLAGS.profile ?= -g + +TOOL_LLVMGXX42MACHO_STRIP_PROGRAM ?= strip -SXxru +TOOL_LLVMGXX42MACHO_STRIP_DLL ?= strip -Sxru +TOOL_LLVMGXX42MACHO_STRIP_SYSMOD ?= strip -Sru + + +## +# Calculate the files in the debug bundle. +# @param 1 The whole output filename. +# @param 2 The output filename sans suffix. +TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN = \ + $(1).dSYM/ \ + $(1).dSYM/Contents/ \ + $(1).dSYM/Contents/Resources/ \ + $(1).dSYM/Contents/Resources/DWARF/ \ + $(1).dSYM/Contents/Info.plist \ + $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1)) + +## +# Calculate the files in the debug bundle. +# @param 1 The whole linker output filename. +# @param 2 The linker output filename sans suffix. +# @param 3 The desired install name (no dir slash). +# @remarks The Info.plist has some reference to the original name, but gdb +# does not care and only check for a symbol file in the DWARF +# directory with the same name as the debugged module. +TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN= \ + $(3).dSYM/ \ + $(3).dSYM/Contents/ \ + $(3).dSYM/Contents/Resources/ \ + $(3).dSYM/Contents/Resources/DWARF/ \ + $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \ + $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3)) + + +## Compile C source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_LLVMGXX42MACHO_COMPILE_C_DEPEND = +TOOL_LLVMGXX42MACHO_COMPILE_C_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_LLVMGXX42MACHO_COMPILE_C_USES_KOBJCACHE = 1 +TOOL_LLVMGXX42MACHO_COMPILE_C_OUTPUT = $(outbase).i +define TOOL_LLVMGXX42MACHO_COMPILE_C_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).i\ + $(TOOL_LLVMGXX42MACHO_CC) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_LLVMGXX42MACHO_CC) -c\ + $(flags) -fpreprocessed -x c\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_LLVMGXX42MACHO_COMPILE_C_OUTPUT = +define TOOL_LLVMGXX42MACHO_COMPILE_C_CMDS + $(QUIET)$(TOOL_LLVMGXX42MACHO_CC) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KUSE_OBJCACHE + + +## Compile C++ source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPEND = +TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_LLVMGXX42MACHO_COMPILE_CXX_USES_KOBJCACHE = 1 +TOOL_LLVMGXX42MACHO_COMPILE_CXX_OUTPUT = $(outbase).ii +define TOOL_LLVMGXX42MACHO_COMPILE_CXX_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).ii\ + $(TOOL_LLVMGXX42MACHO_CXX) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_LLVMGXX42MACHO_CXX) -c\ + $(flags) -fpreprocessed -x c++\ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_LLVMGXX42MACHO_COMPILE_CXX_OUTPUT = +define TOOL_LLVMGXX42MACHO_COMPILE_CXX_CMDS + $(QUIET)$(TOOL_LLVMGXX42MACHO_CXX) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Objective-C source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPEND = +TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_LLVMGXX42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1 +TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi +define TOOL_LLVMGXX42MACHO_COMPILE_OBJC_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).ii\ + $(TOOL_LLVMGXX42MACHO_OBJC) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_LLVMGXX42MACHO_OBJC) -c\ + $(flags) -fpreprocessed -x objective-c \ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT = +define TOOL_LLVMGXX42MACHO_COMPILE_OBJC_CMDS + $(QUIET)$(TOOL_LLVMGXX42MACHO_OBJC) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Objective-C++ source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPEND = +TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPORD = +ifdef KBUILD_USE_KOBJCACHE +TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1 +TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii +define TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_CMDS + $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ + --kObjCache-cpp $(outbase).mii\ + $(TOOL_LLVMGXX42MACHO_OBJCXX) -E -o -\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + $(abspath $(source))\ + --kObjCache-cc $(obj)\ + $(TOOL_LLVMGXX42MACHO_OBJCXX) -c\ + $(flags) -fpreprocessed -x objective-c++ \ + -o $(obj)\ + - + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +else # !KBUILD_USE_KOBJCACHE +TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT = +define TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_CMDS + $(QUIET)$(TOOL_LLVMGXX42MACHO_OBJCXX) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef +endif # !KBUILD_USE_KOBJCACHE + + +## Compile Assembly source. +# @param $(target) Normalized main target name. +# @param $(source) Source filename (relative). +# @param $(obj) Object file name. This shall be (re)created by the compilation. +# @param $(dep) Dependcy file. This shall be (re)created by the compilation. +# @param $(flags) Flags. +# @param $(defs) Definitions. No -D or something. +# @param $(incs) Includes. No -I or something. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(outbase) Output basename (full). Use this for list files and such. +# @param $(objsuff) Object suffix. +# +TOOL_LLVMGXX42MACHO_COMPILE_AS_OUTPUT = +TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPEND = +TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPORD = +define TOOL_LLVMGXX42MACHO_COMPILE_AS_CMDS + $(QUIET)$(TOOL_LLVMGXX42MACHO_AS) -c\ + $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ + -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ + -o $(obj)\ + $(abspath $(source)) + $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" +endef + + +## Link library +# @param $(target) Normalized main target name. +# @param $(out) Library name. +# @param $(objs) Object files to put in the library. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_LLVMGXX42MACHO_LINK_LIBRARY_OUTPUT = +TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPEND = $(othersrc) +TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPORD = +define TOOL_LLVMGXX42MACHO_LINK_LIBRARY_CMDS + $(if $(strip $(objs)),$(call xargs,$(QUIET)$(TOOL_LLVMGXX42MACHO_AR) $(flags) $(out),$(objs))) + $(foreach lib,$(othersrc)\ + ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \ + $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \ + $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \ + $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \ + && $(TOOL_LLVMGXX42MACHO_AR) -x $(abspath $(lib)) \ + && $(RM_EXT) -f ./__.SYMDEF* \ + && $(TOOL_LLVMGXX42MACHO_AR) $(flags) $(out) *) \ + $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \ + $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/) +endef + + +## Link program +# @param $(target) Normalized main target name. +# @param $(out) Program name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp +TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN) +TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPORD = +define TOOL_LLVMGXX42MACHO_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_LLVMGXX42MACHO_LD) $(flags) -o $(out)\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_PROGRAM) $(out) + endif +endef + + +## Link DLL +# @param $(target) Normalized main target name. +# @param $(out) Program name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp +TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_LLVMGXX42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN) +TOOL_LLVMGXX42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_LLVMGXX42MACHO_LINK_DLL_DEPORD = +define TOOL_LLVMGXX42MACHO_LINK_DLL_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_LLVMGXX42MACHO_LD) $(TOOL_LLVMGXX42MACHO_LDFLAGS.dll) $(flags) -o $(out)\ + $(call TOOL_LLVMGXX42MACHO_LD_SONAME,$(target),$(out))\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_DLL) $(out) + endif +endef + + +## Link system module (windows aka driver, linux aka kernel module) +# @param $(target) Normalized main target name. +# @param $(out) System module name. +# @param $(objs) Object files to link together. +# @param $(libs) Libraries to search. +# @param $(libpath) Library search paths. +# @param $(flags) Flags. +# @param $(dirdep) Directory creation dependency. +# @param $(deps) Other dependencies. +# @param $(othersrc) Unhandled sources. +# @param $(custom_pre) Custom step invoked before linking. +# @param $(custom_post) Custom step invoked after linking. +# @param $(outbase) Output basename (full). Use this for list files and such. +TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp +TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out)) +TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN) +TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) +TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPORD = +define TOOL_LLVMGXX42MACHO_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -n $(outbase).rsp $(objs) + $(QUIET)$(TOOL_LLVMGXX42MACHO_LD_SYSMOD) $(TOOL_LLVMGXX42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\ + -filelist $(outbase).rsp\ + $(foreach p,$(libpath), -L$(p))\ + $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) + ifeq ($(ld_debug),split) + $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out) + $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_SYSMOD) $(out) + endif +endef + diff --git a/kBuild/tools/OPENWATCOM-16.kmk b/kBuild/tools/OPENWATCOM-16.kmk index 2789afb..a9c141f 100644 --- a/kBuild/tools/OPENWATCOM-16.kmk +++ b/kBuild/tools/OPENWATCOM-16.kmk @@ -1,4 +1,4 @@ -# $Id: OPENWATCOM-16.kmk 2413 2010-09-11 17:43:04Z bird $ +# $Id: OPENWATCOM-16.kmk 2572 2012-04-27 13:19:55Z bird $ ## @file # kBuild Tool Config - Open Watcom v1.4 and later, 16-bit targets. # @@ -45,13 +45,13 @@ TOOL_OPENWATCOM-16_COMPILE_AS_DEPEND = TOOL_OPENWATCOM-16_COMPILE_AS_DEPORD = TOOL_OPENWATCOM-16_COMPILE_AS_OUTPUT = $(obj).err define TOOL_OPENWATCOM-16_COMPILE_AS_CMDS - $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CC16) \ + $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AS) \ $(flags) \ - $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \ + $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \ $(addprefix -d, $(defs)) \ - -fo=$(subst /,\\,$(obj)) \ - -fr=$(subst /,\\,$(obj)).err \ - $(subst /,\\,$(abspath $(source))) + -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \ + -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) $(QUIET)$(APPEND) -n $(obj).err ## @todo dependencies endef @@ -62,11 +62,11 @@ TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT = $(obj).err define TOOL_OPENWATCOM-16_COMPILE_C_CMDS $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CC16) \ $(flags) \ - $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \ + $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \ $(addprefix -d, $(defs)) \ - -fo=$(subst /,\\,$(obj)) \ - -fr=$(subst /,\\,$(obj)).err \ - $(subst /,\\,$(abspath $(source))) + -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \ + -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) $(QUIET)$(APPEND) -n $(obj).err ## @todo dependencies endef @@ -77,11 +77,11 @@ TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT = $(obj).err define TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CXX16) \ $(flags) \ - $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \ + $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \ $(addprefix -d, $(defs)) \ - -fo=$(subst /,\\,$(obj)) \ - -fr=$(subst /,\\,$(obj)).err \ - $(subst /,\\,$(abspath $(source))) + -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \ + -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) $(QUIET)$(APPEND) -n $(obj).err ## @todo dependencies endef @@ -93,74 +93,77 @@ define TOOL_OPENWATCOM-16_COMPILE_RC_CMDS $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) -r\ $(flags) \ - $(addprefix -i=, $(subst /,\\,$(incs))) \ + $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs))) \ $(addprefix -d, $(defs))\ - -fo=$(subst /,\\,$(obj)) \ - $(subst /,\\,$(abspath $(source))) + -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) endef TOOL_OPENWATCOM-16_LINK_LIBRARY_OUTPUT = $(outbase).rsp TOOL_OPENWATCOM-16_LINK_LIBRARY_DEPEND = $(othersrc) TOOL_OPENWATCOM-16_LINK_LIBRARY_DEPORD = define TOOL_OPENWATCOM-16_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(subst /,\,$(objs) $(othersrc)),'+"$(obj)"') - $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(subst /,\\,$(out)) @$(outbase).rsp + $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(objs) $(othersrc)),'+"$(obj)"') + $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) @$(outbase).rsp endef TOOL_OPENWATCOM-16_LINK_PROGRAM_OUTPUT = $(outbase).map +TOOL_OPENWATCOM-16_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).sym TOOL_OPENWATCOM-16_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_OPENWATCOM-16_LINK_PROGRAM_DEPORD = define TOOL_OPENWATCOM-16_LINK_PROGRAM_CMDS $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \ $(TOOL_OPENWATCOM_LD16) \ $(flags) \ - -fe=$(subst /,\\,$(out)) \ - -fm=$(subst /,\\,$(outbase).map) \ - $(subst /,\\,$(filter-out %.res,$(objs))) \ - $(subst /,\\,$(libs)) \ - $(subst /,\\,$(othersrc)) + -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc)) $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) \ $(filter -bt=%,$(flags)) \ - /fe=$(subst /,\\,$(out)) \ - $(subst /,\\,$(filter %.res,$(objs)))) + /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs)))) endef TOOL_OPENWATCOM-16_LINK_DLL_OUTPUT = $(outbase).map +TOOL_OPENWATCOM-16_LINK_DLL_OUTPUT_MAYBE = $(outbase).sym TOOL_OPENWATCOM-16_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_OPENWATCOM-16_LINK_DLL_DEPORD = define TOOL_OPENWATCOM-16_LINK_DLL_CMDS $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \ $(TOOL_OPENWATCOM_LD16) \ $(flags) \ - -fe=$(subst /,\\,$(out)) \ - -fm=$(subst /,\\,$(outbase).map) \ - $(subst /,\\,$(filter-out %.res,$(objs))) \ - $(subst /,\\,$(libs)) \ - $(subst /,\\,$(othersrc)) + -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc)) $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) \ $(filter -bt=%,$(flags)) \ - /fe=$(subst /,\\,$(out)) \ - $(subst /,\\,$(filter %.res,$(objs)))) + /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs)))) endef TOOL_OPENWATCOM-16_LINK_SYSMOD_OUTPUT = $(outbase).map +TOOL_OPENWATCOM-16_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).sym TOOL_OPENWATCOM-16_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_OPENWATCOM-16_LINK_SYSMOD_DEPORD = define TOOL_OPENWATCOM-16_LINK_SYSMOD_CMDS $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \ $(TOOL_OPENWATCOM_LD16) \ $(flags) \ - -fe=$(subst /,\\,$(out)) \ - -fm=$(subst /,\\,$(outbase).map) \ - $(subst /,\\,$(filter-out %.res,$(objs))) \ - $(subst /,\\,$(libs)) \ - $(subst /,\\,$(othersrc)) + -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc)) $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) \ $(filter -bt=%,$(flags)) \ - /fe=$(subst /,\\,$(out)) \ - $(subst /,\\,$(filter %.res,$(objs)))) + /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs)))) endef diff --git a/kBuild/tools/OPENWATCOM-WL.kmk b/kBuild/tools/OPENWATCOM-WL.kmk index bc5d526..25556ac 100644 --- a/kBuild/tools/OPENWATCOM-WL.kmk +++ b/kBuild/tools/OPENWATCOM-WL.kmk @@ -1,4 +1,4 @@ -# $Id: OPENWATCOM-WL.kmk 2413 2010-09-11 17:43:04Z bird $ +# $Id: OPENWATCOM-WL.kmk 2572 2012-04-27 13:19:55Z bird $ ## @file # kBuild Tool Config - Open Watcom v1.4 and later, using wlink. # @@ -43,36 +43,40 @@ TOOL_OPENWATCOM-WL_LDFLAGS.win ?= $(NO_SUCH_VARIABLE) TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp +TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).sym TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPORD = define TOOL_OPENWATCOM-WL_LINK_PROGRAM_CMDS $(QUIET)$(APPEND) -tn $(outbase).rsp \ $(if $(flags),'$(flags)',) \ - 'Name $(subst /,\,$(out)$(if $(suffix $(out)),,.))' \ - 'Option Map=$(subst /,\,$(outbase)).map' \ - $(foreach p,$(subst /,\,$(libpath)),'LIBPath $p') \ - $(foreach o,$(subst /,\,$(filter-out %.res,$(objs)) $(othersrc)),'$(if $(filter %.lib %.a,$l),LIB,)File $o') \ - $(foreach l,$(subst /,\,$(libs)),'Library $l') + 'Name $(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)$(if $(suffix $(out)),,.))' \ + 'Option Map=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase)).map' \ + $(foreach p,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(libpath)),'LIBPath $p') \ + $(foreach o,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs)) $(othersrc)),'$(if $(filter %.lib %.a,$l),LIB,)File $o') \ + $(foreach l,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)),'Library $l') $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_WLINK) @$(outbase).rsp $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) \ $(filter -bt=%,$(flags)) \ - /fe=$(subst /,\\,$(out)) \ - $(subst /,\\,$(filter %.res,$(objs)))) + /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs)))) endef TOOL_OPENWATCOM-WL_LINK_DLL_OUTPUT = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT) +TOOL_OPENWATCOM-WL_LINK_DLL_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE) TOOL_OPENWATCOM-WL_LINK_DLL_DEPEND = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPEND) TOOL_OPENWATCOM-WL_LINK_DLL_DEPORD = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPORD) TOOL_OPENWATCOM-WL_LINK_DLL_CMDS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_CMDS) TOOL_OPENWATCOM-WL_LINK_SYSMOD_OUTPUT = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT) +TOOL_OPENWATCOM-WL_LINK_SYSMOD_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE) TOOL_OPENWATCOM-WL_LINK_SYSMOD_DEPEND = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPEND) TOOL_OPENWATCOM-WL_LINK_SYSMOD_DEPORD = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPORD) TOOL_OPENWATCOM-WL_LINK_SYSMOD_CMDS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_CMDS) TOOL_OPENWATCOM-WL_LINK_MISCBIN_OUTPUT = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT) +TOOL_OPENWATCOM-WL_LINK_MISCBIN_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_OUTPUT_MAYBE) TOOL_OPENWATCOM-WL_LINK_MISCBIN_DEPEND = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPEND) TOOL_OPENWATCOM-WL_LINK_MISCBIN_DEPORD = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_DEPORD) TOOL_OPENWATCOM-WL_LINK_MISCBIN_CMDS = $(TOOL_OPENWATCOM-WL_LINK_PROGRAM_CMDS) diff --git a/kBuild/tools/OPENWATCOM.kmk b/kBuild/tools/OPENWATCOM.kmk index 157474a..9d361bb 100644 --- a/kBuild/tools/OPENWATCOM.kmk +++ b/kBuild/tools/OPENWATCOM.kmk @@ -1,4 +1,4 @@ -# $Id: OPENWATCOM.kmk 2413 2010-09-11 17:43:04Z bird $ +# $Id: OPENWATCOM.kmk 2576 2012-05-31 15:07:00Z bird $ ## @file # kBuild Tool Config - Open Watcom v1.4 and later. # @@ -58,21 +58,48 @@ endif ifneq ($(PATH_TOOL_OPENWATCOM),) TOOL_OPENWATCOM_PATHLESS := no - ifeq ($(KBUILD_HOST),os2) + ifeq ($(KBUILD_HOST),darwin) + PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binosx + TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \ + -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \ + -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \ + -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \ + -E 'LIB=$1' \ + -E 'INCLUDE=' \ + -- + else ifeq ($(KBUILD_HOST),freebsd) + PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binfbsd + TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \ + -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \ + -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \ + -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \ + -E 'LIB=$1' \ + -E 'INCLUDE=' \ + -- + else ifeq ($(KBUILD_HOST),linux) + PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binl + TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \ + -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \ + -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \ + -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \ + -E 'LIB=$1' \ + -E 'INCLUDE=' \ + -- + else ifeq ($(KBUILD_HOST),os2) PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binp TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \ -E 'BEGINLIBPATH=$(PATH_TOOL_OPENWATCOM)/binp/dll;$(BEGINLIBPATH)' \ -E 'LIBPATHSTRICT=T' \ - -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw' \ + -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw;$(PATH)' \ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \ -E 'LIB=$1' \ -E 'INCLUDE=' \ -- - else ifeq ($(KBUILD_HOST),linux) - PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binl + else ifeq ($(KBUILD_HOST),solaris) + PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binsol TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \ - -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binw' \ + -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \ -E 'LIB=$1' \ @@ -81,7 +108,7 @@ ifneq ($(PATH_TOOL_OPENWATCOM),) else PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binnt TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \ - -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw' \ + -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw;$(PATH)' \ -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \ -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \ -E 'LIB=$1' \ @@ -120,6 +147,12 @@ else endif +if1of ($(KBUILD_HOST), os2 win) + TOOL_OPENWATCOM_FIX_SLASHES = $(subst /,\\,$1) +else + TOOL_OPENWATCOM_FIX_SLASHES = $1 +endif + # General Properties used by kBuild TOOL_OPENWATCOM_ASOBJSUFF ?= .obj TOOL_OPENWATCOM_ASFLAGS ?= -zq @@ -168,11 +201,11 @@ TOOL_OPENWATCOM_COMPILE_AS_OUTPUT = $(obj).err define TOOL_OPENWATCOM_COMPILE_AS_CMDS $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AS) \ $(flags) \ - $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \ + $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \ $(addprefix -d, $(defs)) \ - -fo=$(subst /,\\,$(obj)) \ - -fr=$(subst /,\\,$(obj)).err \ - $(subst /,\\,$(abspath $(source))) + -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \ + -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) $(QUIET)$(APPEND) -n $(obj).err ## @todo dependencies endef @@ -184,11 +217,11 @@ TOOL_OPENWATCOM_COMPILE_C_OUTPUT = $(obj).err define TOOL_OPENWATCOM_COMPILE_C_CMDS $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CC) \ $(flags) \ - $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \ + $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \ $(addprefix -d, $(defs)) \ - -fo=$(subst /,\\,$(obj)) \ - -fr=$(subst /,\\,$(obj)).err \ - $(subst /,\\,$(abspath $(source))) + -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \ + -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) $(QUIET)$(APPEND) -n $(obj).err ## @todo dependencies endef @@ -199,11 +232,11 @@ TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT = $(obj).err define TOOL_OPENWATCOM_COMPILE_CXX_CMDS $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CXX) \ $(flags) \ - $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \ + $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \ $(addprefix -d, $(defs)) \ - -fo=$(subst /,\\,$(obj)) \ - -fr=$(subst /,\\,$(obj)).err \ - $(subst /,\\,$(abspath $(source))) + -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \ + -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) $(QUIET)$(APPEND) -n $(obj).err ## @todo dependencies endef @@ -215,18 +248,18 @@ define TOOL_OPENWATCOM_COMPILE_RC_CMDS $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) -r\ $(flags) \ - $(addprefix -i=, $(subst /,\\,$(incs))) \ + $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs))) \ $(addprefix -d, $(defs))\ - -fo=$(subst /,\\,$(obj)) \ - $(subst /,\\,$(abspath $(source))) + -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) endef TOOL_OPENWATCOM_LINK_LIBRARY_OUTPUT = ## @todo $(outbase).rsp TOOL_OPENWATCOM_LINK_LIBRARY_DEPEND = $(othersrc) TOOL_OPENWATCOM_LINK_LIBRARY_DEPORD = define TOOL_OPENWATCOM_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(subst /,\,$(objs) $(othersrc)),'+"$(obj)"') - $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(subst /,\\,$(out)) @$(outbase).rsp + $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(objs) $(othersrc)),'+"$(obj)"') + $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) @$(outbase).rsp endef TOOL_OPENWATCOM_LINK_PROGRAM_OUTPUT = $(outbase).map @@ -236,16 +269,16 @@ define TOOL_OPENWATCOM_LINK_PROGRAM_CMDS $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \ $(TOOL_OPENWATCOM_LD) \ $(flags) \ - -fe=$(subst /,\\,$(out)) \ - -fm=$(subst /,\\,$(outbase).map) \ - $(subst /,\\,$(filter-out %.res,$(objs))) \ - $(subst /,\\,$(libs)) \ - $(subst /,\\,$(othersrc)) + -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc)) $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) \ $(filter -bt=%,$(flags)) \ - /fe=$(subst /,\\,$(out)) \ - $(subst /,\\,$(filter %.res,$(objs)))) + /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs)))) endef TOOL_OPENWATCOM_LINK_DLL_OUTPUT = $(outbase).map @@ -255,16 +288,16 @@ define TOOL_OPENWATCOM_LINK_DLL_CMDS $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \ $(TOOL_OPENWATCOM_LD) \ $(flags) \ - -fe=$(subst /,\\,$(out)) \ - -fm=$(subst /,\\,$(outbase).map) \ - $(subst /,\\,$(filter-out %.res,$(objs))) \ - $(subst /,\\,$(libs)) \ - $(subst /,\\,$(othersrc)) + -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc)) $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) \ $(filter -bt=%,$(flags)) \ - /fe=$(subst /,\\,$(out)) \ - $(subst /,\\,$(filter %.res,$(objs)))) + /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs)))) endef TOOL_OPENWATCOM_LINK_SYSMOD_OUTPUT = $(outbase).map @@ -274,15 +307,15 @@ define TOOL_OPENWATCOM_LINK_SYSMOD_CMDS $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \ $(TOOL_OPENWATCOM_LD) \ $(flags) \ - -fe=$(subst /,\\,$(out)) \ - -fm=$(subst /,\\,$(outbase).map) \ - $(subst /,\\,$(filter-out %.res,$(objs))) \ - $(subst /,\\,$(libs)) \ - $(subst /,\\,$(othersrc)) + -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc)) $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \ $(TOOL_OPENWATCOM_RC) \ $(filter -bt=%,$(flags)) \ - /fe=$(subst /,\\,$(out)) \ - $(subst /,\\,$(filter %.res,$(objs)))) + /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \ + $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs)))) endef diff --git a/kBuild/tools/StandardDTrace.kmk b/kBuild/tools/StandardDTrace.kmk new file mode 100644 index 0000000..8b32781 --- /dev/null +++ b/kBuild/tools/StandardDTrace.kmk @@ -0,0 +1,52 @@ +# $Id: StandardDTrace.kmk 2567 2012-03-17 19:27:32Z bird $ +## @file +# Standard DTrace tool. +# + +# +# Copyright (c) 2012 knut st. osmundsen <bird-kBuild-spamx@anduin.net> +# +# This file is part of kBuild. +# +# kBuild is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# kBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with kBuild; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# +# As a special exception you are granted permission to include this file, via +# the kmk include directive, as you wish without this in itself causing the +# resulting makefile, program or whatever to be covered by the GPL license. +# This exception does not however invalidate any other reasons why the makefile, +# program, whatever should not be covered the GPL. +# +# + +TOOL_StandardDTrace := Standard DTrace or similar. +TOOL_StandardDTrace_DTRACE := dtrace + +TOOL_StandardDTrace_DTRACE_HDR_FLAGS := -h +define TOOL_StandardDTrace_DTRACE_HDR_CMDS + $(QUIET)$(TOOL_StandardDTrace_DTRACE) $(flags) \ + -o "$(out)" -s "$(source)" +endef + +TOOL_StandardDTrace_DTRACE_OBJ_NOT_NEEDED := darwin +TOOL_StandardDTrace_DTRACE_OBJ_FLAGS := -G +define TOOL_StandardDTrace_DTRACE_OBJ_CMDS + $(QUIET)$(TOOL_StandardDTrace_DTRACE) \ + $(if-expr $(intersects $(bld_trg_arch),$(KBUILD_ARCHES_64)),-64,-32) \ + $(flags) \ + -o "$(out)" -s "$(source)" \ + $$(filter-out %-dtrace-object-format.o, $$($(target)_2_OBJS)) +endef + diff --git a/kBuild/tools/VCC100.kmk b/kBuild/tools/VCC100.kmk index bec59f9..a16807a 100644 --- a/kBuild/tools/VCC100.kmk +++ b/kBuild/tools/VCC100.kmk @@ -1,4 +1,4 @@ -# $Id: VCC100.kmk 2524 2011-08-01 13:37:47Z bird $ +# $Id: VCC100.kmk 2557 2011-12-13 12:48:32Z bird $ ## @file # kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting $(KBUILD_TARGET). # @@ -226,7 +226,7 @@ TOOL_VCC100_LINK_LIBRARY_DEPORD = TOOL_VCC100_LINK_LIBRARY_OUTPUT = $(outbase).rsp TOOL_VCC100_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb define TOOL_VCC100_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -n $(outbase).rsp \ + $(QUIET)$(APPEND) -tn $(outbase).rsp \ $(foreach arg,\ $(subst /,\\,$(objs) \ $(filter-out %.def,$(othersrc))) \ @@ -254,11 +254,16 @@ endef # TOOL_VCC100_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100_LINK_PROGRAM_DEPORD = -TOOL_VCC100_LINK_PROGRAM_OUTPUT = $(outbase).map +TOOL_VCC100_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC100_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC100_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -266,8 +271,7 @@ define TOOL_VCC100_LINK_PROGRAM_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)) endef @@ -289,11 +293,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC100_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB)) -TOOL_VCC100_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp +TOOL_VCC100_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).rsp TOOL_VCC100_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp TOOL_VCC100_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100_LINK_DLL_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100_LD) $(flags) \ /OUT:$(out) \ /IMPLIB:$(outbase).lib \ @@ -303,8 +312,7 @@ define TOOL_VCC100_LINK_DLL_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/ @@ -328,11 +336,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC100_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100_LINK_SYSMOD_DEPORD = -TOOL_VCC100_LINK_SYSMOD_OUTPUT = $(outbase).map +TOOL_VCC100_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC100_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC100_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -340,8 +353,7 @@ define TOOL_VCC100_LINK_SYSMOD_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' endef diff --git a/kBuild/tools/VCC100AMD64.kmk b/kBuild/tools/VCC100AMD64.kmk index eee77af..43e7ecd 100644 --- a/kBuild/tools/VCC100AMD64.kmk +++ b/kBuild/tools/VCC100AMD64.kmk @@ -1,4 +1,4 @@ -# $Id: VCC100AMD64.kmk 2524 2011-08-01 13:37:47Z bird $ +# $Id: VCC100AMD64.kmk 2557 2011-12-13 12:48:32Z bird $ ## @file # kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting AMD64. # @@ -246,7 +246,7 @@ TOOL_VCC100AMD64_LINK_LIBRARY_DEPORD = TOOL_VCC100AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp TOOL_VCC100AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb define TOOL_VCC100AMD64_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -n $(outbase).rsp \ + $(QUIET)$(APPEND) -tn $(outbase).rsp \ $(foreach arg,\ $(subst /,\\,$(objs) \ $(filter-out %.def,$(othersrc))) \ @@ -272,11 +272,16 @@ endef # TOOL_VCC100AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100AMD64_LINK_PROGRAM_DEPORD = -TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT = $(outbase).map +TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100AMD64_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100AMD64_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -284,8 +289,7 @@ define TOOL_VCC100AMD64_LINK_PROGRAM_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)) endef @@ -307,11 +311,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC100AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB)) -TOOL_VCC100AMD64_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp +TOOL_VCC100AMD64_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).rsp TOOL_VCC100AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp TOOL_VCC100AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100AMD64_LINK_DLL_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100AMD64_LD) $(flags) \ /OUT:$(out) \ /IMPLIB:$(outbase).lib \ @@ -321,8 +330,7 @@ define TOOL_VCC100AMD64_LINK_DLL_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/ @@ -346,11 +354,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC100AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100AMD64_LINK_SYSMOD_DEPORD = -TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT = $(outbase).map +TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100AMD64_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100AMD64_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -358,8 +371,7 @@ define TOOL_VCC100AMD64_LINK_SYSMOD_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' endef diff --git a/kBuild/tools/VCC100X86.kmk b/kBuild/tools/VCC100X86.kmk index 75dc242..1ec1f57 100644 --- a/kBuild/tools/VCC100X86.kmk +++ b/kBuild/tools/VCC100X86.kmk @@ -1,4 +1,4 @@ -# $Id: VCC100X86.kmk 2524 2011-08-01 13:37:47Z bird $ +# $Id: VCC100X86.kmk 2557 2011-12-13 12:48:32Z bird $ ## @file # kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting x86. # @@ -207,7 +207,7 @@ TOOL_VCC100X86_LINK_LIBRARY_DEPORD = TOOL_VCC100X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp TOOL_VCC100X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb define TOOL_VCC100X86_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -n $(outbase).rsp \ + $(QUIET)$(APPEND) -tn $(outbase).rsp \ $(foreach arg,\ $(subst /,\\,$(objs) \ $(filter-out %.def,$(othersrc))) \ @@ -233,11 +233,16 @@ endef # TOOL_VCC100X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100X86_LINK_PROGRAM_DEPORD = -TOOL_VCC100X86_LINK_PROGRAM_OUTPUT = $(outbase).map +TOOL_VCC100X86_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC100X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC100X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100X86_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100X86_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -245,8 +250,7 @@ define TOOL_VCC100X86_LINK_PROGRAM_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)) endef @@ -268,11 +272,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC100X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB)) -TOOL_VCC100X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp +TOOL_VCC100X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).rsp TOOL_VCC100X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp TOOL_VCC100X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100X86_LINK_DLL_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100X86_LD) $(flags) \ /OUT:$(out) \ /IMPLIB:$(outbase).lib \ @@ -282,8 +291,7 @@ define TOOL_VCC100X86_LINK_DLL_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/ @@ -307,11 +315,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC100X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC100X86_LINK_SYSMOD_DEPORD = -TOOL_VCC100X86_LINK_SYSMOD_OUTPUT = $(outbase).map +TOOL_VCC100X86_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC100X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC100X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC100X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC100X86_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC100X86_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -319,8 +332,7 @@ define TOOL_VCC100X86_LINK_SYSMOD_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' endef diff --git a/kBuild/tools/VCC70.kmk b/kBuild/tools/VCC70.kmk index 02ade66..ae79a67 100644 --- a/kBuild/tools/VCC70.kmk +++ b/kBuild/tools/VCC70.kmk @@ -1,4 +1,4 @@ -# $Id: VCC70.kmk 2524 2011-08-01 13:37:47Z bird $ +# $Id: VCC70.kmk 2557 2011-12-13 12:48:32Z bird $ ## @file # kBuild Tool Config - Visual C++ 7.0 (aka Visual Studio .NET), targeting x86. # @@ -239,7 +239,7 @@ TOOL_VCC70_LINK_LIBRARY_DEPORD = TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).rsp TOOL_VCC70_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb define TOOL_VCC70_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -n $(outbase).rsp \ + $(QUIET)$(APPEND) -tn $(outbase).rsp \ $(foreach arg,\ $(subst /,\\,$(objs) \ $(filter-out %.def,$(othersrc))) \ @@ -263,12 +263,18 @@ endef # @param $(custom_post) Custom step invoked after linking. # @param $(outbase) Output basename (full). Use this for list files and such. # +TOOL_VCC70_LINK_PROGRAM_OUTPUT = $(outbase).rsp TOOL_VCC70_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).ilk TOOL_VCC70_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC70_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC70_LINK_PROGRAM_DEPORD = define TOOL_VCC70_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC70_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \ @@ -276,8 +282,7 @@ define TOOL_VCC70_LINK_PROGRAM_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp endef @@ -295,13 +300,18 @@ endef # @param $(custom_post) Custom step invoked after linking. # # @param $(outbase) Output basename (full). Use this for list files and such. -TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp +TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).rsp TOOL_VCC70_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp TOOL_VCC70_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC70_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB)) define TOOL_VCC70_LINK_DLL_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC70_LD) $(flags) \ /OUT:$(out) \ /IMPLIB:$(outbase).lib \ @@ -311,8 +321,7 @@ define TOOL_VCC70_LINK_DLL_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/ $(eval _DIRS += $(PATH_STAGE_LIB)) endef @@ -332,13 +341,18 @@ endef # @param $(custom_post) Custom step invoked after linking. # # @param $(outbase) Output basename (full). Use this for list files and such. -TOOL_VCC70_LINK_SYSMOD_OUTPUT = $(outbase).map +TOOL_VCC70_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC70_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk TOOL_VCC70_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC70_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC70_LINK_SYSMOD_DEPORD = define TOOL_VCC70_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC70_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \ @@ -346,7 +360,6 @@ define TOOL_VCC70_LINK_SYSMOD_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp endef diff --git a/kBuild/tools/VCC80.kmk b/kBuild/tools/VCC80.kmk index f9b6703..3f2fdf0 100644 --- a/kBuild/tools/VCC80.kmk +++ b/kBuild/tools/VCC80.kmk @@ -1,4 +1,4 @@ -# $Id: VCC80.kmk 2524 2011-08-01 13:37:47Z bird $ +# $Id: VCC80.kmk 2557 2011-12-13 12:48:32Z bird $ ## @file # kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(KBUILD_TARGET). # @@ -226,7 +226,7 @@ TOOL_VCC80_LINK_LIBRARY_DEPORD = TOOL_VCC80_LINK_LIBRARY_OUTPUT = $(outbase).rsp TOOL_VCC80_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb define TOOL_VCC80_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -n $(outbase).rsp \ + $(QUIET)$(APPEND) -tn $(outbase).rsp \ $(foreach arg,\ $(subst /,\\,$(objs) \ $(filter-out %.def,$(othersrc))) \ @@ -254,11 +254,16 @@ endef # TOOL_VCC80_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80_LINK_PROGRAM_DEPORD = -TOOL_VCC80_LINK_PROGRAM_OUTPUT = $(outbase).map +TOOL_VCC80_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC80_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC80_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -266,8 +271,7 @@ define TOOL_VCC80_LINK_PROGRAM_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)) endef @@ -289,11 +293,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC80_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB)) -TOOL_VCC80_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp +TOOL_VCC80_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).rsp TOOL_VCC80_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp TOOL_VCC80_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80_LINK_DLL_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80_LD) $(flags) \ /OUT:$(out) \ /IMPLIB:$(outbase).lib \ @@ -303,8 +312,7 @@ define TOOL_VCC80_LINK_DLL_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/ @@ -328,11 +336,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC80_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80_LINK_SYSMOD_DEPORD = -TOOL_VCC80_LINK_SYSMOD_OUTPUT = $(outbase).map +TOOL_VCC80_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC80_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC80_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -340,8 +353,7 @@ define TOOL_VCC80_LINK_SYSMOD_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' endef diff --git a/kBuild/tools/VCC80AMD64.kmk b/kBuild/tools/VCC80AMD64.kmk index bf4ce33..2c07f05 100644 --- a/kBuild/tools/VCC80AMD64.kmk +++ b/kBuild/tools/VCC80AMD64.kmk @@ -1,4 +1,4 @@ -# $Id: VCC80AMD64.kmk 2524 2011-08-01 13:37:47Z bird $ +# $Id: VCC80AMD64.kmk 2557 2011-12-13 12:48:32Z bird $ ## @file # kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting AMD64. # @@ -205,7 +205,7 @@ TOOL_VCC80AMD64_LINK_LIBRARY_DEPORD = TOOL_VCC80AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp TOOL_VCC80AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb define TOOL_VCC80AMD64_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -n $(outbase).rsp \ + $(QUIET)$(APPEND) -tn $(outbase).rsp \ $(foreach arg,\ $(subst /,\\,$(objs) \ $(filter-out %.def,$(othersrc))) \ @@ -231,11 +231,16 @@ endef # TOOL_VCC80AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80AMD64_LINK_PROGRAM_DEPORD = -TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT = $(outbase).map +TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80AMD64_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -243,8 +248,7 @@ define TOOL_VCC80AMD64_LINK_PROGRAM_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)) endef @@ -266,11 +270,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC80AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB)) -TOOL_VCC80AMD64_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp +TOOL_VCC80AMD64_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).rsp TOOL_VCC80AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp TOOL_VCC80AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80AMD64_LINK_DLL_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \ /OUT:$(out) \ /IMPLIB:$(outbase).lib \ @@ -280,8 +289,7 @@ define TOOL_VCC80AMD64_LINK_DLL_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/ @@ -305,11 +313,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC80AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80AMD64_LINK_SYSMOD_DEPORD = -TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT = $(outbase).map +TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80AMD64_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -317,8 +330,7 @@ define TOOL_VCC80AMD64_LINK_SYSMOD_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' endef diff --git a/kBuild/tools/VCC80X86.kmk b/kBuild/tools/VCC80X86.kmk index 546b84f..e2d736d 100644 --- a/kBuild/tools/VCC80X86.kmk +++ b/kBuild/tools/VCC80X86.kmk @@ -1,4 +1,4 @@ -# $Id: VCC80X86.kmk 2524 2011-08-01 13:37:47Z bird $ +# $Id: VCC80X86.kmk 2557 2011-12-13 12:48:32Z bird $ ## @file # kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86. # @@ -207,7 +207,7 @@ TOOL_VCC80X86_LINK_LIBRARY_DEPORD = TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp TOOL_VCC80X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb define TOOL_VCC80X86_LINK_LIBRARY_CMDS - $(QUIET)$(APPEND) -n $(outbase).rsp \ + $(QUIET)$(APPEND) -tn $(outbase).rsp \ $(foreach arg,\ $(subst /,\\,$(objs) \ $(filter-out %.def,$(othersrc))) \ @@ -233,11 +233,16 @@ endef # TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80X86_LINK_PROGRAM_DEPORD = -TOOL_VCC80X86_LINK_PROGRAM_OUTPUT = $(outbase).map +TOOL_VCC80X86_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80X86_LINK_PROGRAM_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -245,8 +250,7 @@ define TOOL_VCC80X86_LINK_PROGRAM_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)) endef @@ -268,11 +272,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB)) -TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp +TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).rsp TOOL_VCC80X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp TOOL_VCC80X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80X86_LINK_DLL_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \ /OUT:$(out) \ /IMPLIB:$(outbase).lib \ @@ -282,8 +291,7 @@ define TOOL_VCC80X86_LINK_DLL_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/ @@ -307,11 +315,16 @@ endef # @param $(outbase) Output basename (full). Use this for list files and such. TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) TOOL_VCC80X86_LINK_SYSMOD_DEPORD = -TOOL_VCC80X86_LINK_SYSMOD_OUTPUT = $(outbase).map +TOOL_VCC80X86_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb TOOL_VCC80X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb define TOOL_VCC80X86_LINK_SYSMOD_CMDS + $(QUIET)$(APPEND) -tn $(outbase).rsp \ + $(foreach arg,\ + $(subst /,\\,$(objs)) \ + $(subst /,\\,$(libs)) \ + ,\"$(arg)\") $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \ /OUT:$(out) \ /MAPINFO:EXPORTS /INCREMENTAL:NO \ @@ -319,8 +332,7 @@ define TOOL_VCC80X86_LINK_SYSMOD_CMDS $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ $(foreach p,$(libpath), /LIBPATH:$(p)) \ - $(subst /,\\,$(objs)) \ - $(subst /,\\,$(libs)) + @$(outbase).rsp $(QUIET)$(TEST) -f $(out).manifest -- \ $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2' endef diff --git a/kBuild/units/dtrace.kmk b/kBuild/units/dtrace.kmk new file mode 100644 index 0000000..794725c --- /dev/null +++ b/kBuild/units/dtrace.kmk @@ -0,0 +1,238 @@ +# $Id: dtrace.kmk 2571 2012-04-15 11:12:31Z bird $ +## @file +# DTrace unit. +# + +# +# Copyright (c) 2012 knut st. osmundsen <bird-kBuild-spamx@anduin.net> +# +# This file is part of kBuild. +# +# kBuild is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# kBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with kBuild; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# +# As a special exception you are granted permission to include this file, via +# the kmk include directive, as you wish without this in itself causing the +# resulting makefile, program or whatever to be covered by the GPL license. +# This exception does not however invalidate any other reasons why the makefile, +# program, whatever should not be covered the GPL. +# +# + +ifdef UNIT_dtrace + $(error kBuild: The lex unit was included twice!) +endif +UNIT_dtrace = dtrace + +# Add our target properties. +PROPS_TOOLS += DTRACETOOL +PROPS_SINGLE += DTRACETOOL +PROPS_ACCUMULATE_R += DTRACE_HDR_FLAGS DTRACE_OBJ_FLAGS + +# Add ourselves to the default source handlers. +KBUILD_SRC_HANDLERS += \ + .d:def_src_handler_dtrace + + +## wrapper the compile command dependency check. +ifndef NO_COMPILE_CMDS_DEPS + _DEP_DTRACE_HDR_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_),$$(commands $(out)),FORCE) + _DEP_DTRACE_OBJ_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_),$$(commands $(out)),FORCE) +else + _DEP_DTRACE_HDR_CMDS = + _DEP_DTRACE_OBJ_CMDS = +endif + + +## +# Generates the rule for creating a DTrace header from a D source file. +# +# @param out The output file. +# @param cmds The dtrace command(s). +# @param lots more +# +define def_dtrace_hdr_rule +$(out): \ + $(deps) \ + $(value _DEP_DTRACE_HDR_CMDS) \ + | \ + $(orderdeps) + %$$(call MSG_GENERATE,$(target),$$@,$(source)) + $$(QUIET)$$(RM) -f -- $(dep) $(out) + +$(cmds) + +ifndef NO_COMPILE_CMDS_DEPS + %$$(QUIET2)$$(APPEND) '$(dep)' + %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_' + %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)' + %$$(QUIET2)$$(APPEND) '$(dep)' 'endef' +endif + +# update globals +_OUT_FILES += $(out) +$(target)_INTERMEDIATES += $(out) + +endef # def_dtrace_hdr_rule + + +## +# Generates the rule for creating a DTrace object file from a D source file +# and a bunch of object files. +# +# @param out The output file. +# @param cmds The dtrace command(s). +# @param lots more +# +define def_dtrace_obj_rule +$(out): \ + $(deps) \ + $$$$(filter-out %-dtrace-object-format.o, $$$$($(target)_2_OBJS)) \ + $(value _DEP_DTRACE_OBJ_CMDS) \ + | \ + $(orderdeps) + %$$(call MSG_GENERATE,$(target),$$@,$(source) ++) + $$(QUIET)$$(RM) -f -- $(dep) $(out) + +$(cmds) + +ifndef NO_COMPILE_CMDS_DEPS + %$$(QUIET2)$$(APPEND) '$(dep)' + %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_' + %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)' + %$$(QUIET2)$$(APPEND) '$(dep)' 'endef' +endif + +# update globals +_OUT_FILES += $(out) +$(target)_2_OBJS <= $(out) + +endef # def_dtrace_hdr_rule + + +## +# Handler for .d files listed in the SOURCES properties. +# +# .d files are transformed into .h that is used when compiling, thus needing +# to be generated before anything is compiled, and into object files that needs +# to go into the linking. Mac does not create object files. +# +# The step producing the object file requires all the object files with dtrace +# probes in them as input/output as well, because it adjusts the dtrace symbols +# from UNDEF to IGNORE. This is really ugly and cannot be expressed in make +# syntax (prerequisite object files being modified). Fortunately, it works +# fine because the object files won't be used by anyone else before the dtrace +# object file exists. +# +# @param target The target file. +# @param source The source file. +# @param lots more +# @returns quite a bit. +define def_src_handler_dtrace + +local type := DTRACE +local tmp := $(kb-src-tool tool) +ifeq ($(tool),) +$ (error kBuild: $(target) / $(sources) does not have a (DTRACE) tool defined!) +endif +local dtracedir := $($(target)_0_OUTDIR)/dtrace + +# +# The header file first. +# + +# Figure out all the props. +ifndef TOOL_$(tool)_DTRACE_HDR_CMDS +$(error kBuild: TOOL_$(tool)_DTRACE_HDR_CMDS isn't defined! target=$(target) source=$(source) ) +endif +## @todo put the header in a subdir and add this to INCS? Do we have a early per-target hook for this?? +local outbase := $(dtracedir)/dtrace/$(basename $(notdir $(source))) +local out := $(outbase).h +local tmp := $(kb-src-prop DTRACE_HDR_FLAGS,flags,left-to-right,) +local tmp := $(kb-src-prop DEPS,deps,left-to-right,$(defpath)) +local tmp := $(kb-src-prop ORDERDEPS,orderdeps,left-to-right,$(defpath)) +local dirdep := $(call DIRDEP,$(dir $(out))) + +# Adjust paths if we got a default path. +ifneq ($(defpath),) + local source := $(abspathex $(source),$(defpath)) +endif + +# dependency file. +local dep := $(out)$(SUFF_DEP) +ifndef NO_COMPILE_CMDS_DEPS + _DEPFILES_INCLUDED += $(dep) + $(eval includedep $(dep)) +endif + +# call the tool +local cmds := $(TOOL_$(tool)_DTRACE_HDR_CMDS) +local deps += $(TOOL_$(tool)_DTRACE_DEPEND) $(source) +local orderdeps += $(TOOL_$(tool)_DTRACE_DEPORD) $(dirdep) + +# generate the rule. +$(eval $(def_dtrace_hdr_rule)) + + +# +# Adjust the object files and generate one from the D source, if needed. +# +ifn1of ($(bld_trg), $(TOOL_$(tool)_DTRACE_OBJ_NOT_NEEDED)) + # Figure out all the props. + ifndef TOOL_$(tool)_DTRACE_OBJ_CMDS + $(error kBuild: TOOL_$(tool)_DTRACE_OBJ_CMDS isn't defined! target=$(target) source=$(source) ) + endif + local outbase := $(dtracedir)/$(basename $(notdir $(source))) + local out := $(outbase)-dtrace-object-format.o + local tmp := $(kb-src-prop DTRACE_OBJ_FLAGS,flags,left-to-right,) + local tmp := $(kb-src-prop DEPS,deps,left-to-right,$(defpath)) + local tmp := $(kb-src-prop ORDERDEPS,orderdeps,left-to-right,$(defpath)) + local dirdep := $(call DIRDEP,$(dir $(out))) + + # Adjust paths if we got a default path. + ifneq ($(defpath),) + local source := $(abspathex $(source),$(defpath)) + endif + + # dependency file. + local dep := $(out)$(SUFF_DEP) + ifndef NO_COMPILE_CMDS_DEPS + _DEPFILES_INCLUDED += $(dep) + $(eval includedep $(dep)) + endif + + # call the tool + local cmds := $(TOOL_$(tool)_DTRACE_OBJ_CMDS) + local deps += $(TOOL_$(tool)_DTRACE_DEPEND) $(source) + local orderdeps += $(TOOL_$(tool)_DTRACE_DEPORD) $(dirdep) + + # generate the rule. + $(eval $(def_dtrace_obj_rule)) +endif + +endef # def_src_handler_dtrace + + + +# +# The pre-target hook. +# +define def_unit_dtrace_target_pre + +local dtracedir := $($(target)_0_OUTDIR)/dtrace +$(eval $(target)_INCS += $(dtracedir)) + +endef #def_unit_dtrace_target_pre + diff --git a/kBuild/units/qt3.kmk b/kBuild/units/qt3.kmk index 4dbc1a3..17a4973 100644 --- a/kBuild/units/qt3.kmk +++ b/kBuild/units/qt3.kmk @@ -1,4 +1,4 @@ -# $Id: qt3.kmk 2479 2011-07-20 14:16:19Z bird $ +# $Id: qt3.kmk 2544 2011-09-13 19:00:25Z bird $ ## @file # Qt 3.3.x unit. # @@ -119,13 +119,15 @@ ifndef PATH_SDK_QT3 $(PATH_SDK_QT3)/lib32/qt3-3/lib/libqt-mt$(SUFF_DLL) \ /usr/lib32/libqt-mt$(SUFF_DLL) \ /usr/lib32/qt3/libqt-mt$(SUFF_DLL) \ - /usr/lib32/qt3-3/lib/libqt-mt$(SUFF_DLL) \ + /usr/lib/i386-linux-gnu/libqt-mt$(SUFF_DLL) \ /usr/local/lib32/libqt-mt$(SUFF_DLL) \ /usr/local/lib32/qt3/libqt-mt$(SUFF_DLL) \ /usr/local/lib32/qt3-3/lib/libqt-mt$(SUFF_DLL) \ + /usr/local/lib/i386-linux-gnu/libqt-mt$(SUFF_DLL) \ $(PATH_SDK_QT3)/lib/libqt-mt$(SUFF_DLL) \ $(PATH_SDK_QT3)/lib/qt3/libqt-mt$(SUFF_DLL) \ $(PATH_SDK_QT3)/lib/qt3-3/lib/libqt-mt$(SUFF_DLL) \ + $(PATH_SDK_QT3)/lib/i386-linux-gnu/libqt-mt$(SUFF_DLL) \ ))) ifneq ($(PATH_SDK_QT3_LIB.x86),) export PATH_SDK_QT3_LIB.x86 @@ -143,14 +145,17 @@ ifndef PATH_SDK_QT3 /usr/lib64/qt3-3/lib/libqt-mt$(SUFF_DLL) \ /usr/lib/amd64/libqt-mt$(SUFF_DLL) \ /usr/lib/64/libqt-mt$(SUFF_DLL) \ + /usr/lib/x86_64-linux-gnu/libqt-mt$(SUFF_DLL) \ /usr/local/lib64/libqt-mt$(SUFF_DLL) \ /usr/local/lib64/qt3/libqt-mt$(SUFF_DLL) \ /usr/local/lib64/qt3-3/lib/libqt-mt$(SUFF_DLL) \ /usr/local/lib/amd64/libqt-mt$(SUFF_DLL) \ /usr/local/lib/64/libqt-mt$(SUFF_DLL) \ + /usr/local/lib/x86_64-linux-gnu/libqt-mt$(SUFF_DLL) \ $(PATH_SDK_QT3)/lib/libqt-mt$(SUFF_DLL) \ $(PATH_SDK_QT3)/lib/qt3/libqt-mt$(SUFF_DLL) \ $(PATH_SDK_QT3)/lib/qt3-3/lib/libqt-mt$(SUFF_DLL) \ + $(PATH_SDK_QT3)/lib/x86_64-linux-gnu/libqt-mt$(SUFF_DLL) \ ))) ifneq ($(PATH_SDK_QT3_LIB.amd64),) export PATH_SDK_QT3_LIB.amd64 diff --git a/kBuild/units/qt4.kmk b/kBuild/units/qt4.kmk index 91ab956..c906b97 100644 --- a/kBuild/units/qt4.kmk +++ b/kBuild/units/qt4.kmk @@ -1,4 +1,4 @@ -# $Id: qt4.kmk 2479 2011-07-20 14:16:19Z bird $ +# $Id: qt4.kmk 2544 2011-09-13 19:00:25Z bird $ ## @file # Qt 4 unit. # @@ -116,10 +116,13 @@ ifndef PATH_SDK_QT4 $(PATH_SDK_QT4)/lib32/qt4/libQtCore$(SUFF_DLL) \ /usr/lib32/libQtCore$(SUFF_DLL) \ /usr/lib32/qt4/libQtCore$(SUFF_DLL) \ + /usr/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \ /usr/local/lib32/libQtCore$(SUFF_DLL) \ /usr/local/lib32/qt4/libQtCore$(SUFF_DLL) \ + /usr/local/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \ $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \ $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \ + $(PATH_SDK_QT4)/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \ ))) ifneq ($(PATH_SDK_QT4_LIB.x86),) export PATH_SDK_QT4_LIB.x86 @@ -133,11 +136,14 @@ ifndef PATH_SDK_QT4 /usr/lib64/libQtCore$(SUFF_DLL) \ /usr/lib64/qt4/libQtCore$(SUFF_DLL) \ /usr/lib/amd64/libQtCore$(SUFF_DLL) \ + /usr/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \ /usr/local/lib64/libQtCore$(SUFF_DLL) \ /usr/local/lib64/qt4/libQtCore$(SUFF_DLL) \ /usr/local/lib/amd64/libQtCore$(SUFF_DLL) \ + /usr/local/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \ $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \ $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \ + $(PATH_SDK_QT4)/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \ ))) ifneq ($(PATH_SDK_QT4_LIB.amd64),) export PATH_SDK_QT4_LIB.amd64 diff --git a/src/kObjCache/kObjCache.c b/src/kObjCache/kObjCache.c index 3cec87c..0713b1a 100644 --- a/src/kObjCache/kObjCache.c +++ b/src/kObjCache/kObjCache.c @@ -1,4 +1,4 @@ -/* $Id: kObjCache.c 2463 2011-07-08 11:54:37Z bird $ */ +/* $Id: kObjCache.c 2568 2012-03-18 17:59:32Z bird $ */ /** @file * kObjCache - Object Cache. */ @@ -73,6 +73,9 @@ # include <Windows.h> # include "quoted_spawn.h" #endif +#if defined(__HAIKU__) +# include <posix/sys/file.h> +#endif #include "crc32.h" #include "md5.h" @@ -659,7 +662,10 @@ static int MakePath(const char *pszPath) && errno != EEXIST) #else if ( mkdir(pszAbsPath, 0777) - && errno != EEXIST) + && errno != EEXIST + && errno != ENOSYS /* Solaris nonsensical mkdir crap. */ + && errno != EACCES /* Solaris nonsensical mkdir crap. */ + ) #endif { iErr = errno; @@ -3984,7 +3990,7 @@ int main(int argc, char **argv) } else if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) { - printf("kObjCache - kBuild version %d.%d.%d ($Revision: 2463 $)\n" + printf("kObjCache - kBuild version %d.%d.%d ($Revision: 2568 $)\n" "Copyright (c) 2007-2011 knut st. osmundsen\n", KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, KBUILD_VERSION_PATCH); return 0; diff --git a/src/kash/Makefile.kmk b/src/kash/Makefile.kmk index 6fc7ad2..6dd8028 100644 --- a/src/kash/Makefile.kmk +++ b/src/kash/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 2498 2011-07-22 12:05:57Z bird $ +# $Id: Makefile.kmk 2546 2011-10-01 19:49:54Z bird $ ## @file # Sub-makefile for kash. # @@ -36,6 +36,7 @@ kash_ASTOOL = YASM kash_DEFS = lint SHELL SMALL kash_DEFS += SH_FORKED_MODE kash_DEFS.debug = DEBUG=2 +kash_DEFS.haiku = BSD kash_DEFS.linux = BSD kash_DEFS.solaris = BSD ## @todo bring over PC_SLASHES? @@ -96,17 +97,20 @@ kash_SOURCES = \ shheap.c \ shthread.c \ shfile.c +kash_SOURCES.haiku = \ + sys_signame.c \ + strlcpy.c kash_SOURCES.linux = \ sys_signame.c \ strlcpy.c +kash_SOURCES.solaris = \ + sys_signame.c \ + strlcpy.c kash_SOURCES.win = \ sys_signame.c \ strlcpy.c \ shfork-win.c \ shforkA-win.asm -kash_SOURCES.solaris = \ - sys_signame.c \ - strlcpy.c kash_INTERMEDIATES = \ $(kash_0_OUTDIR)/builtins.h \ diff --git a/src/kash/error.h b/src/kash/error.h index 7a544a1..6388a75 100644 --- a/src/kash/error.h +++ b/src/kash/error.h @@ -59,7 +59,11 @@ * inner scope, and restore handler on exit from the scope. */ -#include <setjmp.h> +#ifndef __HAIKU__ +# include <setjmp.h> +#else +# include <posix/setjmp.h> /** @todo silly */ +#endif struct jmploc { jmp_buf loc; @@ -120,7 +124,8 @@ SH_NORETURN_1 void sh_exit(struct shinstance *, int) SH_NORETURN_2; * so we use _setjmp instead. */ -#if defined(BSD) && !defined(__SVR4) && !defined(__GLIBC__) && !defined(__KLIBC__) && !defined(_MSC_VER) +#if defined(BSD) && !defined(__SVR4) && !defined(__GLIBC__) \ + && !defined(__KLIBC__) && !defined(_MSC_VER) && !defined(__HAIKU__) #define setjmp(jmploc) _setjmp(jmploc) #define longjmp(jmploc, val) _longjmp(jmploc, val) #endif diff --git a/src/kash/shfile.c b/src/kash/shfile.c index 89f3a64..0d1cbae 100644 --- a/src/kash/shfile.c +++ b/src/kash/shfile.c @@ -1,4 +1,4 @@ -/* $Id: shfile.c 2425 2010-10-18 08:52:22Z bird $ */ +/* $Id: shfile.c 2553 2011-11-25 21:44:21Z bird $ */ /** @file * * File management. @@ -790,8 +790,10 @@ void shfile_fork_win(shfdtab *pfdtab, int set, intptr_t *hndls) i, hFile, pfdtab->tab[i].oflags, pfdtab->tab[i].shflags)); if (!SetHandleInformation(hFile, HANDLE_FLAG_INHERIT, fFlag)) { +#if 0 /* Seems to happen for console handles, ignore it. */ DWORD err = GetLastError(); assert(0); +#endif } } } @@ -864,8 +866,10 @@ void *shfile_exec_win(shfdtab *pfdtab, int prepare, unsigned short *sizep, intpt if (!SetHandleInformation(hFile, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) { +#if 0 /* Seems to fail for console handles, ignore. */ DWORD err = GetLastError(); assert(0); +#endif } paf[i] = FOPEN; if (pfdtab->tab[i].oflags & _O_APPEND) diff --git a/src/kash/shfile.h b/src/kash/shfile.h index 2118017..f968b27 100644 --- a/src/kash/shfile.h +++ b/src/kash/shfile.h @@ -1,8 +1,9 @@ -/* $Id: shfile.h 2498 2011-07-22 12:05:57Z bird $ */ +/* $Id: shfile.h 2546 2011-10-01 19:49:54Z bird $ */ /** @file - * * File management. - * + */ + +/* * Copyright (c) 2007-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net> * * @@ -46,7 +47,7 @@ # endif #endif #ifndef _MSC_VER -# include <sys/fcntl.h> +# include <fcntl.h> # include <unistd.h> # ifndef O_BINARY # define O_BINARY 0 diff --git a/src/kash/shinstance.c b/src/kash/shinstance.c index 0eb052e..1eeb0db 100644 --- a/src/kash/shinstance.c +++ b/src/kash/shinstance.c @@ -1,4 +1,4 @@ -/* $Id: shinstance.c 2423 2010-10-17 23:43:35Z bird $ */ +/* $Id: shinstance.c 2546 2011-10-01 19:49:54Z bird $ */ /** @file * The shell instance methods. */ @@ -889,7 +889,6 @@ int sh_add_child(shinstance *psh, pid_t pid, void *hChild) (void)hChild; return 0; } -#include <setjmp.h> pid_t sh_fork(shinstance *psh) { diff --git a/src/kash/shinstance.h b/src/kash/shinstance.h index 7aa0ac6..11dac28 100644 --- a/src/kash/shinstance.h +++ b/src/kash/shinstance.h @@ -1,4 +1,4 @@ -/* $Id: shinstance.h 2498 2011-07-22 12:05:57Z bird $ */ +/* $Id: shinstance.h 2546 2011-10-01 19:49:54Z bird $ */ /** @file * The shell instance and it's methods. */ @@ -444,6 +444,9 @@ int sh_add_child(shinstance *psh, pid_t pid, void *hChild); # define W_STOPCODE(sig) ((sig) << 8 | _WSTOPPED) #else # include <sys/wait.h> +# ifdef __HAIKU__ +# define WCOREDUMP(x) (0) /** @todo check the haiku headers and see if this information is available or not... */ +# endif #endif pid_t sh_fork(shinstance *); pid_t sh_waitpid(shinstance *, pid_t, int *, int); diff --git a/src/kash/shtypes.h b/src/kash/shtypes.h index 0957dc1..f010a28 100644 --- a/src/kash/shtypes.h +++ b/src/kash/shtypes.h @@ -1,8 +1,9 @@ -/* $Id: shtypes.h 2413 2010-09-11 17:43:04Z bird $ */ +/* $Id: shtypes.h 2546 2011-10-01 19:49:54Z bird $ */ /** @file - * * Wrapper for missing types and such. - * + */ + +/* * Copyright (c) 2007-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net> * * @@ -31,7 +32,9 @@ #include <sys/types.h> #include <stdlib.h> -#ifndef _MSC_VER +#ifdef __HAIKU__ +# include <posix/signal.h> /* silly */ +#elif !defined(_MSC_VER) # include <sys/signal.h> #endif diff --git a/src/kash/var.c b/src/kash/var.c index 250047b..cf73e8d 100644 --- a/src/kash/var.c +++ b/src/kash/var.c @@ -68,6 +68,12 @@ extern APIRET #endif +#if defined(_MSC_VER) || defined(_WIN32) + /* On Windows the PATH variable is called "Path". */ +# define PC_MIXED_PATH_VAR_NAME +#endif + + /* * Shell variables. @@ -150,10 +156,6 @@ const struct varinit varinit[] = { NULL }, { offsetof(shinstance, vpath), VSTRFIXED|VTEXTFIXED, "PATH=" _PATH_DEFPATH, changepath }, -#ifdef _MSC_VER - { offsetof(shinstance, vpath2), VSTRFIXED|VTEXTFIXED, "Path=", - changepath }, -#endif /* * vps1 depends on uid */ @@ -397,6 +399,20 @@ setvareq(shinstance *psh, char *s, int flags) /* not found */ if (flags & VNOSET) return; + +#ifdef PC_MIXED_PATH_VAR_NAME + if ( nlen == 4 + && (s[0] == 'p' || s[0] == 'P') + && (s[1] == 'a' || s[1] == 'A') + && (s[2] == 't' || s[2] == 'T') + && (s[3] == 'h' || s[3] == 'H') ) { + s[0] = 'P'; + s[1] = 'A'; + s[2] = 'T'; + s[3] = 'H'; + } +#endif + vp = ckmalloc(psh, sizeof (*vp)); vp->flags = flags & ~VNOFUNC; vp->text = s; @@ -911,6 +927,22 @@ find_var(shinstance *psh, const char *name, struct var ***vppp, int *lenp) hashval = 2 * hashval + (unsigned char)*p++; len = (int)(p - name); +#ifdef PC_MIXED_PATH_VAR_NAME + /* On Windows the PATH variable is called "Path". */ + if ( len == 4 + && (name[0] == 'p' || name[0] == 'P') + && (name[1] == 'a' || name[1] == 'A') + && (name[2] == 't' || name[2] == 'T') + && (name[3] == 'h' || name[3] == 'H') ) + { + name = "PATH"; + hashval = (unsigned char)'P'; + hashval = hashval * 2 + (unsigned char)'A'; + hashval = hashval * 2 + (unsigned char)'T'; + hashval = hashval * 2 + (unsigned char)'H'; + } +#endif + if (lenp) *lenp = len; vpp = &psh->vartab[hashval % VTABSIZE]; diff --git a/src/kmk/Makefile.am b/src/kmk/Makefile.am index 45e788d..a1cd887 100644 --- a/src/kmk/Makefile.am +++ b/src/kmk/Makefile.am @@ -52,6 +52,7 @@ kmk_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \ strcache2.c \ alloccache.c \ kbuild.c \ + kbuild-read.c \ electric.c \ ../lib/md5.c \ ../lib/kDep.c \ diff --git a/src/kmk/Makefile.kmk b/src/kmk/Makefile.kmk index fe2cd43..b00de69 100644 --- a/src/kmk/Makefile.kmk +++ b/src/kmk/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 2532 2011-08-02 13:05:37Z bird $ +# $Id: Makefile.kmk 2548 2011-11-08 21:28:16Z bird $ ## @file # Sub-makefile for kmk / GNU Make. # @@ -57,6 +57,7 @@ TEMPLATE_BIN-KMK_INCS = $(kmk_0_OUTDIR) . $(TEMPLATE_BIN-THREADED_INCS) TEMPLATE_BIN-KMK_INCS.darwin = glob TEMPLATE_BIN-KMK_INCS.dragonfly = glob TEMPLATE_BIN-KMK_INCS.freebsd = glob +TEMPLATE_BIN-KMK_INCS.haiku = glob TEMPLATE_BIN-KMK_INCS.openbsd = glob TEMPLATE_BIN-KMK_INCS.solaris = glob TEMPLATE_BIN-KMK_LIBS = $(TEMPLATE_BIN-THREADED_LIBS) $(kmkmissing_1_TARGET) $(LIB_KUTIL) @@ -101,6 +102,11 @@ kmkmissing_SOURCES.freebsd = \ glob/glob.c \ glob/fnmatch.c +kmkmissing_SOURCES.haiku = \ + kmkbuiltin/haikufakes.c \ + glob/glob.c \ + glob/fnmatch.c + kmkmissing_SOURCES.linux += \ kmkbuiltin/strlcpy.c @@ -198,6 +204,7 @@ kmk_DEFS.debug = CONFIG_WITH_MAKE_STATS kmk_SOURCES = \ main.c \ kbuild.c \ + kbuild-read.c \ read.c \ expreval.c \ incdep.c \ diff --git a/src/kmk/arscan.c b/src/kmk/arscan.c index 5e94000..eb3b500 100644 --- a/src/kmk/arscan.c +++ b/src/kmk/arscan.c @@ -231,7 +231,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg) #endif #ifndef WINDOWS32 -# ifndef __BEOS__ +# if !defined(__BEOS__) && !defined(__HAIKU__) # include <ar.h> # else /* BeOS 5 doesn't have <ar.h> but has archives in the same format diff --git a/src/kmk/config.h.haiku b/src/kmk/config.h.haiku new file mode 100644 index 0000000..4ea9ae8 --- /dev/null +++ b/src/kmk/config.h.haiku @@ -0,0 +1,438 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +/* #undef CLOSEDIR_VOID */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if using `getloadavg.c'. */ +#define C_GETLOADAVG 1 + +/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */ +/* #undef DGUX */ + +/* Use high resolution file timestamps if nonzero. */ +#define FILE_TIMESTAMP_HI_RES 1 + +/* Define to 1 if the `getloadavg' function needs to be run setuid or setgid. + */ +/* #undef GETLOADAVG_PRIVILEGED */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if your compiler conforms to the ANSI C standard. */ +#define HAVE_ANSI_COMPILER 1 + +/* Define to 1 if you have the `atexit' function. */ +#define HAVE_ATEXIT 1 + +/* Define to 1 if you have the `bsd_signal' function. */ +/* #undef HAVE_BSD_SIGNAL */ + +/* Use case insensitive file names */ +/* #undef HAVE_CASE_INSENSITIVE_FS */ + +/* Define to 1 if you have the clock_gettime function. */ +/* #undef HAVE_CLOCK_GETTIME */ + +/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you + don't. */ +#define HAVE_DECL_SYS_SIGLIST 1 + +/* Define to 1 if you have the declaration of `_sys_siglist', and to 0 if you + don't. */ +#define HAVE_DECL__SYS_SIGLIST 0 + +/* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you + don't. */ +#define HAVE_DECL___SYS_SIGLIST 0 + +/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Use platform specific coding */ +/* #undef HAVE_DOS_PATHS */ + +/* Define to 1 if you have the `dup2' function. */ +#define HAVE_DUP2 1 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fdopen' function. */ +#define HAVE_FDOPEN 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getgroups' function. */ +#define HAVE_GETGROUPS 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +/* #undef HAVE_GETHOSTBYNAME */ + +/* Define to 1 if you have the `gethostname' function. */ +/* #undef HAVE_GETHOSTNAME */ + +/* Define to 1 if you have the `getloadavg' function. */ +/* #undef HAVE_GETLOADAVG */ + +/* Define to 1 if you have the `getrlimit' function. */ +#define HAVE_GETRLIMIT 1 + +/* Define to 1 if you have a standard gettimeofday function */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `dgc' library (-ldgc). */ +/* #undef HAVE_LIBDGC */ + +/* Define to 1 if you have the `kstat' library (-lkstat). */ +/* #undef HAVE_LIBKSTAT */ + +/* Define to 1 if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the <locale.h> header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if you have the <mach/mach.h> header file. */ +/* #undef HAVE_MACH_MACH_H */ + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkstemp' function. */ +#define HAVE_MKSTEMP 1 + +/* Define to 1 if you have the `mktemp' function. */ +#define HAVE_MKTEMP 1 + +/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the <nlist.h> header file. */ +/* #undef HAVE_NLIST_H */ + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* Define to 1 if you have the `pstat_getdynamic' function. */ +/* #undef HAVE_PSTAT_GETDYNAMIC */ + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define to 1 if <signal.h> defines the SA_RESTART constant. */ +#define HAVE_SA_RESTART 1 + +/* Define to 1 if you have the `setegid' function. */ +#define HAVE_SETEGID 1 + +/* Define to 1 if you have the `seteuid' function. */ +#define HAVE_SETEUID 1 + +/* Define to 1 if you have the `setlinebuf' function. */ +#define HAVE_SETLINEBUF 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setregid' function. */ +#define HAVE_SETREGID 1 + +/* Define to 1 if you have the `setreuid' function. */ +#define HAVE_SETREUID 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the `setvbuf' function. */ +#define HAVE_SETVBUF 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the `sigsetmask' function. */ +/* #undef HAVE_SIGSETMASK */ + +/* Define to 1 if you have the `socket' function. */ +/* #undef HAVE_SOCKET */ + +/* Define to 1 if you have the <stdarg.h> header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcmpi' function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the `strcoll' function and it is properly defined. + */ +#define HAVE_STRCOLL 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strsignal' function. */ +#define HAVE_STRSIGNAL 1 + +/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ +/* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */ + +/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/timeb.h> header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <sys/wait.h> header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the \`union wait' type in <sys/wait.h>. */ +/* #undef HAVE_UNION_WAIT */ + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the <varargs.h> header file. */ +/* #undef HAVE_VARARGS_H */ + +/* Define to 1 if you have the `vfork' function. */ +#define HAVE_VFORK 1 + +/* Define to 1 if you have the <vfork.h> header file. */ +/* #undef HAVE_VFORK_H */ + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the `wait3' function. */ +/* #undef HAVE_WAIT3 */ + +/* Define to 1 if you have the `waitpid' function. */ +#define HAVE_WAITPID 1 + +/* Define to 1 if `fork' works. */ +#define HAVE_WORKING_FORK 1 + +/* Define to 1 if `vfork' works. */ +#define HAVE_WORKING_VFORK 1 + +/* Build host information. (not used by kmk) */ +#define MAKE_HOST "i586-pc-haiku" + +/* Define to 1 to enable job server support in GNU make. */ +#define MAKE_JOBSERVER 1 + +/* Define to 1 to enable symbolic link timestamp checking. */ +#define MAKE_SYMLINKS 1 + +/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend + on `HAVE_STRUCT_NLIST_N_UN_N_NAME */ +/* #undef NLIST_NAME_UNION */ + +/* Define to 1 if struct nlist.n_name is a pointer rather than an array. */ +/* #undef NLIST_STRUCT */ + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "make" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "bug-make@gnu.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "GNU make" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "GNU make 3.81.90" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "make" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "http://www.gnu.org/software/make/" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.81.90" + +/* Define to the character that separates directories in PATH. */ +#define PATH_SEPARATOR_CHAR ':' + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to the name of the SCCS 'get' command. */ +#define SCCS_GET "get" + +/* Define to 1 if the SCCS 'get' command understands the '-G<file>' option. */ +/* #undef SCCS_GET_MINUS_G */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if struct stat contains a nanoseconds field */ +#define ST_MTIM_NSEC tv_nsec + +/* Define to 1 on System V Release 4. */ +/* #undef SVR4 */ + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 for Encore UMAX. */ +/* #undef UMAX */ + +/* Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of + <sys/cpustats.h>. */ +/* #undef UMAX4_3 */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "3.81.90" + +/* Use platform specific coding */ +/* #undef WINDOWS32 */ + +/* Define if using the dmalloc debugging malloc package */ +/* #undef WITH_DMALLOC */ + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef gid_t */ + +/* Define to `int' if <sys/types.h> does not define. */ +/* #undef pid_t */ + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +/* #undef size_t */ + +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef uid_t */ + +/* Define uintmax_t if not defined in <stdint.h> or <inttypes.h>. */ +/* #undef uintmax_t */ + +/* Define as `fork' if `vfork' does not work. */ +/* #undef vfork */ + +#include "inlined_memchr.h" diff --git a/src/kmk/expand.c b/src/kmk/expand.c index 554624a..d4912dd 100644 --- a/src/kmk/expand.c +++ b/src/kmk/expand.c @@ -1108,7 +1108,7 @@ allocated_variable_expand_for_file (const char *line, struct file *file) #ifdef CONFIG_WITH_VALUE_LENGTH /* Handle the most common case in allocated_variable_expand_for_file - specially and provide some additional string lenght features. */ + specially and provide some additional string length features. */ char * allocated_variable_expand_2 (const char *line, unsigned int length, diff --git a/src/kmk/expreval.c b/src/kmk/expreval.c index 0e7f6b7..4d9cb5f 100644 --- a/src/kmk/expreval.c +++ b/src/kmk/expreval.c @@ -1,5 +1,5 @@ #ifdef CONFIG_WITH_IF_CONDITIONALS -/* $Id: expreval.c 2413 2010-09-11 17:43:04Z bird $ */ +/* $Id: expreval.c 2573 2012-05-13 19:39:47Z bird $ */ /** @file * expreval - Expressions evaluator, C / BSD make / nmake style. */ @@ -1979,14 +1979,14 @@ static EXPRRET expr_eval(PEXPR pThis) */ do rc = expr_get_unary_or_operand(pThis); while (rc == kExprRet_Operator); - if (rc < kExprRet_Error) + if (rc < kExprRet_Ok) break; /* * Look for a binary operator, right parenthesis or end of expression. */ rc = expr_get_binary_or_eoe_or_rparen(pThis); - if (rc < kExprRet_Error) + if (rc < kExprRet_Ok) break; expr_unget_op(pThis); @@ -2002,10 +2002,10 @@ static EXPRRET expr_eval(PEXPR pThis) pOp = pThis->apOps[pThis->iOp--]; assert(pThis->iVar + 1 >= pOp->cArgs); rc = pOp->pfn(pThis); - if (rc < kExprRet_Error) + if (rc < kExprRet_Ok) break; } - if (rc < kExprRet_Error) + if (rc < kExprRet_Ok) break; /* @@ -2013,7 +2013,7 @@ static EXPRRET expr_eval(PEXPR pThis) * There should be no right parenthesis here. */ rc = expr_get_binary_or_eoe_or_rparen(pThis); - if (rc < kExprRet_Error) + if (rc < kExprRet_Ok) break; pOp = pThis->apOps[pThis->iOp]; if (!pOp->iPrecedence) diff --git a/src/kmk/function.c b/src/kmk/function.c index 7fe5f4c..0cb5c2c 100644 --- a/src/kmk/function.c +++ b/src/kmk/function.c @@ -77,6 +77,12 @@ static math_int math_int_from_string (const char *str); extern APIRET APIENTRY DosQueryHeaderInfo(HMODULE hmod, ULONG ulIndex, PVOID pvBuffer, ULONG cbBuffer, ULONG ulSubFunction); #endif /* CONFIG_WITH_OS2_LIBPATH */ +#ifdef KMK +/** Checks if the @a_cch characters (bytes) in @a a_psz equals @a a_szConst. */ +# define STR_N_EQUALS(a_psz, a_cch, a_szConst) \ + ( (a_cch) == sizeof (a_szConst) - 1 && !strncmp ((a_psz), (a_szConst), sizeof (a_szConst) - 1) ) +#endif + struct function_table_entry { @@ -5220,8 +5226,8 @@ func_commands (char *o, char **argv, const char *funcname) return o; } #endif /* CONFIG_WITH_COMMANDS_FUNC */ - #ifdef KMK + /* Useful when debugging kmk and/or makefiles. */ char * func_breakpoint (char *o, char **argv UNUSED, const char *funcname UNUSED) @@ -5230,13 +5236,127 @@ func_breakpoint (char *o, char **argv UNUSED, const char *funcname UNUSED) __debugbreak(); #elif defined(__i386__) || defined(__x86__) || defined(__X86__) || defined(_M_IX86) || defined(__i386) \ || defined(__amd64__) || defined(__x86_64__) || defined(__AMD64__) || defined(_M_X64) || defined(__amd64) +# ifdef __sun__ + __asm__ __volatile__ ("int $3\n\t"); +# else __asm__ __volatile__ ("int3\n\t"); +# endif #else char *p = (char *)0; *p = '\0'; #endif return o; } + +/* umask | umask -S. */ +char * +func_get_umask (char *o, char **argv UNUSED, const char *funcname UNUSED) +{ + char sz[80]; + int off; + mode_t u; + int symbolic = 0; + const char *psz = argv[0]; + + if (psz) + { + const char *pszEnd = strchr (psz, '\0'); + strip_whitespace (&psz, &pszEnd); + + if (pszEnd != psz) + { + if ( STR_N_EQUALS (psz, pszEnd - pszEnd, "S") + || STR_N_EQUALS (psz, pszEnd - pszEnd, "-S") + || STR_N_EQUALS (psz, pszEnd - pszEnd, "symbolic") ) + symbolic = 1; + else + error (reading_file, _("$(%s ) invalid argument `%s'"), + funcname, argv[0]); + } + } + + u = umask (002); + umask (u); + + if (symbolic) + { + off = 0; + sz[off++] = 'u'; + sz[off++] = '='; + if ((u & S_IRUSR) == 0) + sz[off++] = 'r'; + if ((u & S_IWUSR) == 0) + sz[off++] = 'w'; + if ((u & S_IXUSR) == 0) + sz[off++] = 'x'; + sz[off++] = ','; + sz[off++] = 'g'; + sz[off++] = '='; + if ((u & S_IRGRP) == 0) + sz[off++] = 'r'; + if ((u & S_IWGRP) == 0) + sz[off++] = 'w'; + if ((u & S_IXGRP) == 0) + sz[off++] = 'x'; + sz[off++] = ','; + sz[off++] = 'o'; + sz[off++] = '='; + if ((u & S_IROTH) == 0) + sz[off++] = 'r'; + if ((u & S_IWOTH) == 0) + sz[off++] = 'w'; + if ((u & S_IXOTH) == 0) + sz[off++] = 'x'; + } + else + off = sprintf (sz, "%.4o", u); + + return variable_buffer_output (o, sz, off); +} + + +/* umask 0002 | umask u=rwx,g=rwx,o=rx. */ +char * +func_set_umask (char *o, char **argv UNUSED, const char *funcname UNUSED) +{ + mode_t u; + const char *psz; + + /* Figure what kind of input this is. */ + psz = argv[0]; + while (isblank ((unsigned char)*psz)) + psz++; + + if (isdigit ((unsigned char)*psz)) + { + u = 0; + while (*psz) + { + u <<= 3; + if (*psz < '0' || *psz >= '8') + { + error (reading_file, _("$(%s ) illegal number `%s'"), funcname, argv[0]); + break; + } + u += *psz - '0'; + psz++; + } + + if (argv[1] != NULL) + error (reading_file, _("$(%s ) too many arguments for octal mode"), funcname); + } + else + { + u = umask(0); + umask(u); + error (reading_file, _("$(%s ) symbol mode is not implemented"), funcname); + } + + umask(u); + + return o; +} + #endif /* KMK */ @@ -5426,6 +5546,8 @@ static struct function_table_entry function_table_init[] = #endif #ifdef KMK { STRING_SIZE_TUPLE("breakpoint"), 0, 0, 0, func_breakpoint}, + { STRING_SIZE_TUPLE("set-umask"), 1, 3, 1, func_set_umask}, + { STRING_SIZE_TUPLE("get-umask"), 0, 0, 0, func_get_umask}, #endif }; diff --git a/src/kmk/incdep.c b/src/kmk/incdep.c index 140e0f8..4ea55eb 100644 --- a/src/kmk/incdep.c +++ b/src/kmk/incdep.c @@ -1,5 +1,5 @@ #ifdef CONFIG_WITH_INCLUDEDEP -/* $Id: incdep.c 2413 2010-09-11 17:43:04Z bird $ */ +/* $Id: incdep.c 2546 2011-10-01 19:49:54Z bird $ */ /** @file * incdep - Simple dependency files. */ @@ -635,7 +635,8 @@ incdep_are_threads_enabled (void) #elif defined(__APPLE__) \ || defined(__sun__) || defined(__SunOS__) || defined(__sun) || defined(__SunOS) \ - || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) + || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) \ + || defined(__HAIKU__) /* No broken preload libraries known to be in common use on these platforms... */ #elif defined(_MSC_VER) || defined(_WIN32) || defined(__OS2__) diff --git a/src/kmk/job.c b/src/kmk/job.c index a2c55ff..2cb7468 100644 --- a/src/kmk/job.c +++ b/src/kmk/job.c @@ -591,7 +591,7 @@ reap_children (int block, int err) pid = WAIT_NOHANG (&status); else #endif - pid = wait (&status); + EINTRLOOP(pid, wait (&status)); #endif /* !VMS */ } else @@ -2053,7 +2053,7 @@ job_next_command (struct child *child) static int load_too_high (void) { -#if defined(__MSDOS__) || defined(VMS) || defined(_AMIGA) || defined(__riscos__) +#if defined(__MSDOS__) || defined(VMS) || defined(_AMIGA) || defined(__riscos__) || defined(__HAIKU__) return 1; #else static double last_sec; diff --git a/src/kmk/kbuild-read.c b/src/kmk/kbuild-read.c new file mode 100644 index 0000000..a8fd424 --- /dev/null +++ b/src/kmk/kbuild-read.c @@ -0,0 +1,511 @@ +/* $Id: kbuild-read.c 2549 2011-11-09 01:22:04Z bird $ */ +/** @file + * kBuild specific make functionality related to read.c. + */ + +/* + * Copyright (c) 2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net> + * + * This file is part of kBuild. + * + * kBuild is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * kBuild is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with kBuild. If not, see <http://www.gnu.org/licenses/> + * + */ + +/* No GNU coding style here! */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#include "make.h" +#include "filedef.h" +#include "variable.h" +#include "dep.h" +#include "debug.h" +#include "kbuild.h" + +#include <assert.h> + + +/******************************************************************************* +* Defined Constants And Macros * +*******************************************************************************/ +#define WORD_IS(a_pszWord, a_cchWord, a_szWord2) \ + ( (a_cchWord) == sizeof(a_szWord2) - 1 && memcmp((a_pszWord), a_szWord2, sizeof(a_szWord2) - 1) == 0) + + +/******************************************************************************* +* Structures and Typedefs * +*******************************************************************************/ +/** Indicate which kind of kBuild define we're working on. */ +enum kBuildDef +{ + kBuildDef_Invalid, + kBuildDef_Target, + kBuildDef_Template, + kBuildDef_Tool, + kBuildDef_Sdk, + kBuildDef_Unit +}; + +enum kBuildExtendBy +{ + kBuildExtendBy_NoParent, + kBuildExtendBy_Overriding, + kBuildExtendBy_Appending, + kBuildExtendBy_Prepending +}; + + +/** + * The data we stack during eval. + */ +struct kbuild_eval_data +{ + /** The kind of define. */ + enum kBuildDef enmKind; + /** The bare name of the define. */ + char *pszName; + /** The file location where this define was declared. */ + struct floc FileLoc; + + /** Pointer to the next element in the global list. */ + struct kbuild_eval_data *pGlobalNext; + /** Pointer to the element below us on the stack. */ + struct kbuild_eval_data *pStackDown; + + /** The variable set associated with this define. */ + struct variable_set_list *pVariables; + /** The saved current variable set, for restoring in kBuild-endef. */ + struct variable_set_list *pVariablesSaved; + + /** The parent name, NULL if none. */ + char *pszParent; + /** The inheritance method. */ + enum kBuildExtendBy enmExtendBy; + /** Pointer to the parent. Resolved lazily, so it can be NULL even if we have + * a parent. */ + struct kbuild_eval_data *pParent; + + /** The template, NULL if none. Only applicable to targets. */ + char *pszTemplate; + /** Pointer to the template. Resolved lazily, so it can be NULL even if we have + * a parent. */ + struct kbuild_eval_data *pTemplate; + + /** The variable prefix. */ + char *pszVarPrefix; + /** The length of the variable prefix. */ + size_t cchVarPrefix; +}; + + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +/** Linked list (LIFO) of kBuild defines. + * @todo use a hash! */ +struct kbuild_eval_data *g_pHeadKbDefs = NULL; +/** Stack of kBuild defines. */ +struct kbuild_eval_data *g_pTopKbDef = NULL; + + +struct variable_set * +get_top_kbuild_variable_set(void) +{ + struct kbuild_eval_data *pTop = g_pTopKbDef; + assert(pTop != NULL); + return pTop->pVariables->set; +} + + +char * +kbuild_prefix_variable(const char *pszName, unsigned int *pcchName) +{ + struct kbuild_eval_data *pTop = g_pTopKbDef; + char *pszPrefixed; + unsigned int cchPrefixed; + + assert(pTop != NULL); + + cchPrefixed = pTop->cchVarPrefix + *pcchName; + pszPrefixed = xmalloc(cchPrefixed + 1); + memcpy(pszPrefixed, pTop->pszVarPrefix, pTop->cchVarPrefix); + memcpy(&pszPrefixed[pTop->cchVarPrefix], pszName, *pcchName); + pszPrefixed[cchPrefixed] = '\0'; + *pcchName = cchPrefixed; + return pszPrefixed; +} + + +static const char * +eval_kbuild_kind_to_string(enum kBuildDef enmKind) +{ + switch (enmKind) + { + case kBuildDef_Target: return "target"; + case kBuildDef_Template: return "template"; + case kBuildDef_Tool: return "tool"; + case kBuildDef_Sdk: return "sdk"; + case kBuildDef_Unit: return "unit"; + default: + case kBuildDef_Invalid: return "invalid"; + } +} + +static char * +allocate_expanded_next_token(const char **ppszCursor, const char *pszEos, unsigned int *pcchToken, int fStrip) +{ + unsigned int cchToken; + char *pszToken = find_next_token_eos(ppszCursor, pszEos, &cchToken); + if (pszToken) + { + pszToken = allocated_variable_expand_2(pszToken, cchToken, &cchToken); + if (pszToken) + { + if (fStrip) + { + unsigned int off = 0; + while (MY_IS_BLANK(pszToken[off])) + off++; + if (off) + { + cchToken -= off; + memmove(pszToken, &pszToken[off], cchToken + 1); + } + + while (cchToken > 0 && MY_IS_BLANK(pszToken[cchToken - 1])) + pszToken[--cchToken] = '\0'; + } + + assert(cchToken == strlen(pszToken)); + if (pcchToken) + *pcchToken = cchToken; + } + } + return pszToken; +} + +static struct kbuild_eval_data * +eval_kbuild_resolve_parent(struct kbuild_eval_data *pData) +{ + if ( !pData->pParent + && pData->pszParent) + { + struct kbuild_eval_data *pCur = g_pHeadKbDefs; + while (pCur) + { + if ( pCur->enmKind == pData->enmKind + && !strcmp(pCur->pszName, pData->pszParent)) + { + if ( pCur->pszParent + && ( pCur->pParent == pData + || !strcmp(pCur->pszParent, pData->pszName)) ) + fatal(&pData->FileLoc, _("'%s' and '%s' are both trying to be each other children..."), + pData->pszName, pCur->pszName); + + pData->pParent = pCur; + pData->pVariables->next = pData->pVariables; + break; + } + pCur = pCur->pGlobalNext; + } + } + return pData->pParent; +} + +static int +eval_kbuild_define_xxxx(struct kbuild_eval_data **ppData, const struct floc *pFileLoc, + const char *pszLine, const char *pszEos, int fIgnoring, enum kBuildDef enmKind) +{ + unsigned int cch; + unsigned int cchName; + char ch; + char *psz; + const char *pszPrefix; + struct kbuild_eval_data *pData; + + if (fIgnoring) + return 0; + + /* + * Create a new kBuild eval data item. + */ + pData = xmalloc(sizeof(*pData)); + pData->enmKind = enmKind; + pData->pszName = NULL; + pData->FileLoc = *pFileLoc; + + pData->pGlobalNext = g_pHeadKbDefs; + g_pHeadKbDefs = pData; + + pData->pStackDown = *ppData; + *ppData = g_pTopKbDef = pData; + pData->pVariables = create_new_variable_set(); + pData->pVariablesSaved = NULL; + + pData->pszParent = NULL; + pData->enmExtendBy = kBuildExtendBy_NoParent; + pData->pParent = NULL; + + pData->pszTemplate = NULL; + pData->pTemplate = NULL; + + pData->pszVarPrefix = NULL; + pData->cchVarPrefix = 0; + + /* + * The first word is the name. + */ + pData->pszName = allocate_expanded_next_token(&pszLine, pszEos, &cchName, 1 /*strip*/); + if (!pData->pszName || !*pData->pszName) + fatal(pFileLoc, _("The kBuild define requires a name")); + + psz = pData->pszName; + while ((ch = *psz++) != '\0') + if (!isgraph(ch)) + { + error(pFileLoc, _("The 'kBuild-define-%s' name '%s' contains one or more invalid characters"), + eval_kbuild_kind_to_string(enmKind), pData->pszName); + break; + } + + /* + * Parse subsequent words. + */ + psz = find_next_token_eos(&pszLine, pszEos, &cch); + while (psz) + { + if (WORD_IS(psz, cch, "extending")) + { + /* Inheritance directive. */ + if (pData->pszParent != NULL) + fatal(pFileLoc, _("'extending' can only occure once")); + pData->pszParent = allocate_expanded_next_token(&pszLine, pszEos, &cch, 1 /*strip*/); + if (!pData->pszParent || !*pData->pszParent) + fatal(pFileLoc, _("'extending' requires a parent name")); + + pData->enmExtendBy = kBuildExtendBy_Overriding; + + /* optionally 'by overriding|prepending|appending' */ + psz = find_next_token_eos(&pszLine, pszEos, &cch); + if (psz && WORD_IS(psz, cch, "by")) + { + cch = 0; + psz = find_next_token_eos(&pszLine, pszEos, &cch); + if (WORD_IS(psz, cch, "overriding")) + pData->enmExtendBy = kBuildExtendBy_Overriding; + else if (WORD_IS(psz, cch, "appending")) + pData->enmExtendBy = kBuildExtendBy_Appending; + else if (WORD_IS(psz, cch, "prepending")) + pData->enmExtendBy = kBuildExtendBy_Prepending; + else + fatal(pFileLoc, _("Unknown 'extending by' method '%.*s'"), (int)cch, psz); + + /* next token */ + psz = find_next_token_eos(&pszLine, pszEos, &cch); + } + } + else if (WORD_IS(psz, cch, "using")) + { + /* Template directive. */ + if (enmKind != kBuildDef_Tool) + fatal(pFileLoc, _("'using <template>' can only be used with 'kBuild-define-target'")); + if (pData->pszTemplate != NULL) + fatal(pFileLoc, _("'using' can only occure once")); + + pData->pszTemplate = allocate_expanded_next_token(&pszLine, pszEos, &cch, 1 /*fStrip*/); + if (!pData->pszTemplate || !*pData->pszTemplate) + fatal(pFileLoc, _("'using' requires a template name")); + + /* next token */ + psz = find_next_token_eos(&pszLine, pszEos, &cch); + } + else + fatal(pFileLoc, _("Don't know what '%.*s' means"), (int)cch, psz); + } + + /* + * Calc the variable prefix. + */ + switch (enmKind) + { + case kBuildDef_Target: pszPrefix = ""; break; + case kBuildDef_Template: pszPrefix = "TEMPLATE_"; break; + case kBuildDef_Tool: pszPrefix = "TOOL_"; break; + case kBuildDef_Sdk: pszPrefix = "SDK_"; break; + case kBuildDef_Unit: pszPrefix = "UNIT_"; break; + default: + fatal(pFileLoc, _("enmKind=%d"), enmKind); + return -1; + } + cch = strlen(pszPrefix); + pData->cchVarPrefix = cch + cchName; + pData->pszVarPrefix = xmalloc(pData->cchVarPrefix + 1); + memcpy(pData->pszVarPrefix, pszPrefix, cch); + memcpy(&pData->pszVarPrefix[cch], pData->pszName, cchName); + + /* + * Try resolve the parent and change the current variable set. + */ + eval_kbuild_resolve_parent(pData); + pData->pVariablesSaved = current_variable_set_list; + current_variable_set_list = pData->pVariables; + + return 0; +} + +static int +eval_kbuild_endef_xxxx(struct kbuild_eval_data **ppData, const struct floc *pFileLoc, + const char *pszLine, const char *pszEos, int fIgnoring, enum kBuildDef enmKind) +{ + struct kbuild_eval_data *pData; + unsigned int cchName; + char *pszName; + + if (fIgnoring) + return 0; + + /* + * Is there something to pop? + */ + pData = *ppData; + if (!pData) + { + error(pFileLoc, _("kBuild-endef-%s is missing kBuild-define-%s"), + eval_kbuild_kind_to_string(enmKind), eval_kbuild_kind_to_string(enmKind)); + return 0; + } + + /* + * ... and does it have a matching kind? + */ + if (pData->enmKind != enmKind) + error(pFileLoc, _("'kBuild-endef-%s' does not match 'kBuild-define-%s %s'"), + eval_kbuild_kind_to_string(enmKind), eval_kbuild_kind_to_string(pData->enmKind), pData->pszName); + + /* + * The endef-kbuild may optionally be followed by the target name. + * It should match the name given to the kBuild-define. + */ + pszName = allocate_expanded_next_token(&pszLine, pszEos, &cchName, 1 /*fStrip*/); + if (pszName) + { + if (strcmp(pszName, pData->pszName)) + error(pFileLoc, _("'kBuild-endef-%s %s' does not match 'kBuild-define-%s %s'"), + eval_kbuild_kind_to_string(enmKind), pszName, + eval_kbuild_kind_to_string(pData->enmKind), pData->pszName); + free(pszName); + } + + /* + * Pop a define off the stack. + */ + assert(pData == g_pTopKbDef); + *ppData = g_pTopKbDef = pData->pStackDown; + pData->pStackDown = NULL; + current_variable_set_list = pData->pVariablesSaved; + pData->pVariablesSaved = NULL; + + return 0; +} + +int eval_kbuild_define(struct kbuild_eval_data **kdata, const struct floc *flocp, + const char *word, unsigned int wlen, const char *line, const char *eos, int ignoring) +{ + assert(memcmp(word, "kBuild-define", sizeof("kBuild-define") - 1) == 0); + word += sizeof("kBuild-define") - 1; + wlen -= sizeof("kBuild-define") - 1; + if ( wlen > 1 + && word[0] == '-') + { + if (WORD_IS(word, wlen, "-target")) + return eval_kbuild_define_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Target); + if (WORD_IS(word, wlen, "-template")) + return eval_kbuild_define_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Template); + if (WORD_IS(word, wlen, "-tool")) + return eval_kbuild_define_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Tool); + if (WORD_IS(word, wlen, "-sdk")) + return eval_kbuild_define_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Sdk); + if (WORD_IS(word, wlen, "-unit")) + return eval_kbuild_define_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Unit); + } + + error(flocp, _("Unknown syntax 'kBuild-define%.*s'"), (int)wlen, word); + return 0; +} + +int eval_kbuild_endef(struct kbuild_eval_data **kdata, const struct floc *flocp, + const char *word, unsigned int wlen, const char *line, const char *eos, int ignoring) +{ + assert(memcmp(word, "kBuild-endef", sizeof("kBuild-endef") - 1) == 0); + word += sizeof("kBuild-endef") - 1; + wlen -= sizeof("kBuild-endef") - 1; + if ( wlen > 1 + && word[0] == '-') + { + if (WORD_IS(word, wlen, "-target")) + return eval_kbuild_endef_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Target); + if (WORD_IS(word, wlen, "-template")) + return eval_kbuild_endef_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Template); + if (WORD_IS(word, wlen, "-tool")) + return eval_kbuild_endef_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Tool); + if (WORD_IS(word, wlen, "-sdk")) + return eval_kbuild_endef_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Sdk); + if (WORD_IS(word, wlen, "-unit")) + return eval_kbuild_endef_xxxx(kdata, flocp, line, eos, ignoring, kBuildDef_Unit); + } + + error(flocp, _("Unknown syntax 'kBuild-endef%.*s'"), (int)wlen, word); + return 0; +} + +void print_kbuild_data_base(void) +{ + struct kbuild_eval_data *pCur; + + puts(_("\n# kBuild defines")); + + for (pCur = g_pHeadKbDefs; pCur; pCur = pCur->pGlobalNext) + { + printf("\nkBuild-define-%s %s", + eval_kbuild_kind_to_string(pCur->enmKind), pCur->pszName); + if (pCur->pszParent) + { + printf(" extending %s", pCur->pszParent); + switch (pCur->enmExtendBy) + { + case kBuildExtendBy_Overriding: break; + case kBuildExtendBy_Appending: printf(" by appending"); break; + case kBuildExtendBy_Prepending: printf(" by prepending"); break; + default: printf(" by ?!?"); + } + } + if (pCur->pszTemplate) + printf(" using %s", pCur->pszTemplate); + putchar('\n'); + + print_variable_set(pCur->pVariables->set, ""); + + printf("kBuild-endef-%s %s\n", + eval_kbuild_kind_to_string(pCur->enmKind), pCur->pszName); + } + /** @todo hash stats. */ +} + +void print_kbuild_define_stats(void) +{ + /* later when hashing stuff */ +} + diff --git a/src/kmk/kbuild.h b/src/kmk/kbuild.h index 5d06d31..d911268 100644 --- a/src/kmk/kbuild.h +++ b/src/kmk/kbuild.h @@ -1,4 +1,4 @@ -/* $Id: kbuild.h 2413 2010-09-11 17:43:04Z bird $ */ +/* $Id: kbuild.h 2549 2011-11-09 01:22:04Z bird $ */ /** @file * kBuild specific make functionality. */ @@ -38,5 +38,18 @@ const char *get_kbuild_path(void); const char *get_kbuild_bin_path(void); const char *get_default_kbuild_shell(void); +struct kbuild_eval_data; +extern struct kbuild_eval_data *g_pTopKbDef; +struct variable_set *get_top_kbuild_variable_set(void); +char *kbuild_prefix_variable(const char *pszName, unsigned int *pcchName); + +int eval_kbuild_define(struct kbuild_eval_data **kdata, const struct floc *flocp, + const char *word, unsigned int wlen, const char *line, const char *eos, int ignoring); +int eval_kbuild_endef(struct kbuild_eval_data **kdata, const struct floc *flocp, + const char *word, unsigned int wlen, const char *line, const char *eos, int ignoring); + +void print_kbuild_data_base(void); +void print_kbuild_define_stats(void); + #endif diff --git a/src/kmk/kmkbuiltin/chmod.c b/src/kmk/kmkbuiltin/chmod.c index 6d360af..e6db989 100644 --- a/src/kmk/kmkbuiltin/chmod.c +++ b/src/kmk/kmkbuiltin/chmod.c @@ -52,7 +52,7 @@ static char sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94"; #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef _MSC_VER +#ifndef _MSC_VER # include <unistd.h> #else # include "mscfakes.h" @@ -60,6 +60,9 @@ static char sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94"; #ifdef __sun__ # include "solfakes.h" #endif +#ifdef __HAIKU__ +# include "haikufakes.h" +#endif #include "getopt.h" #include "kmkbuiltin.h" diff --git a/src/kmk/kmkbuiltin/cp_utils.c b/src/kmk/kmkbuiltin/cp_utils.c index a966fdd..5410f6f 100644 --- a/src/kmk/kmkbuiltin/cp_utils.c +++ b/src/kmk/kmkbuiltin/cp_utils.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.43 2004/04/06 20:06:44 markm Exp $"); #endif #endif /* not lint */ +#define MSC_DO_64_BIT_IO #include "config.h" #ifndef _MSC_VER # include <sys/param.h> @@ -52,13 +53,17 @@ __FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.43 2004/04/06 20:06:44 markm Exp $"); #include <stdio.h> #include <stdlib.h> #include <signal.h> -#include <sysexits.h> +#ifndef __HAIKU__ +# include <sysexits.h> +#endif #include <unistd.h> #ifdef __sun__ # include "solfakes.h" #endif +#ifdef __HAIKU__ +# include "haikufakes.h" +#endif #ifdef _MSC_VER -# define MSC_DO_64_BIT_IO # include "mscfakes.h" #else # include <sys/time.h> diff --git a/src/kmk/kmkbuiltin/fts.c b/src/kmk/kmkbuiltin/fts.c index f913f17..9860f67 100644 --- a/src/kmk/kmkbuiltin/fts.c +++ b/src/kmk/kmkbuiltin/fts.c @@ -75,7 +75,7 @@ __RCSID("$NetBSD: __fts13.c,v 1.44 2005/01/19 00:59:48 mycroft Exp $"); #endif #if ! HAVE_NBTOOL_CONFIG_H -# if !defined(__sun__) && !defined(__gnu_linux__) +# if !defined(__sun__) && !defined(__gnu_linux__) && !defined(__HAIKU__) # define HAVE_STRUCT_DIRENT_D_NAMLEN 1 # endif #endif diff --git a/src/kmk/kmkbuiltin/haikufakes.c b/src/kmk/kmkbuiltin/haikufakes.c new file mode 100644 index 0000000..15b4a3a --- /dev/null +++ b/src/kmk/kmkbuiltin/haikufakes.c @@ -0,0 +1,53 @@ +/* $Id: haikufakes.c 2546 2011-10-01 19:49:54Z bird $ */ +/** @file + * Fake Unix/BSD stuff for Haiku. + */ + +/* + * Copyright (c) 2005-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net> + * + * This file is part of kBuild. + * + * kBuild is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * kBuild is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with kBuild. If not, see <http://www.gnu.org/licenses/> + * + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#include "config.h" +#include <errno.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <sys/stat.h> +#include "haikufakes.h" + + +int haiku_lchmod(const char *pszPath, mode_t mode) +{ + /* + * Weed out symbolic links. + */ + struct stat s; + if ( !lstat(pszPath, &s) + && S_ISLNK(s.st_mode)) + { + errno = -ENOSYS; + return -1; + } + + return chmod(pszPath, mode); +} + diff --git a/src/kmk/kmkbuiltin/haikufakes.h b/src/kmk/kmkbuiltin/haikufakes.h new file mode 100644 index 0000000..70a8cdd --- /dev/null +++ b/src/kmk/kmkbuiltin/haikufakes.h @@ -0,0 +1,40 @@ +/* $Id: haikufakes.h 2546 2011-10-01 19:49:54Z bird $ */ +/** @file + * Unix/BSD fakes for Haiku. + */ + +/* + * Copyright (c) 2005-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net> + * + * This file is part of kBuild. + * + * kBuild is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * kBuild is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with kBuild. If not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef ___haikufakes_h +#define ___haikufakes_h + +#define EX_OK 0 +#define EX_OSERR 1 +#define EX_NOUSER 1 +#define EX_USAGE 1 +#define EX_TEMPFAIL 1 +#define EX_SOFTWARE 1 + +#define lutimes(path, tvs) utimes(path, tvs) +#define lchmod haiku_lchmod + +#endif + diff --git a/src/kmk/kmkbuiltin/install.c b/src/kmk/kmkbuiltin/install.c index 6c4b1cc..799effe 100644 --- a/src/kmk/kmkbuiltin/install.c +++ b/src/kmk/kmkbuiltin/install.c @@ -52,7 +52,9 @@ __FBSDID("$FreeBSD: src/usr.bin/xinstall/xinstall.c,v 1.66 2005/01/25 14:34:57 s # ifdef USE_MMAP # include <sys/mman.h> # endif -# include <sys/mount.h> +# ifndef __HAIKU__ +# include <sys/mount.h> +# endif # include <sys/wait.h> # include <sys/time.h> #endif /* !_MSC_VER */ @@ -68,7 +70,9 @@ __FBSDID("$FreeBSD: src/usr.bin/xinstall/xinstall.c,v 1.66 2005/01/25 14:34:57 s #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sysexits.h> +#ifndef __HAIKU__ +# include <sysexits.h> +#endif #include <unistd.h> #if defined(__EMX__) || defined(_MSC_VER) # include <process.h> @@ -80,6 +84,9 @@ __FBSDID("$FreeBSD: src/usr.bin/xinstall/xinstall.c,v 1.66 2005/01/25 14:34:57 s #ifdef _MSC_VER # include "mscfakes.h" #endif +#ifdef __HAIKU__ +# include "haikufakes.h" +#endif #include "kmkbuiltin.h" diff --git a/src/kmk/kmkbuiltin/mkdir.c b/src/kmk/kmkbuiltin/mkdir.c index 3b75e64..cebb784 100644 --- a/src/kmk/kmkbuiltin/mkdir.c +++ b/src/kmk/kmkbuiltin/mkdir.c @@ -53,12 +53,17 @@ __FBSDID("$FreeBSD: src/bin/mkdir/mkdir.c,v 1.28 2004/04/06 20:06:48 markm Exp $ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sysexits.h> +#ifndef __HAIKU__ +# include <sysexits.h> +#endif #include <unistd.h> #ifdef HAVE_ALLOCA_H # include <alloca.h> #endif #include "getopt.h" +#ifdef __HAIKU__ +# include "haikufakes.h" +#endif #ifdef _MSC_VER # include <malloc.h> # include "mscfakes.h" diff --git a/src/kmk/kmkbuiltin/mv.c b/src/kmk/kmkbuiltin/mv.c index 8ebf1ce..28c04f1 100644 --- a/src/kmk/kmkbuiltin/mv.c +++ b/src/kmk/kmkbuiltin/mv.c @@ -55,7 +55,9 @@ __FBSDID("$FreeBSD: src/bin/mv/mv.c,v 1.46 2005/09/05 04:36:08 csjp Exp $"); # include <sys/param.h> # include <sys/time.h> # include <sys/wait.h> -# include <sys/mount.h> +# ifndef __HAIKU__ +# include <sys/mount.h> +# endif #endif #include <sys/stat.h> @@ -69,12 +71,17 @@ __FBSDID("$FreeBSD: src/bin/mv/mv.c,v 1.46 2005/09/05 04:36:08 csjp Exp $"); #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sysexits.h> +#ifndef __HAIKU__ +# include <sysexits.h> +#endif #include <unistd.h> #include "getopt.h" #ifdef __sun__ # include "solfakes.h" #endif +#ifdef __HAIKU__ +# include "haikufakes.h" +#endif #ifdef _MSC_VER # include "mscfakes.h" #endif diff --git a/src/kmk/kmkbuiltin/rm.c b/src/kmk/kmkbuiltin/rm.c index 4134a6d..e74d5b6 100644 --- a/src/kmk/kmkbuiltin/rm.c +++ b/src/kmk/kmkbuiltin/rm.c @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)rm.c 8.5 (Berkeley) 4/18/94"; #include "config.h" #include <sys/stat.h> -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__HAIKU__) # include <sys/param.h> # include <sys/mount.h> #endif @@ -57,10 +57,15 @@ static char sccsid[] = "@(#)rm.c 8.5 (Berkeley) 4/18/94"; #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sysexits.h> +#ifndef __HAIKU__ +# include <sysexits.h> +#endif #include <unistd.h> #include <ctype.h> #include "getopt.h" +#ifdef __HAIKU__ +# include "haikufakes.h" +#endif #ifdef _MSC_VER # include "mscfakes.h" #endif diff --git a/src/kmk/main.c b/src/kmk/main.c index e901e98..528ce60 100644 --- a/src/kmk/main.c +++ b/src/kmk/main.c @@ -55,6 +55,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */ # define INCL_BASE # include <os2.h> # endif +# ifdef __HAIKU__ +# include <OS.h> +# endif #endif /* KMK*/ #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) @@ -835,7 +838,7 @@ set_make_priority_and_affinity (void) if (process_affinity) if (!SetProcessAffinityMask (GetCurrentProcess (), process_affinity)) fprintf (stderr, "warning: SetPriorityClass (,%#x) failed with last error %d\n", - process_affinity, GetLastError()); + process_affinity, GetLastError ()); switch (process_priority) { @@ -845,12 +848,31 @@ set_make_priority_and_affinity (void) case 3: dwPriority = NORMAL_PRIORITY_CLASS; break; case 4: dwPriority = HIGH_PRIORITY_CLASS; break; case 5: dwPriority = REALTIME_PRIORITY_CLASS; break; - default: fatal(NILF, _("invalid priority %d\n"), process_priority); + default: fatal (NILF, _("invalid priority %d\n"), process_priority); } if (!SetPriorityClass (GetCurrentProcess (), dwPriority)) fprintf (stderr, "warning: SetPriorityClass (,%#x) failed with last error %d\n", dwPriority, GetLastError ()); +#elif defined(__HAIKU__) + int32 iNewPriority; + status_t error; + + switch (process_priority) + { + case 0: return; + case 1: iNewPriority = B_LOWEST_ACTIVE_PRIORITY; break; + case 2: iNewPriority = B_LOW_PRIORITY; break; + case 3: iNewPriority = B_NORMAL_PRIORITY; break; + case 4: iNewPriority = B_URGENT_DISPLAY_PRIORITY; break; + case 5: iNewPriority = B_REAL_TIME_DISPLAY_PRIORITY; break; + default: fatal (NILF, _("invalid priority %d\n"), process_priority); + } + error = set_thread_priority (find_thread (NULL), iNewPriority); + if (error != B_OK) + fprintf (stderr, "warning: set_thread_priority (,%d) failed: %s\n", + newPriority, strerror (error)); + # else /*#elif HAVE_NICE */ int nice_level = 0; switch (process_priority) @@ -861,7 +883,7 @@ set_make_priority_and_affinity (void) case 3: nice_level = 0; break; case 4: nice_level = -10; break; case 5: nice_level = -19; break; - default: fatal(NILF, _("invalid priority %d\n"), process_priority); + default: fatal (NILF, _("invalid priority %d\n"), process_priority); } errno = 0; if (nice (nice_level) == -1 && errno != 0) @@ -3696,6 +3718,9 @@ print_data_base () print_rule_data_base (); print_file_data_base (); print_vpath_data_base (); +#ifdef KMK + print_kbuild_data_base (); +#endif #ifndef CONFIG_WITH_STRCACHE2 strcache_print_stats ("#"); #else @@ -3720,6 +3745,9 @@ print_stats () print_variable_stats (); print_file_stats (); +# ifdef KMK + print_kbuild_define_stats (); +# endif # ifndef CONFIG_WITH_STRCACHE2 strcache_print_stats ("#"); # else diff --git a/src/kmk/make.h b/src/kmk/make.h index 38b511f..b12c65f 100644 --- a/src/kmk/make.h +++ b/src/kmk/make.h @@ -500,6 +500,9 @@ void print_heap_stats (void); char *find_next_token (const char **, unsigned int *); char *next_token (const char *); char *end_of_token (const char *); +#ifdef KMK +char *find_next_token_eos (const char **ptr, const char *eos, unsigned int *lengthptr); +#endif #ifndef CONFIG_WITH_VALUE_LENGTH void collapse_continuations (char *); #else diff --git a/src/kmk/misc.c b/src/kmk/misc.c index 846d764..8701bb3 100644 --- a/src/kmk/misc.c +++ b/src/kmk/misc.c @@ -719,6 +719,62 @@ find_next_token (const char **ptr, unsigned int *lengthptr) return (char *)p; #endif } +#ifdef KMK + +/* Same as find_next_token with two exception: + - The string ends at EOS or '\0'. + - We keep track of $() and ${}, allowing functions to be used. */ + +char * +find_next_token_eos (const char **ptr, const char *eos, unsigned int *lengthptr) +{ + const char *p = *ptr; + const char *e; + int level = 0; + + /* skip blanks */ + for (; p != eos; p++) + { + unsigned char ch = *p; + if (!MY_IS_BLANK(ch)) + { + if (!ch) + return NULL; + break; + } + } + if (p == eos) + return NULL; + + /* skip ahead until EOS or blanks. */ + for (e = p; e != eos; e++) + { + unsigned char ch = *e; + if (MY_IS_BLANK_OR_EOS(ch)) + { + if (!ch || level == 0) + break; + } + else if (ch == '$') + { + if (&e[1] != eos && (e[1] == '(' || e[1] == '{')) + { + level++; + e++; + } + } + else if ((ch == ')' || ch == '}') && level > 0) + level--; + } + + *ptr = e; + if (lengthptr != 0) + *lengthptr = e - p; + + return (char *)p; +} + +#endif /* KMK */ /* Allocate a new `struct dep' with all fields initialized to 0. */ diff --git a/src/kmk/read.c b/src/kmk/read.c index dddf54b..8d8087e 100644 --- a/src/kmk/read.c +++ b/src/kmk/read.c @@ -588,6 +588,10 @@ eval (struct ebuffer *ebuf, int set_default) #ifdef CONFIG_WITH_VALUE_LENGTH unsigned int tmp_len; #endif +#ifdef KMK + struct kbuild_eval_data *kdata = 0; + int krc; +#endif #define record_waiting_files() \ do \ @@ -891,6 +895,24 @@ eval (struct ebuffer *ebuf, int set_default) can appear in the middle of a rule. */ continue; +#ifdef KMK + /* Check for the kBuild language extensions. */ + if ( wlen >= sizeof("kBuild-define") - 1 + && strneq (p, "kBuild-define", sizeof("kBuild-define") - 1)) + krc = eval_kbuild_define (&kdata, fstart, p, wlen, p2, eol, ignoring); + else if ( wlen >= sizeof("kBuild-endef") - 1 + && strneq (p, "kBuild-endef", sizeof("kBuild-endef") - 1)) + krc = eval_kbuild_endef (&kdata, fstart, p, wlen, p2, eol, ignoring); + else + krc = 42; + if (krc != 42) + { + if (krc != 0) + error (fstart, _("krc=%d"), krc); + continue; + } + +#endif /* KMK */ if (word1eq ("export")) { /* 'export' by itself causes everything to be exported. */ @@ -1641,6 +1663,11 @@ eval (struct ebuffer *ebuf, int set_default) if (conditionals->if_cmds) fatal (fstart, _("missing `endif'")); +#ifdef KMK + + if (kdata != NULL) + fatal (fstart, _("missing `kBuild-endef-*'")); +#endif /* At eof, record the last rule. */ record_waiting_files (); diff --git a/src/kmk/testcase-kBuild-define.kmk b/src/kmk/testcase-kBuild-define.kmk new file mode 100644 index 0000000..970be89 --- /dev/null +++ b/src/kmk/testcase-kBuild-define.kmk @@ -0,0 +1,56 @@ +# $Id: testcase-kBuild-define.kmk 2549 2011-11-09 01:22:04Z bird $ +## @file +# kBuild - testcase for the kBuild-define-* directives. +# + +# +# Copyright (c) 2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net> +# +# This file is part of kBuild. +# +# kBuild is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# kBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with kBuild. If not, see <http://www.gnu.org/licenses/> +# +# + +DEPTH = ../.. +#include $(PATH_KBUILD)/header.kmk + +kBuild-define-target MyTarget + +_TEMPLATE = MyTemplate +_SOURCES = MySourceFile.c + +kBuild-endef-target MyTarget +$(if "$(MyTarget_TEMPLATE)" == "MyTemplate",,$(error MyTarget's _TEMPLATE wasn't set correctly in the global space)) +$(if "$(MyTarget_SOURCES)" == "MySourceFile.c",,$(error MyTarget's _TEMPLATE wasn't set correctly in the global space)) + + +INDIRECT_NAME = MyTarget$(strip $1) +kBuild-define-target $(call INDIRECT_NAME, 2) + +local _TEMPLATE = MyTemplate2 +_SOURCES = MySourceFile2.c + +kBuild-endef-target $(call INDIRECT_NAME, 2) +$(if "$(_TEMPLATE)" == "",,$(error _TEMPLATE has leaked out into the global space)) + + + + +all_recursive: + #$(ECHO) "kBuild-define-xxxx works fine" + + + + diff --git a/src/kmk/variable.c b/src/kmk/variable.c index 02dca60..73ec34e 100644 --- a/src/kmk/variable.c +++ b/src/kmk/variable.c @@ -212,8 +212,37 @@ define_variable_in_set (const char *name, unsigned int length, struct variable **var_slot; struct variable var_key; +#ifndef KMK if (set == NULL) set = &global_variable_set; +#else + if (set == NULL) + { + /* underscore prefixed variables are automatically local in + kBuild-define-* scopes. They also get a global definition with + the current scope prefix. */ + if (g_pTopKbDef && length > 0 && name[0] == '_') + { + char *prefixed_nm; + unsigned int prefixed_nm_len; + + set = get_top_kbuild_variable_set(); + v = define_variable_in_set(name, length, value, value_len, + 1 /* duplicate_value */, + origin, recursive, set, flocp); + + prefixed_nm_len = length; + prefixed_nm = kbuild_prefix_variable(name, &prefixed_nm_len); + define_variable_in_set(prefixed_nm, prefixed_nm_len, + value, value_len, duplicate_value, + origin, recursive, &global_variable_set, + flocp); + free(prefixed_nm); + return v; + } + set = &global_variable_set; + } +#endif #ifndef CONFIG_WITH_STRCACHE2 var_key.name = (char *) name; @@ -1268,7 +1297,8 @@ define_automatic_variables (void) && defined (CONFIG_WITH_ABSPATHEX) \ && defined (CONFIG_WITH_TOUPPER_TOLOWER) \ && defined (CONFIG_WITH_DEFINED) \ - && defined (CONFIG_WITH_VALUE_LENGTH) && defined (CONFIG_WITH_COMPARE) \ + && defined (CONFIG_WITH_VALUE_LENGTH) \ + && defined (CONFIG_WITH_COMPARE) \ && defined (CONFIG_WITH_STACK) \ && defined (CONFIG_WITH_MATH) \ && defined (CONFIG_WITH_XARGS) \ @@ -1290,7 +1320,8 @@ define_automatic_variables (void) && defined (CONFIG_WITH_DEFINED_FUNCTIONS) \ && defined (KMK_HELPERS) (void) define_variable ("KMK_FEATURES", 12, - "append-dash-n abspath includedep-queue install-hard-linking" + "append-dash-n abspath includedep-queue install-hard-linking umask" + " kBuild-define" " rsort" " abspathex" " toupper tolower" @@ -1315,12 +1346,13 @@ define_automatic_variables (void) " for while" " root" " length insert pos lastpos substr translate" - " kb-src-tool kb-obj-base kb-obj-suff kb-src-prop kb-src-one kb-exp-tmpl " - " firstdefined lastdefined " + " kb-src-tool kb-obj-base kb-obj-suff kb-src-prop kb-src-one kb-exp-tmpl" + " firstdefined lastdefined" , o_default, 0); # else /* MSC can't deal with strings mixed with #if/#endif, thus the slow way. */ # error "All features should be enabled by default!" - strcpy (buf, "append-dash-n abspath includedep-queue install-hard-linking"); + strcpy (buf, "append-dash-n abspath includedep-queue install-hard-linking umask" + " kBuild-define"); # if defined (CONFIG_WITH_RSORT) strcat (buf, " rsort"); # endif diff --git a/src/lib/k/kDefs.h b/src/lib/k/kDefs.h index 9e6187d..b67886f 100644 --- a/src/lib/k/kDefs.h +++ b/src/lib/k/kDefs.h @@ -42,22 +42,24 @@ #define K_OS_DRAGONFLY 2 /** FreeBSD. */ #define K_OS_FREEBSD 3 +/** Haiku. */ +#define K_OS_HAIKU 4 /** Linux. */ -#define K_OS_LINUX 4 +#define K_OS_LINUX 5 /** NetBSD. */ -#define K_OS_NETBSD 5 +#define K_OS_NETBSD 6 /** NT (native). */ -#define K_OS_NT 6 +#define K_OS_NT 7 /** OpenBSD*/ -#define K_OS_OPENBSD 7 +#define K_OS_OPENBSD 8 /** OS/2 */ -#define K_OS_OS2 8 +#define K_OS_OS2 9 /** Solaris */ -#define K_OS_SOLARIS 9 +#define K_OS_SOLARIS 10 /** Windows. */ -#define K_OS_WINDOWS 10 +#define K_OS_WINDOWS 11 /** The max K_OS_* value (exclusive). */ -#define K_OS_MAX 11 +#define K_OS_MAX 12 /** @} */ /** @def K_OS @@ -78,6 +80,8 @@ # define K_OS K_OS_DRAGONFLY # elif defined(__FreeBSD__) /*??*/ # define K_OS K_OS_FREEBSD +# elif defined(__HAIKU__) +# define K_OS K_OS_HAIKU # elif defined(__gnu_linux__) # define K_OS K_OS_LINUX # elif defined(__NetBSD__) /*??*/ diff --git a/src/misc/kmk_time.c b/src/misc/kmk_time.c index beccbe0..c2bdfbb 100644 --- a/src/misc/kmk_time.c +++ b/src/misc/kmk_time.c @@ -1,4 +1,4 @@ -/* $Id: kmk_time.c 2413 2010-09-11 17:43:04Z bird $ */ +/* $Id: kmk_time.c 2546 2011-10-01 19:49:54Z bird $ */ /** @file * kmk_time - Time program execution. * @@ -363,11 +363,13 @@ int main(int argc, char **argv) printf(" - normal exit: %d\n", WEXITSTATUS(rc)); rc = WEXITSTATUS(rc); } +# ifndef __HAIKU__ /**@todo figure how haiku signals that a core was dumped. */ else if (WIFSIGNALED(rc) && WCOREDUMP(rc)) { printf(" - dumped core: %s (%d)\n", my_strsignal(WTERMSIG(rc)), WTERMSIG(rc)); rc = 10; } +# endif else if (WIFSIGNALED(rc)) { printf(" - killed by: %s (%d)\n", my_strsignal(WTERMSIG(rc)), WTERMSIG(rc)); diff --git a/src/sed/Makefile.kmk b/src/sed/Makefile.kmk index eeae26f..290a64e 100644 --- a/src/sed/Makefile.kmk +++ b/src/sed/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 2506 2011-07-23 10:58:06Z bird $ +# $Id: Makefile.kmk 2546 2011-10-01 19:49:54Z bird $ ## @file # Sub-Makefile for kmk_sed. # @@ -69,13 +69,16 @@ kmk_sed_SOURCES.freebsd = \ lib/strverscmp.c \ lib/obstack.c \ lib/getline.c +kmk_sed_SOURCES.haiku = \ + lib/strverscmp.c \ + lib/obstack.c kmk_sed_SOURCES.openbsd = \ lib/strverscmp.c \ lib/obstack.c \ lib/getline.c kmk_sed_SOURCES.solaris = \ lib/strverscmp.c \ - lib/obstack.c + lib/obstack.c ifdef KBUILD_SOLARIS_10 kmk_sed_SOURCES.solaris += \ lib/getline.c |