diff options
| -rwxr-xr-x | win32/configure.bat | 24 | ||||
| -rw-r--r-- | win32/setup.mak | 75 |
2 files changed, 71 insertions, 28 deletions
diff --git a/win32/configure.bat b/win32/configure.bat index 4699457c8d..94eed7bc12 100755 --- a/win32/configure.bat +++ b/win32/configure.bat @@ -66,15 +66,18 @@ for /f "delims== tokens=1,*" %%I in ("%~1") do ((set "opt=%%I") && (set "arg=%%J set "var=%opt%"
goto :name
)
- set "eq=="
+ set "target=%opt%"
+ echo>>%confargs% "--target=%opt:$=$$%" \
+goto :loop ;
:target
if "%eq%" == "" (set "arg=%~1" & shift)
- echo>> %config_make% target = %arg%
- echo>>%confargs% "--target=%arg:$=$$%" \
- if "%arg%" == "x64-mswin64" (
- echo>> %config_make% TARGET_OS = mswin64
+ if "%arg%" == "" (
+ echo 1>&2 %configure%: missing argument for %opt%
+ exit /b 1
)
-goto :loop
+ set "target=%arg%"
+ echo>>%confargs% "--target=%arg:$=$$%" \
+goto :loop ;
:program_name
if "%eq%" == "" (set "arg=%~1" & shift)
for /f "delims=- tokens=1,*" %I in ("%opt%") do set "var=%%J"
@@ -220,7 +223,7 @@ goto :loop ; echo --with-ntver=XXXX same as --with-ntver=_WIN32_WINNT_XXXX
echo Note that '[1m=,;[m' need to be enclosed within double quotes in batch file command line.
del %confargs% %config_make%
-goto :exit
+goto :EOF
:unknown_opt
(
echo %configure%: unknown option %opt%
@@ -256,6 +259,7 @@ if "%debug_configure%" == "yes" (type %config_make%) nmake -al -f %WIN32DIR%/setup.mak "WIN32DIR=%WIN32DIR%" ^
config_make=%config_make% ^
- MAKEFILE=Makefile.new MAKEFILE_BACK=Makefile.old MAKEFILE_NEW=Makefile
-:exit
-@endlocal
+ MAKEFILE=Makefile.new MAKEFILE_BACK=Makefile.old MAKEFILE_NEW=Makefile ^
+ %target%
+set error=%ERRORLEVEL%
+if exist %config_make% del /q %config_make%
diff --git a/win32/setup.mak b/win32/setup.mak index 3f14e251cd..19ace3445c 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -22,7 +22,7 @@ MAKE = $(MAKE) -f $(MAKEFILE) MAKEFILE = Makefile !endif CPU = PROCESSOR_LEVEL -CC = $(CC) -nologo -source-charset:utf-8 +CC = $(CC) -nologo CPP = $(CC) -EP !if "$(HAVE_BASERUBY)" != "no" && "$(BASERUBY)" == "" BASERUBY = ruby @@ -35,13 +35,14 @@ i586-mswin32: -prologue- -i586- -epilogue- i686-mswin32: -prologue- -i686- -epilogue- alpha-mswin32: -prologue- -alpha- -epilogue- x64-mswin64: -prologue- -x64- -epilogue- +arm64-mswin64: -prologue- -arm64- -epilogue- -prologue-: -basic-vars- -baseruby- -gmp- -generic-: -osname- -basic-vars-: nul @rem <<$(MAKEFILE) -### Makefile for ruby $(TARGET_OS) ### +### Makefile for ruby ### MAKE = nmake srcdir = $(srcdir:\=/) prefix = $(prefix:\=/) @@ -70,20 +71,31 @@ int main(void) {mpz_init(x); return 0;} @echo # TARGET>>$(MAKEFILE) -osname32-: -osname-section- - @echo TARGET_OS = mswin32>>$(MAKEFILE) + @$(CPP) -Tc <<"checking if target OS is 32bit" >>$(MAKEFILE) +#ifdef _WIN64 +#error +#else +TARGET_OS = mswin32 +#endif +<< -osname64-: -osname-section- - @echo TARGET_OS = mswin64>>$(MAKEFILE) + @$(CPP) -Tc <<"checking if target OS is 64bit" >>$(MAKEFILE) +#ifndef _WIN64 +#error +#else +TARGET_OS = mswin64 +#endif +<< -osname-: -osname-section- - @echo !ifndef TARGET_OS>>$(MAKEFILE) - @($(CC) -c <<conftest.c > nul && (echo TARGET_OS = mswin32) || (echo TARGET_OS = mswin64)) >>$(MAKEFILE) + @$(CPP) -Tc <<"checking for target OS" 2>nul | findstr = >>$(MAKEFILE) #ifdef _WIN64 -#error +TARGET_OS = mswin64 +#else +TARGET_OS = mswin32 #endif << - @echo !endif>>$(MAKEFILE) - @$(WIN32DIR:/=\)\rm.bat conftest.* -compiler-: -compiler-section- -version- -runtime- -headers- @@ -211,27 +223,54 @@ del %0 & exit << -generic-: nul - @$(CPP) <<conftest.c 2>nul | findstr = >>$(MAKEFILE) + @$(CPP) -Tc <<checking-target 2>nul | findstr = >>$(MAKEFILE) #if defined _M_ARM64 MACHINE = arm64 #elif defined _M_X64 MACHINE = x64 #else MACHINE = x86 -#endif -<< !if defined($(CPU)) - @echo>>$(MAKEFILE) $(CPU) = $(PROCESSOR_LEVEL) +$(CPU) = $(PROCESSOR_LEVEL) !endif +#endif -alpha-: -osname32- - @echo MACHINE = alpha>>$(MAKEFILE) + @$(CPP) -Tc <<"checking if compiler is for $(@:-=)" >>$(MAKEFILE) +#ifndef _M_ALPHA +#error Not compiler for $(@:-=) +#else +MACHINE = $(@:-=) +#endif +<< + -x64-: -osname64- - @echo MACHINE = x64>>$(MAKEFILE) + @$(CPP) -Tc <<"checking if compiler is for $(@:-=)" >>$(MAKEFILE) +#ifndef _M_AMD64 +#error Not compiler for $(@:-=) +#else +MACHINE = $(@:-=) +#endif +<< + -ix86-: -osname32- - @echo MACHINE = x86>>$(MAKEFILE) + @$(CPP) -Tc <<"checking if compiler is for $(@:-=)" >>$(MAKEFILE) +#ifndef _M_IX86 +#error Not compiler for $(@:-=) +#else +#define ix86 x86 +MACHINE = $(@:-=) +#endif +<< + -arm64-: -osname64- - @echo MACHINE = arm64>>$(MAKEFILE) + @$(CPP) -Tc <<"checking if compiler is for $(@:-=)" >>$(MAKEFILE) +#ifndef _M_ARM64 +#error Not compiler for $(@:-=) +#else +MACHINE = $(@:-=) +#endif +<< -i386-: -ix86- @echo $(CPU) = 3>>$(MAKEFILE) @@ -261,7 +300,7 @@ MACHINE = x86 # XLDFLAGS = # RFLAGS = -r # EXTLIBS = -CC = $(CC) +CC = $(CC) -source-charset:utf-8 !if "$(AS)" != "ml64" AS = $(AS) -nologo !endif |
