summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-31 08:07:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-31 08:07:50 +0000
commit74ec76990ac05b706d0db2e658a4aa55b5f2165c (patch)
tree95248b3a5e8a9f58545e55201abca8c1ed989277 /win32
parent26c13db6e6cdf72fba137ce7455c4f34d9180472 (diff)
win32/setup.mak: get target architecture from the compiler
* win32/Makefile.sub, win32/setup.mak (MACHINE): get target architecture from the compiler, instead of environment variable at build time, which is irrelevant to runtime environment, and not set when running in cygwin sshd. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/Makefile.sub11
-rw-r--r--win32/setup.mak45
2 files changed, 20 insertions, 36 deletions
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index d2c1f8f..c7cd2db 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -86,11 +86,10 @@ BASERUBY = ruby
TEST_RUNNABLE = yes
!endif
-!if !defined(PROCESSOR_ARCHITECTURE)
-PROCESSOR_ARCHITECTURE = x86
+!if !defined(MACHINE)
+MACHINE = x86
!endif
-MACHINE = $(PROCESSOR_ARCHITECTURE)
-!if "$(PROCESSOR_ARCHITECTURE)" == "x86"
+!if "$(MACHINE)" == "x86"
!if !defined(PROCESSOR_LEVEL)
PROCESSOR_LEVEL = 5
!endif
@@ -103,8 +102,8 @@ PROCESSOR_FLAG = -G$(PROCESSOR_LEVEL)
CPU = i$(PROCESSOR_LEVEL)86
ARCH = i386
!else
-CPU = $(PROCESSOR_ARCHITECTURE)
-ARCH = $(PROCESSOR_ARCHITECTURE)
+CPU = $(MACHINE)
+ARCH = $(MACHINE)
!endif
!if !defined(DEBUGFLAGS)
DEBUGFLAGS = -Zi
diff --git a/win32/setup.mak b/win32/setup.mak
index 840d3e6..2e62be1 100644
--- a/win32/setup.mak
+++ b/win32/setup.mak
@@ -19,7 +19,6 @@ MAKE = $(MAKE) -f $(MAKEFILE)
!else
MAKEFILE = Makefile
!endif
-ARCH = PROCESSOR_ARCHITECTURE
CPU = PROCESSOR_LEVEL
CC = cl -nologo
CPP = $(CC) -EP
@@ -146,42 +145,28 @@ RUBY_SO_NAME = $(RUBY_SO_NAME)
<<
-generic-: nul
-!if defined($(ARCH)) || defined($(CPU))
- @type << >>$(MAKEFILE)
-!if defined($(ARCH))
-!if "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
-$(ARCH) = x64
-!elseif "$(PROCESSOR_ARCHITECTURE)" == "IA64"
-$(ARCH) = ia64
-!elseif defined(PROCESSOR_ARCHITEW6432)
-$(BANG)if "$$(TARGET_OS)" == "mswin64"
-!if "$(PROCESSOR_ARCHITECTURE)" == "IA64"
-$(ARCH) = ia64
-!else
-$(ARCH) = x64
-!endif
-$(BANG)else
-$(ARCH) = $(PROCESSOR_ARCHITECTURE)
-$(BANG)endif
-!else
-$(ARCH) = $(PROCESSOR_ARCHITECTURE)
-!endif
-!endif
-!if defined($(CPU))
-$(CPU) = $(PROCESSOR_LEVEL)
-!endif
-
+ @$(CPP) <<conftest.c 2>nul | findstr = >>$(MAKEFILE)
+#if defined _M_X64
+MACHINE = x64
+#elif defined _M_IA64
+MACHINE = ia64
+#else
+MACHINE = x86
+#endif
<<
+!if defined($(CPU))
+ @$(APPEND) $(CPU) = $(PROCESSOR_LEVEL)
!endif
+ @$(APPEND)
-alpha-: nul
- @echo $(ARCH) = alpha>>$(MAKEFILE)
+ @echo MACHINE = alpha>>$(MAKEFILE)
-x64-: nul
- @echo $(ARCH) = x64>>$(MAKEFILE)
+ @echo MACHINE = x64>>$(MAKEFILE)
-ia64-: nul
- @echo $(ARCH) = ia64>>$(MAKEFILE)
+ @echo MACHINE = ia64>>$(MAKEFILE)
-ix86-: nul
- @echo $(ARCH) = x86>>$(MAKEFILE)
+ @echo MACHINE = x86>>$(MAKEFILE)
-i386-: -ix86-
@echo $(CPU) = 3>>$(MAKEFILE)