%
% FreeBSD 2.0 configuration (with shared library support in comments)
%

readonly TARGET = "FreeBSD2"

include("COMMON")

%INSTALL_ROOT = "/usr/local"
X11ROOT = "/usr/X386/lib"

readonly PLATFORM_SUPPORTS_MOTIF  = "TRUE"

MAKELIB = [ "/usr/bin/ar", "cru" ]
MAKESHLIB = [ "/usr/bin/ld", "-Bshareable",  "-assert",  "pure-text" ]

DYNAMIC_FLAG = [ "-Xlinker", "-Bdynamic" ]

setDefault("","")

proc m3_make_lib (lib, objects, imported_libs) is
  local ret = 0

  if Options{"static_lib"}[0]
    local lib_a    = format ("lib%s.a", lib)
    local cmd = [ MAKELIB_CMD, lib_a, objects, imported_libs ]
    if VERBOSE write(cmd, CR) end
    ret = exec (cmd)
    if not equal(ret, 0) return ret end
    cmd = [ RANLIB_CMD, lib_a ]
    if VERBOSE write(cmd, CR) end
    ret = exec (cmd)
  end

  if Options{"shared_lib"}[0] and PLATFORM_SUPPORTS_SHARED_LIB
    local lib_soxx = format ("lib%s.so.3.6", lib)
    local cmd = [MAKESHLIB_CMD, "-o", lib_soxx, objects]

    if VERBOSE write(cmd, CR) end
    ret = exec (cmd)
    if not equal(ret, 0) return ret end
  end
  return ret
end

proc m3_note_shlib(lib) is
  local lib_soxx = format ("lib%s.so.3.6", lib)
  if defined ("_all")
    install_derived (lib_soxx)
    install_link_to_derived (lib_soxx, LIB_INSTALL)
  end
  deriveds (lib_soxx, [""])
end

