X-Git-Url: https://deadsoftware.ru/gitweb?p=cpc.git;a=blobdiff_plain;f=make.sh;h=4551cab106ef4fa6eef1a657cb240806f43fc25e;hp=c0de9df21135b0fc5adf07c85f0eca39d5313daf;hb=b97962cb490f66c92f11336003d9007c0b0c867f;hpb=251568e0c1489842d392670644780b46ae38f83c diff --git a/make.sh b/make.sh index c0de9df..4551cab 100755 --- a/make.sh +++ b/make.sh @@ -19,6 +19,9 @@ _out="$_this/bin" _useposix=false +export CPCFLAGS="$CPCFLAGS" +export CPLFLAGS="$CPLFLAGS" + ###^^^^^^^^^^^### ### Functions ### ###___________### @@ -43,6 +46,8 @@ usage() { echo "Environment variables:" echo " CC C compiler binary" echo " CFLAGS C compiler options" + echo " CPCFLAGS CPC compiler options" + echo " CPLFLAGS CPL linker options" exit 2 } @@ -61,7 +66,7 @@ copy_source() { } native_compile() { - "$_compiler" -legacy "$@" + "$_compiler" $CPCFLAGS -legacy "$@" } native_link() { @@ -73,7 +78,7 @@ native_link() { _outsystem="win32" fi shift - "$_linker" -os "$_outsystem" -kernel Kernel -main Kernel -legacycodedir . -o "$_outexe" "$@" + "$_linker" $CPLFALGS -os "$_outsystem" -kernel Kernel -main Kernel -legacycodedir . -o "$_outexe" "$@" fi } @@ -100,14 +105,14 @@ cpfront_main_module() { } cpfront_compile() { - "$_compiler" -outcode CodeC -outsym SymC "$@" + "$_compiler" $CPCFLAGS -outcode CodeC -outsym SymC "$@" } cpfront_link() { local _main="$1" if $_docompile; then cpfront_main_module "$@" > "${_main}.cp" - "$_compiler" -outcode CodeC -outsym SymC -main "${_main}.cp" + "$_compiler" $CPCFLAGS -outcode CodeC -outsym SymC -main "${_main}.cp" fi shift if $_dolink; then @@ -118,7 +123,8 @@ cpfront_link() { done 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" ;; + *gcc) _cc_cflags="-std=c89 -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types -Wno-implicit-function-declaration" ;; + clang|clang-*) _cc_cflags="-std=c89 -Wno-int-conversion -Wno-incompatible-pointer-types -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses -Wno-pointer-sign -Wno-unused-value -Wno-return-type" ;; *) _cc_cflags="" ;; esac local _cpu_cflags= @@ -132,7 +138,7 @@ cpfront_link() { cygwin) _system_cflags="-liconv" ;; *) _system_cflags="" ;; esac - "$CC" $_cc_cflags $_cpu_cflags $CFLAGS -o "${_main}" -I "$_this/C" "$_this/C/SYSTEM.c" $_list -lm -ldl $_system_cflags + "$CC" -g -D_XOPEN_SOURCE=700 $_cc_cflags $_cpu_cflags $CFLAGS -o "${_main}" -I "$_this/C" "$_this/C/SYSTEM.c" $_list -lm -ldl -lffi $_system_cflags fi } @@ -167,6 +173,9 @@ compile_all() { Posix/Mod/Cdlfcn.cp Posix/Mod/Csignal.cp Posix/Mod/Csetjmp.cp \ Posix/Mod/Clibgen.cp \ Posix/Mod/Cmacro.cp + if [ "$_target" = "cpfront" ]; then + compile Lib/Mod/FFI.cp + fi fi ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^### @@ -182,11 +191,10 @@ compile_all() { fi compile System/Mod/Kernel.cp \ System/Mod/Console.odc System/Mod/Files.odc System/Mod/Dates.odc \ - System/Mod/Log.odc System/Mod/Strings.odc System/Mod/Services.odc \ - System/Mod/Integers.odc + System/Mod/Log.odc System/Mod/Strings.odc System/Mod/Meta.odc \ + System/Mod/Services.odc System/Mod/Integers.odc if [ "$_target" = "native" ]; then - compile System/Mod/Meta.odc mv -t System Code Sym fi