changeset 25:8a7e68362fa8

BSD port initial load Contributed-by: Greg Lewis <glewis@eyesbeyond.com>, Kurt Miller <kurt@intricatesoftware.com>, Landon Fuller <landonf@bikemonkey.org>, Jung-uk Kim <jkim@freebsd.org>, Christos Zoulas <christos@zoulas.com>, FreeBSD Foundation <board@freebsdfoundation.org>
author mr
date Wed, 20 Aug 2008 10:30:26 -0700
parents 1d1bb188c1a6
children 251ac9a519c2
files make/common/Defs-bsd.gmk make/common/Defs.gmk make/common/Mapfile-vers.gmk make/common/shared/Compiler-gcc.gmk make/common/shared/Compiler.gmk make/common/shared/Defs-bsd.gmk make/common/shared/Defs-utils.gmk make/common/shared/Platform.gmk make/sun/corba/core/Makefile
diffstat 9 files changed, 565 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/common/Defs-bsd.gmk	Wed Aug 20 10:30:26 2008 -0700
@@ -0,0 +1,290 @@
+#
+# Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# This code 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
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+#
+# Makefile to specify compiler flags for programs and libraries
+# targeted to Bsd.  Should not contain any rules.
+#
+
+# Warning: the following variables are overriden by Defs.gmk. Set
+# values will be silently ignored:
+#   CFLAGS        (set $(OTHER_CFLAGS) instead)
+#   CPPFLAGS      (set $(OTHER_CPPFLAGS) instead)
+#   CXXFLAGS      (set $(OTHER_CXXFLAGS) instead)
+#   LDFLAGS       (set $(OTHER_LDFAGS) instead)
+#   LDLIBS        (set $(EXTRA_LIBS) instead)
+#   LDLIBS_COMMON (set $(EXTRA_LIBS) instead)
+
+# Get shared JDK settings
+include $(BUILDDIR)/common/shared/Defs.gmk
+
+ifndef PLATFORM_SRC
+  PLATFORM_SRC = $(TOPDIR)/src/solaris
+endif # PLATFORM_SRC
+
+# platform specific include files
+PLATFORM_INCLUDE_NAME = $(OS_NAME)
+PLATFORM_INCLUDE      = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
+
+# suffix used for make dependencies files.
+DEPEND_SUFFIX = d
+# The suffix applied to the library name for FDLIBM
+FDDLIBM_SUFFIX = a
+# The suffix applied to scripts (.bat for windows, nothing for unix)
+SCRIPT_SUFFIX =
+# CC compiler object code output directive flag value
+CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
+CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
+
+#
+# Default HPI libraries. Build will build only native, unless
+# overriden at the make command line. This makes it convenient for
+# people doing, say, a pthreads port -- they can create a posix
+# directory here, and say "gnumake HPIS=posix" at the top
+# level.
+#
+HPIS = native
+
+#
+# Default optimization
+#
+CC_HIGHEST_OPT = -O3
+CC_HIGHER_OPT  = -O3
+CC_LOWER_OPT   = -O2
+CC_NO_OPT      =
+
+ifeq ($(PRODUCT), java)
+    _OPT = $(CC_HIGHER_OPT)
+else
+    _OPT = $(CC_LOWER_OPT)
+    CPPFLAGS_DBG    += -DLOGGING 
+endif
+
+# For all platforms, do not omit the frame pointer register usage. 
+#    We need this frame pointer to make it easy to walk the stacks.
+#    This should be the default on X86, but ia64 and amd64 may not have this
+#    as the default.
+CFLAGS_REQUIRED_amd64   += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
+CFLAGS_REQUIRED_i586    += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
+ifeq ($(OS_VENDOR),Apple)
+  # 16-byte stack re-alignment on 32-bit Darwin
+  CFLAGS_REQUIRED_i586 += -mstackrealign
+endif
+CFLAGS_REQUIRED_ia64    += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
+CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9
+LDFLAGS_COMMON_sparcv9  += -m64 -mcpu=v9
+CFLAGS_REQUIRED_sparc   += -m32 -mcpu=v9
+LDFLAGS_COMMON_sparc    += -m32 -mcpu=v9
+CFLAGS_REQUIRED         =  $(CFLAGS_REQUIRED_$(ARCH))
+LDFLAGS_COMMON          += $(LDFLAGS_COMMON_$(ARCH))
+
+# Add in platform specific optimizations for all opt levels
+CC_HIGHEST_OPT += $(_OPT_$(ARCH))
+CC_HIGHER_OPT  += $(_OPT_$(ARCH))
+CC_LOWER_OPT   += $(_OPT_$(ARCH))
+
+# If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
+ifdef NO_OPTIMIZATIONS
+  CC_HIGHEST_OPT = $(CC_NO_OPT)
+  CC_HIGHER_OPT  = $(CC_NO_OPT)
+  CC_LOWER_OPT   = $(CC_NO_OPT)
+endif
+
+#
+# Selection of warning messages
+#
+GCC_INHIBIT	= -Wno-unused -Wno-parentheses
+GCC_STYLE	= 
+GCC_WARNINGS	= -W -Wall $(GCC_STYLE) $(GCC_INHIBIT)
+
+#
+# Treat compiler warnings as errors, if warnings not allowed
+#
+ifeq ($(COMPILER_WARNINGS_FATAL),true)
+  GCC_WARNINGS += -Werror
+endif
+
+#
+# Misc compiler options
+#
+ifeq ($(ARCH),ppc)
+  CFLAGS_COMMON   = -fsigned-char
+else # ARCH
+  CFLAGS_COMMON   = -fno-strict-aliasing
+endif # ARCH
+PIC_CODE_LARGE = -fPIC
+PIC_CODE_SMALL = -fpic
+GLOBAL_KPIC = $(PIC_CODE_LARGE)
+ifeq ($(ARCH), amd64)
+   CFLAGS_COMMON   += $(GLOBAL_KPIC) $(GCC_WARNINGS) -pipe
+else
+   CFLAGS_COMMON   += $(GLOBAL_KPIC) $(GCC_WARNINGS)
+endif
+
+# Bsd 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1
+DEBUG_FLAG = -g
+ifeq ($(FASTDEBUG), true)
+  ifeq ($(ARCH_DATA_MODEL), 64)
+    DEBUG_FLAG = -g1
+  endif
+endif
+
+CFLAGS_OPT      = $(POPT)
+CFLAGS_DBG      = $(DEBUG_FLAG)
+CFLAGS_COMMON += $(CFLAGS_REQUIRED)
+
+CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS)
+CXXFLAGS_OPT	= $(POPT)
+CXXFLAGS_DBG	= $(DEBUG_FLAG)
+CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
+
+# FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java
+ifeq ($(FASTDEBUG), true)
+  CFLAGS_DBG    += $(CC_LOWER_OPT)
+  CXXFLAGS_DBG	+= $(CC_LOWER_OPT)
+endif
+
+CPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -D_ALLBSD_SOURCE $(VERSION_DEFINES) \
+		  -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT
+
+ifeq ($(ARCH_DATA_MODEL), 64)
+CPPFLAGS_COMMON += -D_LP64=1
+endif
+
+CPPFLAGS_OPT    = 
+CPPFLAGS_DBG    = -DDEBUG
+
+#
+# -L paths for finding and -ljava
+#
+LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
+
+ifneq ($(OS_VENDOR), Apple)
+LDFLAGS_OPT     = -Xlinker -O1
+LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX)
+endif
+
+#
+# -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always
+# statically link libgcc but will print a warning with the flag. We don't 
+# want the warning, so check gcc version first.
+#
+CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1)
+ifeq ("$(CC_VER_MAJOR)", "3")
+OTHER_LDFLAGS  += -static-libgcc
+endif
+
+# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
+#   (See Rules.gmk) The gcc 5 compiler might have an option for this?
+AUTOMATIC_PCH_OPTION = 
+
+#
+# Post Processing of libraries/executables
+#
+ifeq ($(VARIANT), OPT)
+  ifneq ($(NO_STRIP), true)
+    # Debug 'strip -g' leaves local function Elf symbols (better stack traces)
+    POST_STRIP_PROCESS = $(STRIP) -g
+  endif
+endif
+
+#
+# Use: ld $(LD_MAPFILE_FLAG) mapfile *.o
+#
+LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker
+
+# Darwin does not support linker map files.
+ifeq ($(OS_VENDOR), Apple)
+LDNOMAP=true
+endif
+
+#
+# Path and option to link against the VM, if you have to.  Note that
+# there are libraries that link against only -ljava, but they do get
+# -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
+# the library itself should not.
+#
+VM_NAME         = server
+JVMLIB          = -L$(BOOTDIR)/jre/lib/$(LIBARCH)/$(VM_NAME) -ljvm
+JAVALIB         = -L$(BOOTDIR)/jre/lib/$(LIBARCH) -ljava $(JVMLIB)
+
+#
+# We want to privatize JVM symbols on Solaris. This is so the user can
+# write a function called FindClass and this should not override the 
+# FindClass that is inside the JVM. At this point in time we are not
+# concerned with other JNI libraries because we hope that there will
+# not be as many clashes there.
+#
+PRIVATIZE_JVM_SYMBOLS = false
+
+USE_PTHREADS = true
+override ALT_CODESET_KEY         = _NL_CTYPE_CODESET_NAME
+override AWT_RUNPATH             =
+override HAVE_ALTZONE            = false
+override HAVE_FILIOH             = false
+override HAVE_GETHRTIME          = false
+override HAVE_GETHRVTIME         = false
+ifeq ($(OS_VENDOR),Apple)
+override HAVE_SIGIGNORE          = true
+endif
+override LEX_LIBRARY             = -lfl
+ifeq ($(STATIC_CXX),true)
+override LIBCXX                  = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic
+else
+override LIBCXX                  = -lstdc++
+endif
+override LIBPOSIX4               =
+override LIBSOCKET               =
+override LIBTHREAD               =
+override MOOT_PRIORITIES         = true
+override NO_INTERRUPTIBLE_IO     = false
+override OPENWIN_HOME            = /usr/X11R6
+override OPENWIN_LIB             = $(OPENWIN_HOME)/lib
+override OTHER_M4FLAGS           = -D__GLIBC__ -DGNU_ASSEMBLER
+override SUN_CMM_SUBDIR          =
+override THREADS_FLAG            = native
+override USE_GNU_M4              = true
+override USING_GNU_TAR           = true
+override WRITE_LIBVERSION        = false
+
+# USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the
+# resulting resolved absolute name of the executable in the environment
+# variable EXECNAME.  That executable name is then used that to locate the
+# installation area.
+override USE_EXECNAME            = true
+
+# If your platform has DPS, it will have Type1 fonts too, in which case
+# it is best to enable DPS support until such time as 2D's rasteriser
+# can fully handle Type1 fonts in all cases. Default is "yes".
+# HAVE_DPS should only be "no" if the platform has no DPS headers or libs
+# DPS (Displayable PostScript) is available on Solaris machines
+HAVE_DPS = no
+
+#
+# Japanese manpages
+#
+JA_SOURCE_ENCODING = eucJP
+JA_TARGET_ENCODINGS = eucJP
+
--- a/make/common/Defs.gmk	Wed Aug 20 10:18:40 2008 -0700
+++ b/make/common/Defs.gmk	Wed Aug 20 10:30:26 2008 -0700
@@ -97,6 +97,9 @@
     LDLIBS_COMMON = -ldl
   endif
 
+  ifeq ($(PLATFORM), bsd)
+    LDLIBS_COMMON = -pthread
+  endif
 endif # PROGRAM
 
 LDLIBS_COMMON += $(EXTRA_LIBS)
--- a/make/common/Mapfile-vers.gmk	Wed Aug 20 10:18:40 2008 -0700
+++ b/make/common/Mapfile-vers.gmk	Wed Aug 20 10:30:26 2008 -0700
@@ -77,7 +77,7 @@
 endif # PLATFORM
 
 
-ifeq ($(PLATFORM), linux)
+ifneq (,$(findstring $(PLATFORM), linux bsd))
 
 ifeq ($(VARIANT), OPT)
   # OPT build MUST have a mapfile?
--- a/make/common/shared/Compiler-gcc.gmk	Wed Aug 20 10:18:40 2008 -0700
+++ b/make/common/shared/Compiler-gcc.gmk	Wed Aug 20 10:30:26 2008 -0700
@@ -99,6 +99,24 @@
 
 endif
 
+ifeq ($(PLATFORM), bsd)
+  # Settings specific to BSD
+  CC             = $(COMPILER_PATH)gcc
+  CPP            = $(COMPILER_PATH)gcc -E
+  CXX            = $(COMPILER_PATH)g++
+  REQUIRED_CC_VER = 3.3
+  REQUIRED_GCC_VER = 3.3.*
+
+# Option used to create a shared library
+ifeq ($(OS_VENDOR), Apple)
+  SHARED_LIBRARY_FLAG = -dynamiclib
+else
+  SHARED_LIBRARY_FLAG = -shared
+endif
+
+  SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 )
+endif
+
 ifeq ($(PLATFORM), solaris)
 
   # Settings specific to Solaris
--- a/make/common/shared/Compiler.gmk	Wed Aug 20 10:18:40 2008 -0700
+++ b/make/common/shared/Compiler.gmk	Wed Aug 20 10:30:26 2008 -0700
@@ -42,6 +42,11 @@
   override CC_VERSION = gcc
 endif
 
+# BSD uses GNU compilers by default
+ifeq ($(PLATFORM), bsd)
+  override CC_VERSION = gcc
+endif
+
 # Get the compiler specific settings
 include $(BUILDDIR)/common/shared/Compiler-$(CC_VERSION).gmk
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/common/shared/Defs-bsd.gmk	Wed Aug 20 10:30:26 2008 -0700
@@ -0,0 +1,139 @@
+#
+# Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# This code 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
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+#
+# Definitions for Bsd.
+#
+
+# Default for COMPILER_WARNINGS_FATAL on Bsd (C & C++ compiler warnings)
+ifndef COMPILER_WARNINGS_FATAL
+  COMPILER_WARNINGS_FATAL=false
+endif
+
+# Bsd should use parallel compilation for best build times
+ifndef COMPILE_APPROACH
+  COMPILE_APPROACH = parallel
+endif
+
+# Indication that we are doing an incremental build.
+#    This may trigger the creation of make depend files.
+ifndef INCREMENTAL_BUILD
+  INCREMENTAL_BUILD = false
+endif
+
+# FullPath just makes sure it never ends with a / and no duplicates
+define FullPath
+$(shell cd $1 2> $(DEV_NULL) && pwd)
+endef
+
+# OptFullPath: Absolute path name of a dir that might not initially exist.
+define OptFullPath
+$(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi)
+endef
+
+# Location on system where jdk installs might be
+USRJDKINSTANCES_PATH =/usr/lock
+
+# UNIXCOMMAND_PATH: path to where the most common Unix commands are.
+#  NOTE: Must end with / so that it could be empty, allowing PATH usage.
+ifneq "$(origin ALT_UNIXCOMMAND_PATH)" "undefined"
+  UNIXCOMMAND_PATH :=$(call PrefixPath,$(ALT_UNIXCOMMAND_PATH))
+else
+  UNIXCOMMAND_PATH  = /bin/
+endif
+
+# USRBIN_PATH: path to where the most common Unix commands are.
+#  NOTE: Must end with / so that it could be empty, allowing PATH usage.
+ifneq "$(origin ALT_USRBIN_PATH)" "undefined"
+  USRBIN_PATH :=$(call PrefixPath,$(ALT_USRBIN_PATH))
+else
+  USRBIN_PATH  = /usr/bin/
+endif
+
+# UNIXCCS_PATH: path to where the Solaris ported UNIX commands can be found
+#  NOTE: Must end with / so that it could be empty, allowing PATH usage.
+ifneq "$(origin ALT_UNIXCCS_PATH)" "undefined"
+  UNIXCCS_PATH :=$(call PrefixPath,$(ALT_UNIXCCS_PATH))
+else
+  UNIXCCS_PATH = /usr/ccs/bin/
+endif
+
+# SLASH_JAVA: location of all network accessable files
+ifdef ALT_SLASH_JAVA
+  SLASH_JAVA  :=$(ALT_SLASH_JAVA)
+else
+  SLASH_JAVA  := $(call DirExists,/java,/java,/NOT-SET)
+endif
+
+# JDK_DEVTOOLS_DIR: common path for all the java devtools
+ifdef ALT_JDK_DEVTOOLS_DIR
+  JDK_DEVTOOLS_DIR  =$(ALT_JDK_DEVTOOLS_DIR)
+else
+  JDK_DEVTOOLS_DIR =$(SLASH_JAVA)/devtools
+endif
+
+# COMPILER_PATH: path to where the compiler and tools are installed.
+#  NOTE: Must end with / so that it could be empty, allowing PATH usage.
+ifneq "$(origin ALT_COMPILER_PATH)" "undefined"
+  COMPILER_PATH :=$(call PrefixPath,$(ALT_COMPILER_PATH))
+else
+  COMPILER_PATH  =/usr/bin/
+endif
+
+# DEVTOOLS_PATH: for other tools required for building (such as zip, etc.)
+#  NOTE: Must end with / so that it could be empty, allowing PATH usage.
+ifneq "$(origin ALT_DEVTOOLS_PATH)" "undefined"
+  DEVTOOLS_PATH :=$(call PrefixPath,$(ALT_DEVTOOLS_PATH))
+else
+  DEVTOOLS_PATH =/usr/bin/
+endif
+
+# _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
+# _BOOTDIR2: Second choice
+ifndef ALT_BOOTDIR
+  _BOOTDIR1  =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
+  _BOOTDIR2  =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
+endif
+
+# Import JDK images allow for partial builds, components not built are
+#    imported (or copied from) these import areas when needed.
+
+# BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for 
+#   multiple platforms, e.g. windows-i586, solaris-sparc, bsd-586, etc.
+ifdef ALT_BUILD_JDK_IMPORT_PATH
+  BUILD_JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH))
+else
+  BUILD_JDK_IMPORT_PATH   = $(PROMOTED_BUILD_BINARIES)
+endif
+BUILD_JDK_IMPORT_PATH:=$(call AltCheckValue,BUILD_JDK_IMPORT_PATH)
+
+# JDK_IMPORT_PATH: location of JDK install tree (this version) to import
+ifdef ALT_JDK_IMPORT_PATH
+  JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_JDK_IMPORT_PATH))
+else
+  JDK_IMPORT_PATH   = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT)
+endif
+JDK_IMPORT_PATH:=$(call AltCheckValue,JDK_IMPORT_PATH)
+
--- a/make/common/shared/Defs-utils.gmk	Wed Aug 20 10:18:40 2008 -0700
+++ b/make/common/shared/Defs-utils.gmk	Wed Aug 20 10:30:26 2008 -0700
@@ -53,6 +53,13 @@
   UTILS_DEVTOOL_PATH=$(USRBIN_PATH)
 endif
 
+ifeq ($(PLATFORM),bsd)
+  UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH)
+  UTILS_USR_BIN_PATH=$(USRBIN_PATH)
+  UTILS_CCS_BIN_PATH=$(USRBIN_PATH)
+  UTILS_DEVTOOL_PATH=$(USRBIN_PATH)
+endif
+
 ifeq ($(PLATFORM),solaris)
   UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH)
   UTILS_USR_BIN_PATH=$(UNIXCOMMAND_PATH)
@@ -81,7 +88,11 @@
 ADB            = $(UTILS_COMMAND_PATH)adb
 AR             = $(UTILS_CCS_BIN_PATH)ar
 AS             = $(UTILS_CCS_BIN_PATH)as
+ifeq ($(PLATFORM),bsd)
+BASENAME       = $(UTILS_USR_BIN_PATH)basename
+else
 BASENAME       = $(UTILS_COMMAND_PATH)basename
+endif
 CAT            = $(UTILS_COMMAND_PATH)cat
 CHMOD          = $(UTILS_COMMAND_PATH)chmod
 CMP            = $(UTILS_USR_BIN_PATH)cmp
@@ -96,7 +107,11 @@
 DIRNAME        = $(UTILS_USR_BIN_PATH)dirname
 ECHO           = $(UTILS_COMMAND_PATH)echo
 EGREP          = $(UTILS_COMMAND_PATH)egrep
+ifeq ($(PLATFORM),bsd)
+EXPR           = $(UTILS_COMMAND_PATH)expr
+else
 EXPR           = $(UTILS_USR_BIN_PATH)expr
+endif
 FILE           = $(UTILS_USR_BIN_PATH)file
 FIND           = $(UTILS_USR_BIN_PATH)find
 FMT            = $(UTILS_COMMAND_PATH)fmt
@@ -127,7 +142,11 @@
 RPM            = $(UTILS_COMMAND_PATH)rpm
 RPMBUILD       = $(UTILS_COMMAND_PATH)rpmbuild
 SCCS           = $(UTILS_CCS_BIN_PATH)sccs
+ifeq ($(PLATFORM),bsd)
+SED            = $(UTILS_USR_BIN_PATH)sed
+else
 SED            = $(UTILS_COMMAND_PATH)sed
+endif
 SH             = $(UTILS_COMMAND_PATH)sh
 SHOWREV        = $(UTILS_USR_BIN_PATH)showrev
 SORT           = $(UTILS_COMMAND_PATH)sort
@@ -135,7 +154,11 @@
 TAIL           = $(UTILS_USR_BIN_PATH)tail
 TAR            = $(UTILS_COMMAND_PATH)tar
 TEST           = $(UTILS_USR_BIN_PATH)test
+ifeq ($(PLATFORM),bsd)
+TOUCH          = $(UTILS_USR_BIN_PATH)touch
+else
 TOUCH          = $(UTILS_COMMAND_PATH)touch
+endif
 TR             = $(UTILS_USR_BIN_PATH)tr
 TRUE           = $(UTILS_COMMAND_PATH)true
 UNAME          = $(UTILS_COMMAND_PATH)uname
@@ -209,3 +232,7 @@
   ECHO           = /usr/bin/echo
 endif
 
+# BSD specific
+ifeq ($(SYSTEM_UNAME),Darwin)
+  NAWK = $(USRBIN_PATH)awk
+endif
--- a/make/common/shared/Platform.gmk	Wed Aug 20 10:18:40 2008 -0700
+++ b/make/common/shared/Platform.gmk	Wed Aug 20 10:30:26 2008 -0700
@@ -262,6 +262,80 @@
   MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2)
 endif
 
+ifeq ($(SYSTEM_UNAME), FreeBSD)
+  PLATFORM = bsd
+  OS_NAME = freebsd
+  OS_VENDOR = FreeBSD
+ REQUIRED_OS_VERSION = 6.0
+endif
+
+ifeq ($(SYSTEM_UNAME), Darwin)
+  PLATFORM = bsd
+  OS_NAME = darwin
+  OS_VENDOR = Apple
+ REQUIRED_OS_VERSION = 8.0
+endif
+
+ifeq ($(SYSTEM_UNAME), NetBSD)
+  PLATFORM = bsd
+  OS_NAME = netbsd
+  OS_VENDOR = NetBSD
+  REQUIRED_OS_VERSION = 3.0
+endif
+
+ifeq ($(SYSTEM_UNAME), OpenBSD)
+  PLATFORM = bsd
+  OS_NAME = openbsd
+  OS_VENDOR = OpenBSD
+  REQUIRED_OS_VERSION = 4.2
+endif
+
+# Platform settings specific to BSD
+ifeq ($(PLATFORM), bsd)
+  OS_VERSION := $(shell uname -r)
+  # Arch and OS name/version
+  mach := $(shell uname -m)
+  archExpr = case "$(mach)" in \
+                i[3-9]86) \
+                    echo i586 \
+                    ;; \
+                *) \
+                    echo $(mach) \
+                    ;; \
+      esac
+  ARCH        := $(shell $(archExpr) )
+  ARCH_FAMILY := $(ARCH)
+
+  # i586 and sparc are 32 bit, amd64 and sparc64 are 64
+  ifneq (,$(findstring $(ARCH), i586 sparc))
+    ARCH_DATA_MODEL=32
+  else
+    ARCH_DATA_MODEL=64
+  endif
+
+  # Need to maintain the jre/lib/i386 location for 32-bit Intel
+  ifeq ($(ARCH), i586)
+    LIBARCH = i386
+  else
+    LIBARCH = $(ARCH)
+  endif
+
+  # Value of Java os.arch property
+  ARCHPROP  = $(LIBARCH)
+
+  # Suffix for file bundles used in previous release
+  BUNDLE_FILE_SUFFIX=.tar.gz
+  # Minimum disk space needed as determined by running 'du -sk' on 
+  #    a fully built workspace.
+  REQUIRED_FREE_SPACE=1500000
+  # How much RAM does this machine have:
+  ifeq ($(OS_VENDOR), OpenBSD)
+    MB_OF_MEMORY=$(shell perl -e 'printf "%d", `sysctl hw.physmem | cut -d'=' -f2` / 1048576' )
+  else
+    MB_OF_MEMORY=$(shell sysctl hw.physmem | awk '{print int($$NF / 1048576); }' )
+  endif
+endif
+
 # Windows with and without CYGWIN will be slightly different
 ifeq ($(SYSTEM_UNAME), Windows_NT)
   PLATFORM = windows
--- a/make/sun/corba/core/Makefile	Wed Aug 20 10:18:40 2008 -0700
+++ b/make/sun/corba/core/Makefile	Wed Aug 20 10:30:26 2008 -0700
@@ -53,11 +53,19 @@
 ifdef STANDALONE_CORBA_WS
 # FIXUP: What is this all about?
 OTHER_LDFLAGS=-L$(BOOTDIR)/jre/lib/$(ARCH) -L$(BOOTDIR)/jre/lib/$(LIBARCH)/native_threads -ljvm
+ifeq ($(PLATFORM), bsd)
+OTHER_INCLUDES+=-ICClassHeaders -I$(BOOTDIR)/include -I$(BOOTDIR)/include/$(OS_NAME)
+else
 OTHER_INCLUDES+=-ICClassHeaders -I$(BOOTDIR)/include -I$(BOOTDIR)/include/$(PLATFORM)
+endif
 else
 OTHER_LDLIBS=$(JVMLIB)
+ifeq ($(PLATFORM), bsd)
+OTHER_INCLUDES+=-ICClassHeaders -I$(BOOTDIR)/include -I$(BOOTDIR)/include/$(OS_NAME)
+else
 OTHER_INCLUDES+=-ICClassHeaders -I$(BOOTDIR)/include -I$(BOOTDIR)/include/$(PLATFORM)
 endif
+endif
 
 
 FILES_c = ioser.c