% $OpenBSD: OpenBSD,v 1.1.1.1 2002/02/23 12:30:21 naddy Exp $
%
% Common code to all OpenBSD configurations
%

% Let the user override INSTALL_ROOT/X11ROOT

if not defined("PREFIX")
PREFIX = "/usr/local"
end
if not defined("X11BASE")
X11BASE = "/usr/X11R6"
end
if not defined("SL")
SL = "/"
end

INSTALL_ROOT = PREFIX
X11ROOT = X11BASE & SL & "lib"

PLATFORM_SUPPORTS_MOTIF  = ""
INSTALL_IMPLS = ""
SKIP_M3GDB = "T"
SKIP_GNUEMACS = "T"

BOPT_FLAG = "-O2"
BPIC_FLAG = ["-O2", "-fPIC"]
CC = ["cc","-c"]
GNU_CC = "cc"
GNU_CFLAGS = []
LINK = ["cc"]
MAKELIB = [ "ar", "cru" ]
MAKESHLIB = ["cc","-shared", "-fPIC"]
M3CC_MAKE = ["gmake", "BISON=yacc"]
OPT_FLAG = "-O2"
RANLIB = ["ranlib"]
RPATH_FLAG = "-R"
RPATH_prefix = ""
RPATH_LIB_USE_ONLY = "T"

% OpenBSD/a.out requires a major and minor 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 = "0.1"

proc m3_make_shared_lib (lib, objects, imported_libs) is
  local lib_sox = format ("lib%s.so.%s", lib, SHLIB_VERSION)
  local cmd = [MAKESHLIB_CMD, "-o", 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_sox = format ("lib%s.so.%s", lib, SHLIB_VERSION)

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

setDefault("","")
