diff --git a/build.bat b/build.bat index 48eb826..27f2c54 100644 --- a/build.bat +++ b/build.bat @@ -3,10 +3,16 @@ :- batch file to build everything :- $Id$ -:----------------------------------------------------------------------- -:- Syntax: BUILD [-r] [fat32|fat16] [msc|wc|tc|tcpp] [86|186|386] [debug] [lfnapi] [/L #] -:- option case is significant !! -:----------------------------------------------------------------------- +if NOT "%1" == "/?" goto start +echo ":-----------------------------------------------------------------------" +echo ":- Syntax: BUILD [-r] [fat32|fat16] [msc|wc|tc|tcpp|bc] [86|186|386] " +echo ":- [debug] [lfnapi] [/L #] [/D value] " +echo ":- option case is significant !! " +echo ":- Note: Open Watcom (wc) is the preferred compiler " +echo ":-----------------------------------------------------------------------" +goto end + +:start set XERROR=1 if "%XERROR%" == "" goto noenv @@ -34,15 +40,18 @@ if "%1" == "msc" set COMPILER=MSC if "%1" == "wc" set COMPILER=WATCOM if "%1" == "tc" set COMPILER=TC if "%1" == "tcpp" set COMPILER=TCPP +if "%1" == "bc" set COMPILER=BC if "%1" == "86" set XCPU=86 if "%1" == "186" set XCPU=186 if "%1" == "386" set XCPU=386 +if "%1" == "x86" goto setCPU if "%1" == "debug" set ALLCFLAGS=%ALLCFLAGS% -DDEBUG if "%1" == "lfnapi" set ALLCFLAGS=%ALLCFLAGS% -DWITHLFNAPI if "%1" == "/L" goto setLoadSeg +if "%1" == "/D" goto setDefine :nextOption shift @@ -92,6 +101,7 @@ echo. cd ..\sys call %MAKE% all if errorlevel 1 goto abort-cd +if NOT "%XUPX%" == "" %XUPX% ..\bin\sys.com echo. echo Process KERNEL +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -117,10 +127,27 @@ goto end :setLoadSeg shift if "%1" == "" echo you MUST specify load segment eg 0x60 with /L option -if "%1" == "" goot abort +if "%1" == "" goto abort set LOADSEG=%1 goto nextOption +:setCPU +shift +if "%1" == "" echo you MUST specify compiler's cpu cmd line argument, eg -5 +if "%1" == "" goto abort +set XCPU_EX=%1 +goto nextOption + +:setDefine +shift +:- Give extra compiler DEFINE flags here +if "%1" == "" echo you MUST specify value to define with /D option +if "%1" == "" echo such as /D DEBUG : extra DEBUG output +if "%1" == "" echo or /D DOSEMU : printf output goes to dosemu log +if "%1" == "" goto abort +set ALLCFLAGS=%ALLCFLAGS% -D%1 +goto nextOption + :noenv echo Unable to set necessary environment variables! goto abort diff --git a/buildall.bat b/buildall.bat index 9785bb0..548ed33 100644 --- a/buildall.bat +++ b/buildall.bat @@ -1,10 +1,7 @@ @echo off -:- $Id$ - :---------------------------------------------------------- -:- batch file to build _many_ KERNELS, hope build works. -:- takes 3 minutes on my(TE) Win2K/P700. your milage may vary :-) +:- batch file to build _many_ KERNELS :---------------------------------------------------------- if "%1" == "$SUMMARY" goto summary @@ -36,6 +33,30 @@ if "%XERROR%" == "" call build.bat -r tc 86 fat32 if not "%XERROR%" == "" goto daswarwohlnix :no_tc +:***** TCPP kernels + +if "%TCPP_BASE%" == "" goto no_tcpp + call build.bat -r tcpp 186 fat16 +if "%XERROR%" == "" call build.bat -r tcpp 86 fat16 +if "%XERROR%" == "" call build.bat -r tcpp 186 fat32 +if "%XERROR%" == "" call build.bat -r tcpp 86 fat32 + +if not "%XERROR%" == "" goto daswarwohlnix +:no_tcpp + +:***** BC kernels + +if "%BC_BASE%" == "" goto no_bc + call build.bat -r bc 386 fat16 +if "%XERROR%" == "" call build.bat -r bc 186 fat16 +if "%XERROR%" == "" call build.bat -r bc 86 fat16 +if "%XERROR%" == "" call build.bat -r bc 386 fat32 +if "%XERROR%" == "" call build.bat -r bc 186 fat32 +if "%XERROR%" == "" call build.bat -r bc 86 fat32 + +if not "%XERROR%" == "" goto daswarwohlnix +:no_bc + :***** (Open) Watcom kernels if "%WATCOM%" == "" goto no_wc diff --git a/config.b b/config.b index e17b41c..84744e0 100644 --- a/config.b +++ b/config.b @@ -22,12 +22,13 @@ set LAST= :- NASM/DJGPP crashes when using protected mode Borland's make. set NASM=c:\bin\nasm16 +::set NASM=c:\bin\nasmw.exe :----------------------------------------------------------------------- :- define COMPILER name here, pick one of them. :- Turbo C 2.01 -set COMPILER=TC +:: set COMPILER=TC :- Turbo C++ 1.01 ::set COMPILER=TCPP :- Turbo C++ 3.0 @@ -37,33 +38,18 @@ set COMPILER=TC :- Microsoft C ::set COMPILER=MSC :- Watcom C -::set COMPILER=WATCOM +set COMPILER=WATCOM :----------------------------------------------------------------------- :- define BASE dir of compiler; :- may be defined for all installed compilers. -set TC_BASE=c:\tc +::set TC_BASE=c:\tc ::set TCPP_BASE=c:\tcpp ::set TCPP3_BASE=c:\tcpp3 ::set BC_BASE=c:\bc ::set MSC_BASE=c:\msc -::set WATCOM=c:\watcom - -:----------------------------------------------------------------------- -:- When compiling executable, compilers search linker through PATH; -:- if some linker not in PATH, uncomment OLDPATH and required SETs PATH. - -::set OLDPATH=%PATH% -::set PATH=%TC_BASE%;%PATH% -::set PATH=%TCPP_BASE%\bin;%PATH% -::set PATH=%TCPP3_BASE%\bin;%PATH% -::set PATH=%BC_BASE%\bin;%PATH% -::set PATH=%MSC_BASE%\bin;%PATH% -::set PATH=%WATCOM%\binw;%PATH% - -:- MSC searches libraries only through LIB variable. -::set LIB=%MSC_BASE%\lib +set WATCOM=c:\watcom :----------------------------------------------------------------------- :- define which linker to use OR it will be determined AUTOMATICALLY. diff --git a/defaults.bat b/defaults.bat index 7ae08d3..13d3313 100644 --- a/defaults.bat +++ b/defaults.bat @@ -17,12 +17,30 @@ if "%BASE%" == "" goto clearset :----------------------------------------------------------------------- +set BINPATH=%BASE%\bin +if "%COMPILER%" == "TC" set BINPATH=%BASE% +if "%COMPILER%" == "WATCOM" set BINPATH=%BASE%\binw +if "%COMPILER%" == "WATCOM" if "%OS%" == "Windows_NT" set BINPATH=%BASE%\binnt + +echo Path to compiler programs (binaries) is %BINPATH% + +:----------------------------------------------------------------------- +:- When compiling executable, compilers may invoke secondary programs +:- such as preprocessor, compiler component, or linker through PATH; + +set OLDPATH=%PATH% +set PATH=%BINPATH%;%PATH% + +:- MSC searches libraries only through LIB variable. +if "%COMPILER%" == "MSC" set LIB=%MSC_BASE%\lib + +:----------------------------------------------------------------------- + if not "%LINK%" == "" goto skip_link -set LINK=%BASE%\bin\tlink /c/m -if "%COMPILER%" == "TC" set LINK=%BASE%\tlink /c/m -if "%COMPILER%" == "WATCOM" set LINK=call ..\utils\wlinker /nologo -if "%COMPILER%" == "MSC" set LINK=%BASE%\bin\link /ONERROR:NOEXE /batch +set LINK=%BINPATH%\tlink /c/m/s/l +if "%COMPILER%" == "WATCOM" set LINK=..\utils\wlinker /nologo +if "%COMPILER%" == "MSC" set LINK=%BINPATH%\link /ONERROR:NOEXE /batch echo Linker is %LINK% @@ -32,11 +50,10 @@ echo Linker is %LINK% if not "%LIBUTIL%" == "" goto skip_lib -set LIBUTIL=%BASE%\bin\tlib +set LIBUTIL=%BINPATH%\tlib set LIBTERM= -if "%COMPILER%" == "TC" set LIBUTIL=%BASE%\tlib -if "%COMPILER%" == "WATCOM" set LIBUTIL=%BASE%\binw\wlib -q -if "%COMPILER%" == "MSC" set LIBUTIL=%BASE%\bin\lib /nologo +if "%COMPILER%" == "WATCOM" set LIBUTIL=%BINPATH%\wlib -q +if "%COMPILER%" == "MSC" set LIBUTIL=%BINPATH%\lib /nologo if "%COMPILER%" == "MSC" set LIBTERM=; echo Librarian is %LIBUTIL% @@ -47,10 +64,9 @@ echo Librarian is %LIBUTIL% if not "%MAKE%" == "" goto skip_make -set MAKE=%BASE%\bin\make -if "%COMPILER%" == "TC" set MAKE=%BASE%\make -if "%COMPILER%" == "WATCOM" set MAKE=%BASE%\binw\wmake /ms /h -if "%COMPILER%" == "MSC" set MAKE=%BASE%\bin\nmake /nologo +set MAKE=%BINPATH%\make +if "%COMPILER%" == "WATCOM" set MAKE=%BINPATH%\wmake /ms /h +if "%COMPILER%" == "MSC" set MAKE=%BINPATH%\nmake /nologo echo Make is %MAKE% @@ -68,6 +84,7 @@ if "%LAST%" == "1" goto end set NASM= set COMPILER= set BASE= +set BINPATH= set TC_BASE= set TCPP_BASE= set TCPP3_BASE= @@ -79,6 +96,7 @@ set LIBTERM= set MAKE= set XUPX= set XCPU= +set XCPU_EX= set XFAT= set ALLCFLAGS= set LOADSEG= diff --git a/mkfiles/generic.mak b/mkfiles/generic.mak index 6aae72e..9fe65f1 100644 --- a/mkfiles/generic.mak +++ b/mkfiles/generic.mak @@ -12,6 +12,11 @@ CPUOPT=-1 !if $(XCPU) == 386 CPUOPT=-3 !endif +# extension, if compiler supports it, specify compiler switch in XCPU_EX and set XCPU to 386 +!if $(XCPU_EX)0 != 0 +XCPU=386 +CPUOPT=$(XCPU_EX) +!endif !if $(XFAT)0 == 0 XFAT=32 @@ -23,7 +28,7 @@ NASMFLAGS=-DWITHFAT32 $(NASMFLAGS) NASMFLAGS=-fobj -i../hdr/ -D$(COMPILER) -DXCPU=$(XCPU) $(NASMFLAGS) -BINPATH=$(BASE)\bin +#BINPATH=$(BASE)\bin INCLUDEPATH=$(BASE)\include LIBPATH=$(BASE)\lib INITPATCH=@rem diff --git a/mkfiles/tc.mak b/mkfiles/tc.mak index 05fa52f..d8bc5c0 100644 --- a/mkfiles/tc.mak +++ b/mkfiles/tc.mak @@ -2,8 +2,6 @@ # TC.MAK - kernel compiler options for Turbo C 2.01 # -BINPATH=$(BASE) - !include "..\mkfiles\tcpp.mak" TARGET=KTC diff --git a/mkfiles/watcom.mak b/mkfiles/watcom.mak index 23671fe..f771767 100644 --- a/mkfiles/watcom.mak +++ b/mkfiles/watcom.mak @@ -4,7 +4,6 @@ TARGET=KWC -BINPATH=$(BASE)\binw INCLUDEPATH=$(BASE)\h LIBPATH=$(BASE)\lib286 diff --git a/utils/wlinker.bat b/utils/wlinker.bat index 27ae76a..7c7ede2 100755 --- a/utils/wlinker.bat +++ b/utils/wlinker.bat @@ -1,4 +1,4 @@ @echo off -%BASE%\binw\ms2wlink %1 %2 %3 %4 %5 %6 %7 %8 %9 ,,,, >kernel.lnk +%BINPATH%\ms2wlink %1 %2 %3 %4 %5 %6 %7 %8 %9 ,,,, >kernel.lnk echo op map,statics,verbose,eliminate,vfremoval>>kernel.lnk -%BASE%\binw\wlink @kernel.lnk +%BINPATH%\wlink @kernel.lnk