X-Git-Url: https://deadsoftware.ru/gitweb?p=cpc.git;a=blobdiff_plain;f=make.sh;h=9aa6e5247ff581ff08502098c5b2a29e5603532a;hp=d466d2773aa85ecb1d7c2f6331ab7cbb6c455f21;hb=e6f2dc69e5d8af2c60cf85c43fced7c370a9e427;hpb=f569c33ab78c255f2bc2884abb22b177b4980244 diff --git a/make.sh b/make.sh index d466d27..9aa6e52 100755 --- a/make.sh +++ b/make.sh @@ -33,11 +33,15 @@ usage() { echo " -x Do not link" echo "Processors:" echo " 486 Intel 486+" + echo " arm ARM 32-bit" echo "Targets:" echo " native Native" echo " cpfront Generic C" echo "Operation systems:" echo " linux GNU/Linux" + echo "Environment variables:" + echo " CC C compiler binary" + echo " CFLAGS C compiler options" exit 2 } @@ -100,13 +104,18 @@ cpfront_link() { do _list="$_list ${_out}/CodeC/${_module}.c" done - ### !!! ADD $CC $CFLAGS $LDFLAGS ### - gcc -m32 -g -O0 -lm -ldl -o "$_out/$_main" \ - -Wno-int-conversion \ - -Wno-int-to-pointer-cast \ - -Wno-incompatible-pointer-types \ - -Wno-implicit-function-declaration \ - -I "$_this/C" "$_this/C/SYSTEM.c" $_list + local _cc_cflags= + case "$CC" in + *gcc) _cc_cflags="-Wno-int-conversion -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types -Wno-implicit-function-declaration" ;; + *) _cc_cflags="" ;; + esac + local _cpu_cflags= + case "$_cpu" in + 486) _cpu_cflags="-m32" ;; + arm) _cpu_cflags="" ;; + *) error "cpfront_link(): unsupported cpu $_cpu" ;; + esac + "$CC" $_cc_cflags $_cpu_cflags -lm -ldl $CFLAGS -o "${_main}" -I "$_this/C" "$_this/C/SYSTEM.c" $_list fi } @@ -263,12 +272,17 @@ _cpu="$1" _target="$2" _system="$3" +if [ -z "$CC" ]; then + export CC=cc +fi + ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^### ### Check for supported cpu/target/os ### ###___________________________________### case "$_cpu" in 386|486|586|686) _cpu=486 ;; + arm|armv6|armv7) _cpu=arm ;; "") error "cpu not specified" ;; *) error "unsupported cpu $_cpu" ;; esac @@ -336,7 +350,9 @@ fi ### Copy sources for changed system ### ###_________________________________### -$_docompile && rm -rf -- "$_out" +if $_docompile; then + rm -rf -- "$_out" +fi mkdir -p -- "$_out" _out="$(readlink -f "$_out")"