Skip to content

Instantly share code, notes, and snippets.

@FrBrGeorge
Last active August 31, 2020 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FrBrGeorge/a2fa6d8894f29c5d0e400e2593233519 to your computer and use it in GitHub Desktop.
Save FrBrGeorge/a2fa6d8894f29c5d0e400e2593233519 to your computer and use it in GitHub Desktop.
#!/bin/sh
DOSBOX=/usr/bin/dosbox
BCCDIR=${BCCDIR:-/home/george/.doses/BC}
BCCBAT="$BCCDIR/BCCRUN.BAT"
BCCP2M=""
case "$1" in
*.c|*.C|*.CPP|*.cpp|*.cxx|*.CXX|*.cc|*.CC)
SRCDIR=$(dirname $(realpath "$1"))
BCCBUILD="BCC `basename "$1"`"
shift;;
*.mak|*.MAK|makefile|MAKEFILE|Makefile)
SRCDIR=$(dirname $(realpath "$1"))
BCCBUILD="make -f`basename "$1"`"
shift;;
*.prj|*.PRJ)
SRCDIR=$(dirname $(realpath "$1"))
BCCP2M="prj2mak `basename "$1"` makefile. makefile"
BCCBUILD="make"
shift;;
*) test -r MAKEFILE -o -r Makefile -o -r makefile || {
echo "No MAKEFILE found"
exit 1; }
SRCDIR=`pwd`
BCCBUILD="make"
;;
esac
echo -E "@echo off
mount d $SRCDIR
PATH=C:\bc\bin
d:
$BCCP2M
$BCCBUILD > MAKEFILE.LOG" > "$BCCBAT"
$DOSBOX -exit "$BCCBAT"
cat "$SRCDIR/MAKEFILE.LOG" >&2
@FrBrGeorge
Copy link
Author

Usage:

  1. just run BCC in the directory with MAKEFILE
  2. or run BCC path-to-file.c
  3. or run BCC path-to-makefile
  4. or run BCC path-to-project.prj

in later case the progect will be converted to MAKEFILE/~MAKEFILE.CFG` pair

Compiling result is stored to MAKEFLE.LOG file and printed to stderr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment