OSDN Git Service

Simplify libgo Makefile conditionals.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Jan 2011 02:03:46 +0000 (02:03 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Jan 2011 02:03:46 +0000 (02:03 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168696 138bc75d-0d04-0410-961f-82ee72b054a4

13 files changed:
libgo/Makefile.am
libgo/Makefile.in
libgo/configure
libgo/configure.ac
libgo/go/debug/proc/proc_rtems.go [new file with mode: 0644]
libgo/go/debug/proc/regs_rtems_386.go [new file with mode: 0644]
libgo/go/debug/proc/regs_rtems_amd64.go [new file with mode: 0644]
libgo/syscalls/syscall_linux_386.go
libgo/syscalls/syscall_linux_amd64.go
libgo/syscalls/syscall_rtems.go [new file with mode: 0644]
libgo/syscalls/syscall_rtems_386.go [new file with mode: 0644]
libgo/syscalls/syscall_rtems_amd64.go [new file with mode: 0644]
libgo/testsuite/Makefile.in

index f5bb774..f7a0da0 100644 (file)
@@ -682,38 +682,6 @@ go_runtime_files = \
        go/runtime/type.go \
        version.go
 
-if LIBGO_IS_386
-GOARCH = 386
-else
-if LIBGO_IS_X86_64
-GOARCH = amd64
-else
-if LIBGO_IS_ARM
-GOARCH = arm
-else
-GOARCH = unknown
-endif
-endif
-endif
-
-if LIBGO_IS_LINUX
-GOOS = linux
-else
-if LIBGO_IS_DARWIN
-GOOS = darwin
-else
-if LIBGO_IS_FREEBSD
-GOOS = freebsd
-else
-if LIBGO_IS_RTEMS
-GOOS = rtems
-else
-GOOS = unknown
-endif
-endif
-endif
-endif
-
 version.go: s-version; @true
 s-version: Makefile
        rm -f version.go.tmp
@@ -930,52 +898,10 @@ go_debug_pe_files = \
        go/debug/pe/file.go \
        go/debug/pe/pe.go
 
-if LIBGO_IS_LINUX
-proc_file = go/debug/proc/proc_linux.go
-if LIBGO_IS_386
-regs_file = go/debug/proc/regs_linux_386.go
-else
-if LIBGO_IS_X86_64
-regs_file = go/debug/proc/regs_linux_amd64.go
-else
-regs_file =
-endif
-endif
-else
-if LIBGO_IS_DARWIN
-proc_file = go/debug/proc/proc_darwin.go
-if LIBGO_IS_386
-regs_file = go/debug/proc/regs_darwin_386.go
-else
-if LIBGO_IS_X86_64
-regs_file = go/debug/proc/regs_darwin_amd64.go
-else
-regs_file =
-endif
-endif
-else
-if LIBGO_IS_FREEBSD
-proc_file = go/debug/proc/proc_freebsd.go
-if LIBGO_IS_386
-regs_file = go/debug/proc/regs_freebsd_386.go
-else
-if LIBGO_IS_X86_64
-regs_file = go/debug/proc/regs_freebsd_amd64.go
-else
-regs_file =
-endif
-endif
-else
-proc_file =
-regs_file =
-endif
-endif
-endif
-
 go_debug_proc_files = \
        go/debug/proc/proc.go \
-       $(proc_file) \
-       $(regs_file)
+       go/debug/proc/proc_$(GOOS).go \
+       go/debug/proc/regs_$(GOOS)_$(GOARCH).go
 
 go_encoding_ascii85_files = \
        go/encoding/ascii85/ascii85.go
@@ -1093,26 +1019,10 @@ go_testing_quick_files = \
 go_testing_script_files = \
        go/testing/script/script.go
 
-if LIBGO_IS_LINUX
-syscall_os_file = syscalls/syscall_linux.go
-if LIBGO_IS_386
-syscall_arch_file = syscalls/syscall_linux_386.go
-else
-if LIBGO_IS_X86_64
-syscall_arch_file = syscalls/syscall_linux_amd64.go
-else
-syscall_arch_file =
-endif
-endif
-else
-syscall_os_file =
-syscall_arch_file =
-endif
-
 if LIBGO_IS_RTEMS
 syscall_exec_os_file = syscalls/exec_stubs.go
 syscall_socket_os_file = syscalls/socket_bsd.go
-syscall_socket_epoll_file=
+syscall_socket_epoll_file =
 syscall_sysfile_os_file = syscalls/sysfile_rtems.go
 syscall_syscall_file = syscalls/syscall_stubs.go
 syscall_errstr_file = syscalls/errstr_rtems.go
@@ -1131,6 +1041,14 @@ syscall_errstr_decl_file = syscalls/errstr_decl.go
 endif
 endif
 
+syscall_arch.go: s-syscall_arch; @true
+s-syscall_arch: Makefile
+       rm -f syscall_arch.go.tmp
+       echo "package syscall" > syscall_arch.go.tmp
+       echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
+       $(SHELL) $(srcdir)/../move-if-change syscall_arch.go.tmp syscall_arch.go
+       $(STAMP) $@
+
 go_syscall_files = \
        $(syscall_errstr_file) \
        $(syscall_errstr_decl_file) \
@@ -1142,11 +1060,12 @@ go_syscall_files = \
        $(syscall_syscall_file) \
        syscalls/syscall_unix.go \
        syscalls/stringbyte.go \
-       $(syscall_os_file) \
-       $(syscall_arch_file) \
+       syscalls/syscall_$(GOOS).go \
+       syscalls/syscall_$(GOOS)_$(GOARCH).go \
        syscalls/sysfile_posix.go \
        $(syscall_sysfile_os_file) \
-       sysinfo.go
+       sysinfo.go \
+       syscall_arch.go
 go_syscall_c_files = \
        syscalls/errno.c
 
index 64a5f9a..383b825 100644 (file)
@@ -305,8 +305,10 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
+GOARCH = @GOARCH@
 GOC = @GOC@
 GOCFLAGS = $(CFLAGS)
+GOOS = @GOOS@
 GREP = @GREP@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -1019,15 +1021,6 @@ go_runtime_files = \
        go/runtime/type.go \
        version.go
 
-@LIBGO_IS_386_FALSE@@LIBGO_IS_ARM_FALSE@@LIBGO_IS_X86_64_FALSE@GOARCH = unknown
-@LIBGO_IS_386_FALSE@@LIBGO_IS_ARM_TRUE@@LIBGO_IS_X86_64_FALSE@GOARCH = arm
-@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_TRUE@GOARCH = amd64
-@LIBGO_IS_386_TRUE@GOARCH = 386
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@GOOS = unknown
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_TRUE@GOOS = rtems
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@GOOS = freebsd
-@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@GOOS = darwin
-@LIBGO_IS_LINUX_TRUE@GOOS = linux
 go_scanner_files = \
        go/scanner/scanner.go
 
@@ -1256,24 +1249,10 @@ go_debug_pe_files = \
        go/debug/pe/file.go \
        go/debug/pe/pe.go
 
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@proc_file = 
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@proc_file = go/debug/proc/proc_freebsd.go
-@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@proc_file = go/debug/proc/proc_darwin.go
-@LIBGO_IS_LINUX_TRUE@proc_file = go/debug/proc/proc_linux.go
-@LIBGO_IS_386_FALSE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_X86_64_FALSE@regs_file = 
-@LIBGO_IS_386_FALSE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_X86_64_TRUE@regs_file = go/debug/proc/regs_freebsd_amd64.go
-@LIBGO_IS_386_FALSE@@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_X86_64_FALSE@regs_file = 
-@LIBGO_IS_386_FALSE@@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_X86_64_TRUE@regs_file = go/debug/proc/regs_darwin_amd64.go
-@LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_X86_64_FALSE@regs_file = 
-@LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_X86_64_TRUE@regs_file = go/debug/proc/regs_linux_amd64.go
-@LIBGO_IS_386_TRUE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@regs_file = go/debug/proc/regs_freebsd_386.go
-@LIBGO_IS_386_TRUE@@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@regs_file = go/debug/proc/regs_darwin_386.go
-@LIBGO_IS_386_TRUE@@LIBGO_IS_LINUX_TRUE@regs_file = go/debug/proc/regs_linux_386.go
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@regs_file = 
 go_debug_proc_files = \
        go/debug/proc/proc.go \
-       $(proc_file) \
-       $(regs_file)
+       go/debug/proc/proc_$(GOOS).go \
+       go/debug/proc/regs_$(GOOS)_$(GOARCH).go
 
 go_encoding_ascii85_files = \
        go/encoding/ascii85/ascii85.go
@@ -1408,12 +1387,6 @@ go_testing_quick_files = \
 go_testing_script_files = \
        go/testing/script/script.go
 
-@LIBGO_IS_LINUX_FALSE@syscall_os_file = 
-@LIBGO_IS_LINUX_TRUE@syscall_os_file = syscalls/syscall_linux.go
-@LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_X86_64_FALSE@syscall_arch_file = 
-@LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_X86_64_TRUE@syscall_arch_file = syscalls/syscall_linux_amd64.go
-@LIBGO_IS_386_TRUE@@LIBGO_IS_LINUX_TRUE@syscall_arch_file = syscalls/syscall_linux_386.go
-@LIBGO_IS_LINUX_FALSE@syscall_arch_file = 
 @LIBGO_IS_RTEMS_FALSE@syscall_exec_os_file = syscalls/exec.go
 @LIBGO_IS_RTEMS_TRUE@syscall_exec_os_file = syscalls/exec_stubs.go
 @LIBGO_IS_RTEMS_FALSE@syscall_socket_os_file = syscalls/socket_linux.go
@@ -1440,11 +1413,12 @@ go_syscall_files = \
        $(syscall_syscall_file) \
        syscalls/syscall_unix.go \
        syscalls/stringbyte.go \
-       $(syscall_os_file) \
-       $(syscall_arch_file) \
+       syscalls/syscall_$(GOOS).go \
+       syscalls/syscall_$(GOOS)_$(GOARCH).go \
        syscalls/sysfile_posix.go \
        $(syscall_sysfile_os_file) \
-       sysinfo.go
+       sysinfo.go \
+       syscall_arch.go
 
 go_syscall_c_files = \
        syscalls/errno.c
@@ -3622,6 +3596,14 @@ s-version: Makefile
        $(SHELL) $(srcdir)/../move-if-change version.go.tmp version.go
        $(STAMP) $@
 
+syscall_arch.go: s-syscall_arch; @true
+s-syscall_arch: Makefile
+       rm -f syscall_arch.go.tmp
+       echo "package syscall" > syscall_arch.go.tmp
+       echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
+       $(SHELL) $(srcdir)/../move-if-change syscall_arch.go.tmp syscall_arch.go
+       $(STAMP) $@
+
 # Build a .la file from a .a file.
 .a.la:
        $(LINK) $<.lo
index cef86b2..461aea3 100644 (file)
@@ -611,12 +611,14 @@ MATH_LIBS
 USING_SPLIT_STACK_FALSE
 USING_SPLIT_STACK_TRUE
 SPLIT_STACK
+GOARCH
 LIBGO_IS_ARM_FALSE
 LIBGO_IS_ARM_TRUE
 LIBGO_IS_X86_64_FALSE
 LIBGO_IS_X86_64_TRUE
 LIBGO_IS_386_FALSE
 LIBGO_IS_386_TRUE
+GOOS
 LIBGO_IS_RTEMS_FALSE
 LIBGO_IS_RTEMS_TRUE
 LIBGO_IS_LINUX_FALSE
@@ -10869,7 +10871,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10872 "configure"
+#line 10874 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10975,7 +10977,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10978 "configure"
+#line 10980 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13190,11 +13192,12 @@ is_darwin=no
 is_freebsd=no
 is_linux=no
 is_rtems=no
+GOOS=unknown
 case ${host} in
-  *-*-darwin*) is_darwin=yes ;;
-  *-*-freebsd*) is_freebsd=yes ;;
-  *-*-linux*)  is_linux=yes  ;;
-  *-*-rtems*)  is_rtems=yes  ;;
+  *-*-darwin*) is_darwin=yes; GOOS=darwin ;;
+  *-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;;
+  *-*-linux*)  is_linux=yes; GOOS=linux  ;;
+  *-*-rtems*)  is_rtems=yes; GOOS=rtems  ;;
 esac
  if test $is_darwin = yes; then
   LIBGO_IS_DARWIN_TRUE=
@@ -13229,22 +13232,35 @@ else
 fi
 
 
+
 is_386=no
 is_x86_64=no
 is_arm=no
+GOARCH=unknown
 case ${host} in
-  i[34567]86-*-*)
-    is_386=yes
-    ;;
-  x86_64-*-*)
-    if test "$with_multisubdir" = "32"; then
-      is_386=yes
+  i[34567]86-*-* | x86_64-*-*)
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef __x86_64__
+#error 64-bit
+#endif
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  is_386=yes
+else
+  is_x86_64=yes
+fi
+rm -f conftest.err conftest.$ac_ext
+    if test "$is_386" = "yes"; then
+      GOARCH=386
     else
-      is_x86_64=yes
+      GOARCH=amd64
     fi
     ;;
   arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
     is_arm=yes
+    GOARCH=arm
     ;;
 esac
  if test $is_386 = yes; then
@@ -13272,6 +13288,7 @@ else
 fi
 
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fsplit-stack is supported" >&5
 $as_echo_n "checking whether -fsplit-stack is supported... " >&6; }
 if test "${ac_cv_libgo_split_stack_supported+set}" = set; then :
index d2cc290..42e379d 100644 (file)
@@ -116,40 +116,47 @@ is_darwin=no
 is_freebsd=no
 is_linux=no
 is_rtems=no
+GOOS=unknown
 case ${host} in
-  *-*-darwin*) is_darwin=yes ;;
-  *-*-freebsd*) is_freebsd=yes ;;
-  *-*-linux*)  is_linux=yes  ;;
-  *-*-rtems*)  is_rtems=yes  ;;
+  *-*-darwin*) is_darwin=yes; GOOS=darwin ;;
+  *-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;;
+  *-*-linux*)  is_linux=yes; GOOS=linux  ;;
+  *-*-rtems*)  is_rtems=yes; GOOS=rtems  ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes)
 AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes)
 AM_CONDITIONAL(LIBGO_IS_LINUX, test $is_linux = yes)
 AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes)
+AC_SUBST(GOOS)
 
 is_386=no
 is_x86_64=no
 is_arm=no
+GOARCH=unknown
 case ${host} in
 changequote(,)dnl
-  i[34567]86-*-*)
+  i[34567]86-*-* | x86_64-*-*)
 changequote([,])dnl
-    is_386=yes
-    ;;
-  x86_64-*-*)
-    if test "$with_multisubdir" = "32"; then
-      is_386=yes
+    AC_PREPROC_IFELSE([
+#ifdef __x86_64__
+#error 64-bit
+#endif],
+[is_386=yes], [is_x86_64=yes])
+    if test "$is_386" = "yes"; then
+      GOARCH=386
     else
-      is_x86_64=yes
+      GOARCH=amd64
     fi
     ;;
   arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
     is_arm=yes
+    GOARCH=arm
     ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes)
 AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
 AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
+AC_SUBST(GOARCH)
 
 dnl Use -fsplit-stack when compiling C code if available.
 AC_CACHE_CHECK([whether -fsplit-stack is supported],
diff --git a/libgo/go/debug/proc/proc_rtems.go b/libgo/go/debug/proc/proc_rtems.go
new file mode 100644 (file)
index 0000000..5311a63
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package proc
+
+import "os"
+
+// Process tracing is not supported on RTEMS yet.
+
+func Attach(pid int) (Process, os.Error) {
+       return nil, os.NewError("debug/proc not implemented on RTEMS")
+}
+
+func ForkExec(argv0 string, argv []string, envv []string, dir string, fd []*os.File) (Process, os.Error) {
+       return Attach(0)
+}
diff --git a/libgo/go/debug/proc/regs_rtems_386.go b/libgo/go/debug/proc/regs_rtems_386.go
new file mode 100644 (file)
index 0000000..3fc3e51
--- /dev/null
@@ -0,0 +1,5 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package proc
diff --git a/libgo/go/debug/proc/regs_rtems_amd64.go b/libgo/go/debug/proc/regs_rtems_amd64.go
new file mode 100644 (file)
index 0000000..3fc3e51
--- /dev/null
@@ -0,0 +1,5 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package proc
index 05e93c4..aca9c7b 100644 (file)
@@ -6,8 +6,6 @@
 
 package syscall
 
-const ARCH = "386"
-
 func (r *PtraceRegs) PC() uint64 {
        return uint64(uint32(r.Eip));
 }
index a2ede00..9932579 100644 (file)
@@ -6,8 +6,6 @@
 
 package syscall
 
-const ARCH = "amd64"
-
 func (r *PtraceRegs) PC() uint64 {
        return r.Rip;
 }
diff --git a/libgo/syscalls/syscall_rtems.go b/libgo/syscalls/syscall_rtems.go
new file mode 100644 (file)
index 0000000..7f0c119
--- /dev/null
@@ -0,0 +1,7 @@
+// syscall_rtems.go -- RTEMS specific syscall interface.
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
diff --git a/libgo/syscalls/syscall_rtems_386.go b/libgo/syscalls/syscall_rtems_386.go
new file mode 100644 (file)
index 0000000..a09c5ac
--- /dev/null
@@ -0,0 +1,7 @@
+// syscall_rtems_386.go -- RTEMS 386 specific syscall interface.
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
diff --git a/libgo/syscalls/syscall_rtems_amd64.go b/libgo/syscalls/syscall_rtems_amd64.go
new file mode 100644 (file)
index 0000000..941ea23
--- /dev/null
@@ -0,0 +1,7 @@
+// syscall_rtems_amd64.go -- RTEMS AMD64 specific syscall interface.
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
index 113df3b..6e957d3 100644 (file)
@@ -81,8 +81,10 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
+GOARCH = @GOARCH@
 GOC = @GOC@
 GOCFLAGS = @GOCFLAGS@
+GOOS = @GOOS@
 GREP = @GREP@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@