X-Git-Url: https://deadsoftware.ru/gitweb?p=cpc.git;a=blobdiff_plain;f=make.sh;h=af287d95d50bba19ba9f130fcf00ad95ee7fd416;hp=9aa6e5247ff581ff08502098c5b2a29e5603532a;hb=13d3d1de23a0b1215c4d68f28922bf311a201eca;hpb=e6f2dc69e5d8af2c60cf85c43fced7c370a9e427 diff --git a/make.sh b/make.sh index 9aa6e52..af287d9 100755 --- a/make.sh +++ b/make.sh @@ -39,6 +39,7 @@ usage() { echo " cpfront Generic C" echo "Operation systems:" echo " linux GNU/Linux" + echo " cygwin Cygwin" echo "Environment variables:" echo " CC C compiler binary" echo " CFLAGS C compiler options" @@ -65,8 +66,15 @@ native_compile() { native_link() { if $_dolink; then - "$_linker" -os "$_system" -kernel Kernel -main Kernel -legacycodedir . -o "$@" - fi + local _outexe="$1"; + local _outsystem="$_system" + if [ "$_system" = "cygwin" ]; then + _outexe="${_outexe}.exe" + _outsystem="win32" + fi + shift + "$_linker" -os "$_outsystem" -kernel Kernel -main Kernel -legacycodedir . -o "$_outexe" "$@" + fi } cpfront_import_list() { @@ -84,7 +92,11 @@ cpfront_import_list() { cpfront_main_module() { local _name="$1" shift - echo "MODULE ${_name};\n\n IMPORT $(cpfront_import_list "$@");\n\nEND ${_name}." + echo "MODULE ${_name};" + echo + echo " IMPORT $(cpfront_import_list "$@");" + echo + echo "END ${_name}." } cpfront_compile() { @@ -106,7 +118,7 @@ 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="-g -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types -Wno-implicit-function-declaration" ;; *) _cc_cflags="" ;; esac local _cpu_cflags= @@ -115,7 +127,12 @@ cpfront_link() { 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 + local _system_cflags= + case "$_system" in + 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 -lffi $_system_cflags fi } @@ -150,6 +167,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 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^### @@ -165,8 +185,8 @@ 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 mv -t System Code Sym @@ -296,6 +316,7 @@ esac case "$_system" in linux) _useposix=true ;; + cygwin) _useposix=true ;; "") error "operation system not specified" ;; *) error "unsuported operation system $_system" ;; esac