diff --git a/cp437/build.bat b/cp437/build.bat index ef39186..1f25ab4 100644 --- a/cp437/build.bat +++ b/cp437/build.bat @@ -1,46 +1,2 @@ @echo off -:: -:: 86Box A hypervisor and IBM PC system emulator that specializes in -:: running old operating systems and software designed for IBM -:: PC systems and compatibles from 1981 through fairly recent -:: system designs based on the PCI bus. -:: -:: This file is part of the 86Box Probing Tools distribution. -:: -:: Universal Windows build script for Watcom C-based host tools. -:: -:: -:: -:: Authors: RichardG, -:: -:: Copyright 2021 RichardG. -:: - -:: Check for Watcom environment. -if "x%WATCOM%" == "x" ( - echo *** WATCOM environment variable not set. Make sure you're on an OpenWatcom - echo "Build Environment" command prompt. - exit /b 1 -) - -:: Find source file. -for %%i in (*.c) do set srcfile=%%i -if "x%srcfile%" == "x" ( - echo *** Source file not found. - exit /b 2 -) - -:: Generate output file name. -set destfile=%srcfile:~0,-2%.exe - -:: Call compiler. -echo *** Building... -wcl386 -bcl=nt -fo="%destfile%" "%srcfile%" - -:: Check for success. -if errorlevel 1 ( - echo *** Build failed. - exit /b 4 -) else ( - echo *** Build successful. -) +..\lib\build_watcom_host.bat cp437.c diff --git a/cp437/build.sh b/cp437/build.sh index 3449073..58850a2 100644 --- a/cp437/build.sh +++ b/cp437/build.sh @@ -1,44 +1,2 @@ #!/bin/sh -# -# 86Box A hypervisor and IBM PC system emulator that specializes in -# running old operating systems and software designed for IBM -# PC systems and compatibles from 1981 through fairly recent -# system designs based on the PCI bus. -# -# This file is part of the 86Box Probing Tools distribution. -# -# Universal *nix build script for Watcom C-based host tools. -# -# -# -# Authors: RichardG, -# -# Copyright 2021 RichardG. -# - -if ! wcl386 -v >/dev/null 2>&1 -then - echo '***' Watcom compiler not found. Make sure OpenWatcom is installed and in \$PATH. - exit 1 -fi - -# Find source file. -srcfile="$(ls *.c 2>/dev/null | head -1)" -if [ "x$srcfile" == "x" ] -then - echo '***' Source file not found. - exit 2 -fi - -# Generate output file name. -destfile=$(basename "$srcfile" .c) - -# Call compiler and check for success. -if wcl386 -bcl=linux -fo="$destfile" "$srcfile" -then - echo '***' Build successful. - chmod +x "$destfile" -else - echo '***' Build failed. - exit 4 -fi +exec ../lib/build_watcom_host.sh cp437.c diff --git a/lib/build_watcom_dos.bat b/lib/build_watcom_dos.bat new file mode 100644 index 0000000..7204ed3 --- /dev/null +++ b/lib/build_watcom_dos.bat @@ -0,0 +1,59 @@ +@echo off +:: +:: 86Box A hypervisor and IBM PC system emulator that specializes in +:: running old operating systems and software designed for IBM +:: PC systems and compatibles from 1981 through fairly recent +:: system designs based on the PCI bus. +:: +:: This file is part of the 86Box Probing Tools distribution. +:: +:: Universal Windows build script for Watcom C-based DOS tools. +:: +:: +:: +:: Authors: RichardG, +:: +:: Copyright 2021 RichardG. +:: + +:: Check for Watcom environment. +if "x%WATCOM%" == "x" ( + echo *** WATCOM environment variable not set. Make sure you're on an OpenWatcom + echo "Build Environment" command prompt. + exit /b 1 +) + +:: Check for cp437 tool and build it if necessary. +if not exist ..\cp437\cp437.exe ( + echo *** Building cp437 conversion tool for your host system... + pushd ..\cp437 + call build.bat + popd + if errorlevel 1 exit /b %errorlevel% +) + +:: Convert source file to CP437. +echo *** Converting %1 to CP437... +..\cp437\cp437.exe %1 +if errorlevel 1 ( + echo *** Conversion failed. + exit /b 2 +) + +:: Generate output file name. +set srcfile=%1 +set destfile=%srcfile:~0,-2%.exe +setlocal enabledelayedexpansion +for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do set "destfile=!destfile:%%i=%%i!" + +:: Call compiler. +echo *** Building... +wcl -bcl=dos -fo="!destfile!" "%1.cp437" + +:: Check for success. +if errorlevel 1 ( + echo *** Build failed. + exit /b 3 +) else ( + echo *** Build successful. +) diff --git a/lib/build_watcom_dos.sh b/lib/build_watcom_dos.sh new file mode 100644 index 0000000..4daa0ab --- /dev/null +++ b/lib/build_watcom_dos.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box Probing Tools distribution. +# +# Universal *nix build script for Watcom C-based DOS tools. +# +# +# +# Authors: RichardG, +# +# Copyright 2021 RichardG. +# + +# Check for Watcom environment. +if ! wcl -v >/dev/null 2>&1 +then + echo '***' Watcom compiler not found. Make sure OpenWatcom is installed and in \$PATH. + exit 1 +fi + +# Check for cp437 tool and build it if necessary. +if [ ! -x ../cp437/cp437 ] +then + echo '***' Building cp437 conversion tool for your host system... + pushd ../cp437 + if ! ./build.sh + then + exit $? + fi + popd +fi + +# Convert source file to CP437. +echo '***' Converting $1 to CP437... +if ! ../cp437/cp437 "$1" +then + echo '***' Conversion failed. + exit 2 +fi + +# Generate output file name. +destfile=$(basename "$1" .c | tr [:lower:] [:upper:]).EXE + +# Call compiler and check for success. +if wcl -bcl=dos -fo="$destfile" "$1".cp437 +then + echo '***' Build successful. +else + echo '***' Build failed. + exit 3 +fi diff --git a/lib/build_watcom_host.bat b/lib/build_watcom_host.bat new file mode 100644 index 0000000..f66fbc3 --- /dev/null +++ b/lib/build_watcom_host.bat @@ -0,0 +1,40 @@ +@echo off +:: +:: 86Box A hypervisor and IBM PC system emulator that specializes in +:: running old operating systems and software designed for IBM +:: PC systems and compatibles from 1981 through fairly recent +:: system designs based on the PCI bus. +:: +:: This file is part of the 86Box Probing Tools distribution. +:: +:: Universal Windows build script for Watcom C-based host tools. +:: +:: +:: +:: Authors: RichardG, +:: +:: Copyright 2021 RichardG. +:: + +:: Check for Watcom environment. +if "x%WATCOM%" == "x" ( + echo *** WATCOM environment variable not set. Make sure you're on an OpenWatcom + echo "Build Environment" command prompt. + exit /b 1 +) + +:: Generate output file name. +set srcfile=%1 +set destfile=%srcfile:~0,-2%.exe + +:: Call compiler. +echo *** Building... +wcl386 -bcl=nt -fo="%destfile%" "%1" + +:: Check for success. +if errorlevel 1 ( + echo *** Build failed. + exit /b 4 +) else ( + echo *** Build successful. +) diff --git a/lib/build_watcom_host.sh b/lib/build_watcom_host.sh new file mode 100644 index 0000000..4933f7f --- /dev/null +++ b/lib/build_watcom_host.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box Probing Tools distribution. +# +# Universal *nix build script for Watcom C-based host tools. +# +# +# +# Authors: RichardG, +# +# Copyright 2021 RichardG. +# + +if ! wcl386 -v >/dev/null 2>&1 +then + echo '***' Watcom compiler not found. Make sure OpenWatcom is installed and in \$PATH. + exit 1 +fi + +# Generate output file name. +destfile=$(basename "$1" .c) + +# Call compiler and check for success. +if wcl386 -bcl=linux -fo="$destfile" "$1" +then + echo '***' Build successful. + chmod +x "$destfile" +else + echo '***' Build failed. + exit 4 +fi diff --git a/pcireg/build.bat b/pcireg/build.bat index 1cdf133..6ca3449 100644 --- a/pcireg/build.bat +++ b/pcireg/build.bat @@ -1,65 +1,2 @@ @echo off -:: -:: 86Box A hypervisor and IBM PC system emulator that specializes in -:: running old operating systems and software designed for IBM -:: PC systems and compatibles from 1981 through fairly recent -:: system designs based on the PCI bus. -:: -:: This file is part of the 86Box Probing Tools distribution. -:: -:: Universal Windows build script for Watcom C-based DOS tools. -:: -:: -:: -:: Authors: RichardG, -:: -:: Copyright 2021 RichardG. -:: - -:: Check for Watcom environment. -if "x%WATCOM%" == "x" ( - echo *** WATCOM environment variable not set. Make sure you're on an OpenWatcom - echo "Build Environment" command prompt. - exit /b 1 -) - -:: Check for cp437 tool and build it if necessary. -if not exist ..\cp437\cp437.exe ( - echo *** Building cp437 conversion tool for your host system... - pushd ..\cp437 - call build.bat - popd - if errorlevel 1 exit /b %errorlevel% -) - -:: Find source file. -for %%i in (*.c) do set srcfile=%%i -if "x%srcfile%" == "x" ( - echo *** Source file not found. - exit /b 2 -) - -:: Convert source file to CP437. -echo *** Converting %srcfile% to CP437... -..\cp437\cp437.exe %srcfile% -if errorlevel 1 ( - echo *** Conversion failed. - exit /b 3 -) - -:: Generate output file name. -set destfile=%srcfile:~0,-2%.exe -setlocal enabledelayedexpansion -for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do set "destfile=!destfile:%%i=%%i!" - -:: Call compiler. -echo *** Building... -wcl -bcl=dos -fo="!destfile!" "%srcfile%.cp437" - -:: Check for success. -if errorlevel 1 ( - echo *** Build failed. - exit /b 4 -) else ( - echo *** Build successful. -) +..\lib\build_watcom_dos.bat pcireg.c diff --git a/pcireg/build.sh b/pcireg/build.sh index 9689b79..f1fc705 100644 --- a/pcireg/build.sh +++ b/pcireg/build.sh @@ -1,64 +1,2 @@ #!/bin/sh -# -# 86Box A hypervisor and IBM PC system emulator that specializes in -# running old operating systems and software designed for IBM -# PC systems and compatibles from 1981 through fairly recent -# system designs based on the PCI bus. -# -# This file is part of the 86Box Probing Tools distribution. -# -# Universal *nix build script for Watcom C-based DOS tools. -# -# -# -# Authors: RichardG, -# -# Copyright 2021 RichardG. -# - -# Check for Watcom environment. -if ! wcl -v >/dev/null 2>&1 -then - echo '***' Watcom compiler not found. Make sure OpenWatcom is installed and in \$PATH. - exit 1 -fi - -# Check for cp437 tool and build it if necessary. -if [ ! -x ../cp437/cp437 ] -then - echo '***' Building cp437 conversion tool for your host system... - pushd ../cp437 - if ! ./build.sh - then - exit $? - fi - popd -fi - -# Find source file. -srcfile="$(ls *.c 2>/dev/null | head -1)" -if [ "x$srcfile" == "x" ] -then - echo '***' Source file not found. - exit 2 -fi - -# Convert source file to CP437. -echo '***' Converting $srcfile to CP437... -if ! ../cp437/cp437 "$srcfile" -then - echo '***' Conversion failed. - exit 3 -fi - -# Generate output file name. -destfile=$(basename "$srcfile" .c | tr [:lower:] [:upper:]).EXE - -# Call compiler and check for success. -if wcl -bcl=dos -fo="$destfile" "$srcfile".cp437 -then - echo '***' Build successful. -else - echo '***' Build failed. - exit 4 -fi +exec ../lib/build_watcom_dos.sh pcireg.c