%
% FreeBSD/Sparc64 5.x configuration.
%

readonly TARGET = "FBSD_SPARC64"

include("COMMON")

INSTALL_ROOT = "/usr/local"
X11ROOT = "/usr/X11R6/lib"

PLATFORM_SUPPORTS_MOTIF  = ""
PLATFORM_SUPPORTS_SHARED_LIB = "T"
INSTALL_IMPLS = ""
SKIP_M3GDB = "T"
SKIP_GNUEMACS = "T"
NO_ST_SPARE = "T"

CC = ["cc","-c"]
GNU_CC = "cc"
LINK = ["cc"]
MAKELIB = [ "ar", "cru" ]
MAKESHLIB = ["cc","-shared"]
RANLIB = ["ranlib"]
RPATH_FLAG = "-R"
RPATH_prefix = ""
RPATH_LIB_USE_ONLY = "T"

% FreeBSD requires a version number on each shared library.  Don't try
% to derive these from the PM3 version number.  That approach does not
% work out well in practice.
SHLIB_VERSION = "7"

proc m3_make_shared_lib (lib, objects, imported_libs) is
  local lib_so = format ("lib%s.so", lib)
  local lib_sox = format ("%s.%s", lib_so, SHLIB_VERSION)
  local cmd = [MAKESHLIB_CMD, "-o", lib_so, "-Wl,-soname," & lib_sox, objects]
  
  if VERBOSE write(cmd, CR) end  
  return exec(cmd)
end

proc m3_note_shlib(lib) is
  if Options{"shared_lib"}[0] and PLATFORM_SUPPORTS_SHARED_LIB
    local lib_so = format ("lib%s.so", lib)
    local lib_sox = format ("%s.%s", lib_so, SHLIB_VERSION)

    if defined ("_all")
      install_derived(lib_so)
      install_alias_link(lib_so,
	LIB_TO_PKG_USE & SL & PACKAGE & SL & BUILD_DIR, lib_sox, LIB_INSTALL)
    end
    deriveds (lib_so, [""])
  end
end 

setDefault("","")
