From d80ed7114045527c832bbc13ca763af65bb130eb Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Tue, 7 Jul 2009 17:14:13 +0000
Subject: [PATCH] Add new config for sparc/solaris, matching what was done for
 x86.  The sun4_solaris_gcc and sun4_solaris_sunc configs are now obsolete,
 but we leave the around for now.

Tested both configs and they work.

lisp/Config.sparc_common:
o New file for common config for gcc and Sun C builds on Solaris

lisp/Config.sparc_gcc:
o New file for building on sparc/solaris with gcc

lisp/Config.sparc_sunc:
o New file for building on sparc/solaris with Sun C

tools/create-target.sh:
o Change default from sun4_solaris_gcc to sparc_gcc to use new
  configuration.
---
 lisp/Config.sparc_common | 42 ++++++++++++++++++++++++++++++++++++++++
 lisp/Config.sparc_gcc    | 30 ++++++++++++++++++++++++++++
 lisp/Config.sparc_sunc   | 24 +++++++++++++++++++++++
 tools/create-target.sh   |  4 ++--
 4 files changed, 98 insertions(+), 2 deletions(-)
 create mode 100644 lisp/Config.sparc_common
 create mode 100644 lisp/Config.sparc_gcc
 create mode 100644 lisp/Config.sparc_sunc

diff --git a/lisp/Config.sparc_common b/lisp/Config.sparc_common
new file mode 100644
index 000000000..c09012c59
--- /dev/null
+++ b/lisp/Config.sparc_common
@@ -0,0 +1,42 @@
+# -*- Mode: makefile -*-
+
+# Common configuration for sparc/solaris builds.
+
+# These tell gmake where to look for .h, .c and .S files.  Mostly for
+# building the binary outside of the src tree.
+
+PATH1 = ../../src/lisp
+vpath %.h .:$(PATH1)
+vpath %.c .:$(PATH1)
+vpath %.S .:$(PATH1)
+
+# Enable support for :linkage-table feature.
+
+ifdef FEATURE_LINKAGE_TABLE
+LINKAGE = -DLINKAGE_TABLE
+endif
+
+# Enable support for generational GC
+ifdef FEATURE_GENCGC
+GENCGC = -DGENCGC
+GC_SRC = gencgc.c
+endif
+
+# Enable support for Unicode
+ifdef FEATURE_UNICODE
+UNICODE = -DUNICODE
+endif
+
+CPPFLAGS = -I. -I$(PATH1) -DSOLARIS -DSVR4 $(CC_V8PLUS) $(LINKAGE) $(GENCGC) $(UNICODE)
+
+
+CFLAGS = -g $(CC_V8PLUS)
+
+NM = $(PATH1)/solaris-nm
+ASSEM_SRC = sparc-assem.S
+ARCH_SRC = sparc-arch.c
+
+DEPEND=$(CC) 
+OS_SRC = solaris-os.c os-common.c undefineds.c elf.c k_rem_pio2.c
+OS_LINK_FLAGS=
+OS_LIBS= -lsocket -lnsl -ldl
diff --git a/lisp/Config.sparc_gcc b/lisp/Config.sparc_gcc
new file mode 100644
index 000000000..b0d27add4
--- /dev/null
+++ b/lisp/Config.sparc_gcc
@@ -0,0 +1,30 @@
+# -*- Mode: makefile -*-
+
+include Config.sparc_common
+
+# For v8plus support (allows 64-bit integer support on V9
+# architectures), uncomment the definitions for CC_V8PLUS and
+# AS_V8PLUS.  The -Wa,xarch=v8plus option tells the assembler to
+# accept v8plus instructions and generate a v8plus object files and
+# executable.
+#
+# However, we should also make sure the binary is marked as v8plus by
+# enabling AS_V8PLUS whenever we have the :sparc-v9 *feature* enabled
+# because we really are a v8plus application by using some of the v9
+# instructions, even if we don't use the 64-bit registers.
+
+#CC_V8PLUS = -xarch=v8plus
+ifdef FEATURE_SPARC_V9
+AS_V8PLUS = -Wa,-xarch=v8plus
+endif
+
+# Note: If you want to be able to use gdb with cmucl, you need to use
+# gdb 4.18 (or earlier?) or use gdb 6.8.  Versions 5.x and later
+# (including 6.3) appear to be incapable of passing signals (SIGILL
+# and SIGSEGV) to lisp properly.
+#
+
+CC = gcc -O -Wall
+CPP = gcc -E
+DEPEND_FLAGS = -MM -traditional-cpp
+ASFLAGS = -g -traditional-cpp $(AS_V8PLUS)
diff --git a/lisp/Config.sparc_sunc b/lisp/Config.sparc_sunc
new file mode 100644
index 000000000..596eaf6b6
--- /dev/null
+++ b/lisp/Config.sparc_sunc
@@ -0,0 +1,24 @@
+# -*- Mode: makefile -*-
+
+include Config.sparc_common
+
+# For v8plus support (allows 64-bit integer support on V9
+# architectures), uncomment the definitions for CC_V8PLUS and
+# AS_V8PLUS.  The -Wa,xarch=v8plus option tells the assembler to
+# accept v8plus instructions and generate a v8plus object files and
+# executable.
+#
+# However, we should also make sure the binary is marked as v8plus by
+# enabling AS_V8PLUS whenever we have the :sparc-v9 *feature* enabled
+# because we really are a v8plus application by using some of the v9
+# instructions, even if we don't use the 64-bit registers.
+
+ifdef FEATURE_SPARC_V9
+CC_V8PLUS = -xarch=v8plus
+AS_V8PLUS = -xarch=v8plus
+endif
+
+CC = cc -xlibmieee -O
+CPP = cc -E
+DEPEND_FLAGS = -xM
+ASFLAGS = $(AS_V8PLUS)
diff --git a/tools/create-target.sh b/tools/create-target.sh
index d7c737a3b..6da07c9fb 100755
--- a/tools/create-target.sh
+++ b/tools/create-target.sh
@@ -26,7 +26,7 @@ if [ $# = 1 ]; then
     # Only target directory given.  Try to deduce the lisp-variant
     TARGET_DIR="$1"
     case `uname -s` in
-    SunOS) LISP_VARIANT=sun4_solaris_gcc ;;
+    SunOS) LISP_VARIANT=sparc_gcc ;;
     Linux) LISP_VARIANT=x86_linux ;;
     Darwin) case `uname -m` in
             ppc) LISP_VARIANT=ppc_darwin ;;
@@ -70,7 +70,7 @@ if [ "$MOTIF_VARIANT" = "" ]; then
       NetBSD*) MOTIF_VARIANT=NetBSD ;;
       OpenBSD*) MOTIF_VARIANT=OpenBSD ;;
       *_darwin) MOTIF_VARIANT=Darwin ;;
-      sun4_solaris*) MOTIF_VARIANT=solaris ;;
+      sun4_solaris*|sparc*) MOTIF_VARIANT=solaris ;;
       sun4c*) MOTIF_VARIANT=sun4c_411 ;;
       hp700*) MOTIF_VARIANT=hpux_cc ;;
       pmax_mach) MOTIF_VARIANT=pmax_mach ;;
-- 
GitLab