#! /bin/sh

# Script parameters are passed in the following environment variables:
#   GSC_CC_O_GAMBCDIR
#   GSC_CC_O_OBJ_FILENAME
#   GSC_CC_O_C_FILENAME_DIR
#   GSC_CC_O_C_FILENAME_BASE
#   GSC_CC_O_CC_OPTIONS
#   GSC_CC_O_LD_OPTIONS_PRELUDE
#   GSC_CC_O_LD_OPTIONS

# echo GSC_CC_O_GAMBCDIR = "${GSC_CC_O_GAMBCDIR}"
# echo GSC_CC_O_OBJ_FILENAME = "${GSC_CC_O_OBJ_FILENAME}"
# echo GSC_CC_O_C_FILENAME_DIR = "${GSC_CC_O_C_FILENAME_DIR}"
# echo GSC_CC_O_C_FILENAME_BASE = "${GSC_CC_O_C_FILENAME_BASE}"
# echo GSC_CC_O_CC_OPTIONS = "${GSC_CC_O_CC_OPTIONS}"
# echo GSC_CC_O_LD_OPTIONS_PRELUDE = "${GSC_CC_O_LD_OPTIONS_PRELUDE}"
# echo GSC_CC_O_LD_OPTIONS = "${GSC_CC_O_LD_OPTIONS}"

cd "${GSC_CC_O_C_FILENAME_DIR}"

cc  -Wall -W -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -rdynamic -shared -I"${GSC_CC_O_GAMBCDIR}include" -D___DYNAMIC -D___SINGLE_HOST -o "${GSC_CC_O_OBJ_FILENAME}" ${GSC_CC_O_CC_OPTIONS} ${GSC_CC_O_LD_OPTIONS_PRELUDE} "${GSC_CC_O_C_FILENAME_BASE}" ${GSC_CC_O_LD_OPTIONS}
