% cm3 config file readonly TARGET = "GENTOO_TARGET" if M3_PROFILING readonly BUILD_DIR = TARGET & "p" else readonly BUILD_DIR = TARGET end readonly OS_TYPE = "POSIX" readonly WORD_SIZE = "32BITS" readonly GNU_PLATFORM = "GENTOO_GNU_PLATFORM" readonly NAMING_CONVENTIONS = "0" proc set_config_options () is m3_option ("-why") m3_debug (TRUE) M3_OPTIONS += "-w1" end INITIAL_REACTOR_EDITOR = "GENTOO_INITIAL_REACTOR_EDITOR" ROOT="GENTOO_ROOT" INSTALL_ROOT = "GENTOO_INSTALL_ROOT" BIN_INSTALL = INSTALL_ROOT & "/bin" if M3_PROFILING LIB_INSTALL = INSTALL_ROOT & "/libp" else LIB_INSTALL = INSTALL_ROOT & "/lib" end PKG_INSTALL = INSTALL_ROOT & "/pkg" DOC_INSTALL = INSTALL_ROOT & "/doc" EMACS_INSTALL = INSTALL_ROOT & "/elisp" MAN_INSTALL = INSTALL_ROOT & "/man" HTML_INSTALL = INSTALL_ROOT & "/www" USE_ROOT = INSTALL_ROOT BIN_USE = BIN_INSTALL LIB_USE = LIB_INSTALL PKG_USE = PKG_INSTALL readonly INSTALL_IMPLS = TRUE SYSTEM_LIBS = { "LIBC" : [ "-lm" ], "FLEX-BISON" : [ "-lfl" ], "OPENGL" : [ "-lGLU", "-lGL", "-lXext" ], "MOTIF" : [ "-lXm" ], "X11" : [ "-lXaw", "-lXmu", "-lXext", "-lXt", "-lSM", "-lICE", "-lX11" ], % "POSTGRES95" : [ ] % "ODBC" : [ ] "TCP" : [ ] } SYSTEM_LIBORDER = [ "OPENGL", "DECPEX", "MOTIF", "X11", "TCP", "ODBC", "POSTGRES95", "FLEX-BISON", "LEX-YACC", "LIBC" ] readonly SYSTEM_CC = "gcc" readonly SYSTEM_AR = "ar" readonly SYSTEM_ASM = "as" readonly m3back = "@" & BIN_USE & "/cm3cg" proc m3_backend (source, object, optimize, debug) is local args = [ "-quiet", source, "-o", object ] if optimize args += "-O" end if debug args += "-g" end if M3_PROFILING args += "-p" end return try_exec (m3back, args) end M3_BACKEND_MODE = "3" proc compile_c (source, object, options, optimize, debug) is local args = [ "-fPIC", options ] if optimize args += "-O" end if debug args += "-g" end if M3_PROFILING args += "-pg" end return try_exec ("@" & SYSTEM_CC, args, "-c", source) end proc assemble (source, object) is return try_exec ("@" & SYSTEM_ASM, source, "-o", object) end GCWRAPFLAGS = "-Wl,--wrap,adjtime,--wrap,getdirentries,--wrap,readv,--wrap,utimes,--wrap,wait3" proc make_lib (lib, options, objects, imported_libs, shared) is local ret_code = 0 local lib_a = format ("lib%s.a", lib) local lib_so = format ("lib%s.so", lib) local lib_sox = format ("lib%s.so.5", lib) % first, build the non-shared library ret_code = try_exec ("@/usr/bin/ar", "crus", lib_a, objects) if not equal (ret_code, 0) return ret_code end if shared % build the shared library if M3_PROFILING ret_code = try_exec ("@" & SYSTEM_CC, "-pg -shared " & GCWRAPFLAGS & "-Wl,-soname," & lib_sox, "-o", lib_sox, objects) else ret_code = try_exec ("@" & SYSTEM_CC, "-shared " & GCWRAPFLAGS & "-Wl,-soname," & lib_sox, "-o", lib_sox, objects) end if not equal (ret_code, 0) return ret_code end % create the version aliases link_file(lib_sox, lib_so) % finally, make sure the shared library stuff gets installed properly install_derived (lib_sox) install_derived_link (lib_sox, lib_so) install_link_to_derived (lib_sox, LIB_INSTALL) install_link_to_derived (lib_so, LIB_INSTALL) else delete_file (lib_so) delete_file (lib_sox) end return 0 end proc skip_lib (lib, shared) is local lib_so = format ("lib%s.so", lib) local lib_sox = format ("lib%s.so.5", lib) if shared % make sure the shared library stuff gets installed properly install_derived (lib_sox) install_derived (lib_so) install_link_to_derived (lib_sox, LIB_INSTALL) install_link_to_derived (lib_so, LIB_INSTALL) else delete_file (lib_so) delete_file (lib_sox) end return 0 end proc m3_link (prog, options, objects, imported_libs, shared) is local args = [] if M3_PROFILING args += "-pg" end args += [ "-o", prog, options, objects, imported_libs ] if shared return try_exec ("@" & SYSTEM_CC, args, GCWRAPFLAGS) else return try_exec ("@" & SYSTEM_CC, "-static", args, GCWRAPFLAGS) %%% -- see M3_NEED_STANDALONE_LINKS below %%%return try_exec ("@" & SYSTEM_CC, args) end end proc skip_link (prog, shared) is return 0 end M3_FRONT_FLAGS = [ ] M3_OPTIONS = [ ] % M3_KEEP_FILES = TRUE M3_WINDOWS_GUI = FALSE % M3_COVERAGE = TRUE M3_COVERAGE_LIB = LIB_USE & "/report_coverage.o" M3_SPLIT_LIBNAMES = TRUE M3_SHARED_LIB_ARG = "-Wl,-R" % M3_BOOTSTRAP = TRUE % M3_COMPILE_ONCE = TRUE % SYS_HAS_LOADER = TRUE % M3_SKIP_LINK = TRUE % M3_MAIN_IN_C = TRUE % X11_WITH_SHARED_MEM = TRUE %M3_NEED_STANDALONE_LINKS = TRUE GNU_CC = "GENTOO_GNU_CC" GNU_CFLAGS = "GENTOO_GNU_CFLAGS" GNU_MAKE = "GENTOO_GNU_MAKE"