12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #/bin/bash
- set -x #echo on
- # == | Setup | ========================================================================================================
- # XXXTobin: Make this read in from a seperate config file
- OBJECT_DIRECTORY=".obj"
- FINAL_TARGET="dist/bin"
- APP_BIN_NAME="basic-c-program"
- # XXXTobin: Make this a bash array when more than one source is added
- C_SOURCES="../nsMain.c"
- # ---------------------------------------------------------------------------------------------------------------------
- if [[ -z "$1" ]]; then
- printf "${0} Usage: clobber | build | run"
- exit 1
- fi
- # =====================================================================================================================
- # == | Functions | ====================================================================================================
- # XXXTobin: Quote paths when that starts to matter.
- xmach_cmd_clobber() {
- rm -vrf $OBJECT_DIRECTORY
- }
- xmach_cmd_configure() {
- rm -rf $OBJECT_DIRECTORY/$FINAL_TARGET
- mkdir -pv $OBJECT_DIRECTORY/$FINAL_TARGET
- }
- xmach_cmd_build() {
- xmach_cmd_configure
- cd $OBJECT_DIRECTORY
- gcc -v $C_SOURCES -o $FINAL_TARGET/$APP_BIN_NAME
- }
- xmach_cmd_run() {
- exec $OBJECT_DIRECTORY/$FINAL_TARGET/$APP_BIN_NAME
- }
- # =====================================================================================================================
- # == | Main | =========================================================================================================
- "xmach_cmd_${@:1}"
- exit 0
- # =====================================================================================================================
|