From 3ba0d7ae2c22e7c38395fbd585dd29826845c080 Mon Sep 17 00:00:00 2001 From: David Brown Date: Wed, 21 Dec 2016 13:01:14 +0000 Subject: [PATCH] Update Visual C make.cmd, use separate compilation for LOLA conf test. --- make.cmd | 192 +++++++++++++++++-------------- src/compiler/extTools.Mod | 33 ++++-- src/test/confidence/lola/test.sh | 6 +- src/test/confidence/testenv.sh | 7 +- src/tools/make/configure.c | 1 + 5 files changed, 135 insertions(+), 104 deletions(-) diff --git a/make.cmd b/make.cmd index 6eb498e5..7a42fe50 100644 --- a/make.cmd +++ b/make.cmd @@ -1,26 +1,30 @@ @echo off -:: mscmake.cmd - Build Oberon with Microsoft C compiler. +:: make.cmd - Build Oberon with Microsoft C compiler. :: Expects the path to include cl.exe. -:: As of 10th Feb 2016 the miscrosoft c compiler and build tools +:: As of December 2016 the Microsoft C compiler and build tools :: can be downloaded independently of the full Visual Studio IDE :: as the 'Visual C++ Build Tools 2015'. -:: See: https://blogs.msdn.microsoft.com/vcblog/2015/11/02/announcing-visual-c-build-tools-2015-standalone-c-tools-for-build-environments/ +:: See: http://landinghub.visualstudio.com/visual-cpp-build-tools :: With this installed, from the start button select: -:: All Apps / Visual C++ Build Tools / Visual C++ x86 Native Build Tools Command Prompt +:: All Apps / Visual C++ Build Tools / Visual C++ 2015 x86 Native Build Tools Command Prompt +:: or All Apps / Visual C++ Build Tools / Visual C++ 2015 x64 Native Build Tools Command Prompt + + :: Create configuration and parameter files. -cl -nologo -Isrc\runtime src\tools\make\configure.c >nul +cl -nologo -Isrc\runtime src\tools\make\configure.c >msc-listing || type msc-listing setlocal configure.exe >nul del configure.obj configure.exe 2>nul + :: Extract make variables into local environment for /F "delims='=' tokens=1,2" %%a in (Configuration.make) do set %%a=%%b @@ -33,7 +37,6 @@ set MODEL=2 for /F %%d in ('cd');do set ROOTDIR=%%d - :: Process target parameter if "%1" equ "" ( @@ -51,30 +54,86 @@ goto :eof @echo. @echo Usage: @echo. -@echo. make full - Make and install compiler (from administrator prompt) +@echo. make full - Make compiler to 'install' subdirectory +@echo. make install - Install 'install' subdir to OS. Requires administrator privileges @echo. -@echo. make clean - Remove made files -@echo. make compiler - Build the compiler but not the library -@echo. make library - Build all library files and make library -@echo. make install - Install built compiler and library (from administrator prompt) +@echo. make clean - Remove made files +@echo. make compiler - Build the compiler but not the library +@echo. make library - Build all library files and make library +@echo. make install - Install built compiler and library (from administrator prompt) goto :eof :full +call :clean || exit /b +call :compiler || exit /b +call :browsercmd || exit /b +call :library || exit /b +call :makeinstalldir || exit /b +goto :eof + + + + +:makeinstalldir +rmdir /s /q "%ROOTDIR%\install" >nul 2>&1 +mkdir "%ROOTDIR%\install" >nul 2>&1 + +mkdir "%ROOTDIR%\install\bin" >nul 2>&1 +copy %OBECOMP% "%ROOTDIR%\install\bin" >nul +copy %BUILDDIR%\showdef.exe "%ROOTDIR%\install\bin" >nul + +mkdir "%ROOTDIR%\install\2" >nul 2>&1 +mkdir "%ROOTDIR%\install\2\include" >nul 2>&1 +mkdir "%ROOTDIR%\install\2\sym" >nul 2>&1 +copy %BUILDDIR%\2\*.h "%ROOTDIR%\install\2\include" >nul +copy %BUILDDIR%\2\*.sym "%ROOTDIR%\install\2\sym" >nul + +mkdir "%ROOTDIR%\install\C" >nul 2>&1 +mkdir "%ROOTDIR%\install\C\include" >nul 2>&1 +mkdir "%ROOTDIR%\install\C\sym" >nul 2>&1 +copy %BUILDDIR%\C\*.h "%ROOTDIR%\install\C\include" >nul +copy %BUILDDIR%\C\*.sym "%ROOTDIR%\install\C\sym" >nul + +mkdir "%ROOTDIR%\install\lib" >nul 2>&1 +copy %BUILDDIR%\2\lib%ONAME%* "%ROOTDIR%\install\lib" >nul +copy %BUILDDIR%\C\lib%ONAME%* "%ROOTDIR%\install\lib" >nul + +echo. +echo Now add %ROOTDIR%\install\bin to your path, for example with the command: +echo PATH %ROOTDIR%\install\bin;%%PATH%% +echo. +goto :eof + + + +:install whoami /groups | find "12288" >nul if errorlevel 1 ( -echo make full - administrator rights required. Please run under an administrator command prompt. +echo make install - administrator rights required. Please run under an administrator command prompt. goto :eof ) -call :uninstall || exit /b -call :clean || exit /b -call :compiler || exit /b -call :browsercmd || exit /b -call :library || exit /b -call :install || exit /b -call :showpath || exit /b +echo Installing to %INSTALLDIR% +rmdir /s /q "%INSTALLDIR%" >nul 2>&1 +xcopy /E /I /Y "%ROOTDIR%\install" "%INSTALLDIR%" >nul +echo. +echo Now add %INSTALLDIR%\bin to your path, for example with the command: +echo PATH %INSTALLDIR%\bin;%%PATH%% +echo. +goto :eof + + + +:uninstall +whoami /groups | find "12288" >nul +if errorlevel 1 ( +echo make uninstall - administrator rights required. Please run under an administrator command prompt. +goto :eof +) +echo Uninstalling %INSTALLDIR% +rmdir /s /q "%INSTALLDIR%" >nul 2>&1 goto :eof @@ -101,37 +160,38 @@ echo. echo.make assemble - compiling Oberon compiler c source:: echo. VERSION: %VERSION% echo. Target characeristics: -echo. PLATFORM: %PLATFORM% -echo. OS: %OS% -echo. BUILDDIR: %BUILDDIR% +echo. PLATFORM: %PLATFORM% +echo. OS: %OS% +echo. BUILDDIR: %BUILDDIR% +echo. INSTALLDIR: %INSTALLDIR% echo. Oberon characteristics: -echo. MODEL: %MODEL% -echo. ADRSIZE: %ADRSIZE% -echo. ALIGNMENT: %ALIGNMENT% +echo. MODEL: %MODEL% +echo. ADRSIZE: %ADRSIZE% +echo. ALIGNMENT: %ALIGNMENT% echo. C compiler: -echo. COMPILER: %COMPILER% -echo. COMPILE: %COMPILE% -echo. DATAMODEL: %DATAMODEL% +echo. COMPILER: %COMPILER% +echo. COMPILE: %COMPILE% +echo. DATAMODEL: %DATAMODEL% cd %BUILDDIR% cl -nologo /Zi -c SYSTEM.c Configuration.c Platform.c Heap.c || exit /b cl -nologo /Zi -c Out.c Strings.c Modules.c Files.c || exit /b -cl -nologo /Zi -c Reals.c Texts.c vt100.c errors.c || exit /b +cl -nologo /Zi -c Reals.c Texts.c VT100.c || exit /b cl -nologo /Zi -c OPM.c extTools.c OPS.c OPT.c || exit /b cl -nologo /Zi -c OPC.c OPV.c OPB.c OPP.c || exit /b cl -nologo /Zi Compiler.c /Fe%ROOTDIR%\%OBECOMP% /link /INCREMENTAL:NO ^ -SYSTEM.obj Configuration.obj Platform.obj Heap.obj ^ -Out.obj Strings.obj Modules.obj Files.obj ^ -Reals.obj Texts.obj VT100.obj errors.obj ^ -OPM.obj extTools.obj OPS.obj OPT.obj ^ -OPC.obj OPV.obj OPB.obj OPP.obj || exit /b +SYSTEM.obj Configuration.obj Platform.obj Heap.obj Out.obj Strings.obj ^ +Modules.obj Files.obj Reals.obj Texts.obj VT100.obj extTools.obj ^ +OPM.obj OPS.obj OPT.obj OPC.obj OPV.obj OPB.obj OPP.obj || exit /b +cd %ROOTDIR% copy src\runtime\*.c %BUILDDIR% >nul copy src\runtime\*.h %BUILDDIR% >nul +copy src\runtime\*.Txt %BUILDDIR% >nul +copy src\runtime\*.Txt %ROOTDIR% >nul echo.%OBECOMP% created. -cd %ROOTDIR% goto :eof @@ -176,7 +236,6 @@ del *.sym >nul 2>nul %ROOTDIR%\%OBECOMP% -SsfF -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/runtime/Reals.Mod || exit /b %ROOTDIR%\%OBECOMP% -SsfF -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/runtime/Texts.Mod || exit /b %ROOTDIR%\%OBECOMP% -SsfF -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/runtime/VT100.Mod || exit /b -%ROOTDIR%\%OBECOMP% -SsfF -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/compiler/errors.Mod || exit /b %ROOTDIR%\%OBECOMP% -SsfF -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/compiler/OPM.Mod || exit /b %ROOTDIR%\%OBECOMP% -SsfF -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/compiler/extTools.Mod || exit /b %ROOTDIR%\%OBECOMP% -SsfFx -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/compiler/OPS.Mod || exit /b @@ -186,7 +245,12 @@ del *.sym >nul 2>nul %ROOTDIR%\%OBECOMP% -SsfF -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/compiler/OPB.Mod || exit /b %ROOTDIR%\%OBECOMP% -SsfF -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/compiler/OPP.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ssfm -A%ADRSIZE%%ALIGNMENT% -O%MODEL% ../../src/compiler/Compiler.Mod || exit /b + cd %ROOTDIR% +copy src\runtime\*.c %BUILDDIR% >nul +copy src\runtime\*.h %BUILDDIR% >nul +copy src\runtime\*.Txt %BUILDDIR% >nul + echo.%BUILDDIR% filled with compiler C source. goto :eof @@ -197,10 +261,11 @@ goto :eof echo. echo.Making symbol browser cd %BUILDDIR% +%ROOTDIR%/%OBECOMP% -fSs ../../src/runtime/Oberon.Mod %ROOTDIR%/%OBECOMP% -fSm ../../src/tools/browser/BrowserCmd.Mod -cl -nologo BrowserCmd.c /Feshowdef.exe ^ +cl -nologo BrowserCmd.c Oberon.c /Feshowdef.exe ^ Platform.obj Texts.obj OPT.obj Heap.obj Out.obj SYSTEM.obj OPM.obj OPS.obj OPV.obj ^ - Files.obj Reals.obj Modules.obj VT100.obj errors.obj Configuration.obj Strings.obj ^ + Files.obj Reals.obj Modules.obj VT100.obj Configuration.obj Strings.obj ^ OPC.obj cd %ROOTDIR% goto :eof @@ -208,55 +273,6 @@ goto :eof -:install -whoami /groups | find "12288" >nul -if errorlevel 1 ( -echo make install - administrator rights required. Please run under an administrator command prompt. -goto :eof -) -rmdir /s /q "%INSTALLDIR%" >nul 2>&1 -mkdir "%INSTALLDIR%" >nul 2>&1 - -mkdir "%INSTALLDIR%\bin" >nul 2>&1 -copy %OBECOMP% "%INSTALLDIR%\bin" >nul -copy %BUILDDIR%\showdef.exe "%INSTALLDIR%\bin" >nul - -mkdir "%INSTALLDIR%\2" >nul 2>&1 -mkdir "%INSTALLDIR%\2\include" >nul 2>&1 -mkdir "%INSTALLDIR%\2\sym" >nul 2>&1 -copy %BUILDDIR%\2\*.h "%INSTALLDIR%\2\include" >nul -copy %BUILDDIR%\2\*.sym "%INSTALLDIR%\2\sym" >nul - -mkdir "%INSTALLDIR%\C" >nul 2>&1 -mkdir "%INSTALLDIR%\C\include" >nul 2>&1 -mkdir "%INSTALLDIR%\C\sym" >nul 2>&1 -copy %BUILDDIR%\C\*.h "%INSTALLDIR%\C\include" >nul -copy %BUILDDIR%\C\*.sym "%INSTALLDIR%\C\sym" >nul - -mkdir "%INSTALLDIR%\lib" >nul 2>&1 -copy %BUILDDIR%\2\lib%ONAME%* "%INSTALLDIR%\lib" >nul -copy %BUILDDIR%\C\lib%ONAME%* "%INSTALLDIR%\lib" >nul -goto :eof - - -:uninstall -whoami /groups | find "12288" >nul -if errorlevel 1 ( -echo make uninstall - administrator rights required. Please run under an administrator command prompt. -goto :eof -) -rmdir /s /q "%INSTALLDIR%" >nul 2>&1 -goto :eof - - -:showpath -echo. -echo Now add %INSTALLDIR%\bin to your path, for example with the command: -echo PATH %INSTALLDIR%\bin;%%PATH%% -echo. -goto :eof - - :runtime echo. echo.Making runtime library for -O%MODEL% @@ -346,6 +362,7 @@ goto :eof :ulm echo.Making ulm library for -O%MODEL% cd %BUILDDIR%\%MODEL% +%ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmTypes.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmObjects.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmPriorities.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmDisciplines.Mod || exit /b @@ -357,7 +374,6 @@ cd %BUILDDIR%\%MODEL% %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmResources.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmForwarders.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmRelatedEvents.Mod || exit /b -%ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmTypes.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmStreams.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmStrings.Mod || exit /b %ROOTDIR%\%OBECOMP% -Ffs -O%MODEL% ../../../src/library/ulm/ulmSysTypes.Mod || exit /b diff --git a/src/compiler/extTools.Mod b/src/compiler/extTools.Mod index 10163ced..98c9fa71 100644 --- a/src/compiler/extTools.Mod +++ b/src/compiler/extTools.Mod @@ -1,19 +1,34 @@ MODULE extTools; -IMPORT Strings, Out, Configuration, Platform, Modules, OPM; +IMPORT Strings, Out, Configuration, Platform, Modules, Heap, OPM; -VAR CFLAGS: ARRAY 1023 OF CHAR; +TYPE CommandString = ARRAY 4096 OF CHAR; + +VAR CFLAGS: CommandString; PROCEDURE execute(title: ARRAY OF CHAR; cmd: ARRAY OF CHAR); - VAR r, status, exitcode: INTEGER; + VAR r, status, exitcode: INTEGER; fullcmd: CommandString; BEGIN IF OPM.verbose IN OPM.Options THEN - Out.String(title); Out.String(cmd); Out.Ln + Out.String(" "); Out.String(fullcmd); Out.Ln END; - r := Platform.System(cmd); - status := r MOD 128; - exitcode := r DIV 256; + + (* Hack to suppress unwanted filename display by Microsoft C compiler on successful compilations. *) + IF Configuration.compiler = "MSC" THEN + fullcmd := "cmd /c "; + Strings.Append(cmd, fullcmd); + Strings.Append(" >msc-listing || type msc-listing", fullcmd) + ELSE + COPY(cmd, fullcmd); + END; + + (* Get GC to run file finalizers closing generated C files as otherwise Microsoft C cannot open them. *) + Heap.GC(FALSE); + + r := Platform.System(fullcmd); + + status := r MOD 128; exitcode := r DIV 256; IF exitcode > 127 THEN exitcode := exitcode - 256 END; (* Handle signed exit code *) IF r # 0 THEN @@ -43,7 +58,7 @@ END InitialiseCompilerCommand; PROCEDURE Assemble*(moduleName: ARRAY OF CHAR); VAR - cmd: ARRAY 1023 OF CHAR; + cmd: CommandString; BEGIN InitialiseCompilerCommand(cmd); Strings.Append("-c ", cmd); @@ -55,7 +70,7 @@ PROCEDURE Assemble*(moduleName: ARRAY OF CHAR); PROCEDURE LinkMain*(VAR moduleName: ARRAY OF CHAR; statically: BOOLEAN; additionalopts: ARRAY OF CHAR); VAR - cmd: ARRAY 1023 OF CHAR; + cmd: CommandString; BEGIN InitialiseCompilerCommand(cmd); Strings.Append(moduleName, cmd); diff --git a/src/test/confidence/lola/test.sh b/src/test/confidence/lola/test.sh index 315d6d8e..3571e536 100755 --- a/src/test/confidence/lola/test.sh +++ b/src/test/confidence/lola/test.sh @@ -1,5 +1,9 @@ #!/bin/sh . ../testenv.sh -$OBECOMP LSS.Mod LSB.Mod LSC.Mod LSV.Mod lola.Mod -m +$OBECOMP LSS.Mod +$OBECOMP LSB.Mod +$OBECOMP LSC.Mod +$OBECOMP LSV.Mod +$OBECOMP lola.Mod -m ./Lola RISC5.Lola result . ../testresult.sh diff --git a/src/test/confidence/testenv.sh b/src/test/confidence/testenv.sh index de1630fa..fee87667 100755 --- a/src/test/confidence/testenv.sh +++ b/src/test/confidence/testenv.sh @@ -14,12 +14,7 @@ export LD_LIBRARY_PATH=$1/lib:$LD_LIBRARY_PATH rm -f *.o *.obj *.exe *.sym *.c *.h result new.asm $(basename $PWD) # Under gcc generate assembly source for source change test. -# NOTE: The following CFLAGS causes the assembler to write source -# to a single file. When there are multiple Mod files, each -# corresponding assembly file will overwrite the previous. I -# cannot see any way to overcome this short of using -S -# on the voc command and calling 'as' explicitly. -# NOTE 2: The cygwin 64 bit build has relocation errors with +# NOTE: The cygwin 64 bit build has relocation errors with # these assembly generation options. if [ "$COMPILER" = "gcc" -a "$FLAVOUR" != "cygwin.LP64.gcc" ] then export CFLAGS="-gstabs -g1 -Wa,-acdhln=new.asm -Wl,-Map=output.map" diff --git a/src/tools/make/configure.c b/src/tools/make/configure.c index 458bddec..8ed9eeee 100644 --- a/src/tools/make/configure.c +++ b/src/tools/make/configure.c @@ -413,6 +413,7 @@ void writeConfigurationMod() { fprintf(fd, " linkflags* = '%s';\n", linkflags); fprintf(fd, " libspec* = '%s';\n", libspec); fprintf(fd, " libext* = '%s';\n", libext); + fprintf(fd, " compiler* = '%s';\n", compiler); fprintf(fd, " compile* = '%s';\n", cc); fprintf(fd, " installdir* = '%s';\n", installdir); fprintf(fd, " staticLink* = '%s';\n", staticlink);