index 9aa6e5247ff581ff08502098c5b2a29e5603532a..2c0c53b4d632b0fb31c5737c08976cfa47a9fae7 100755 (executable)
--- a/make.sh
+++ b/make.sh
_useposix=false
_useposix=false
+export CPCFLAGS="$CPCFLAGS"
+export CPLFLAGS="$CPLFLAGS"
+
###^^^^^^^^^^^###
### Functions ###
###___________###
###^^^^^^^^^^^###
### Functions ###
###___________###
echo " cpfront Generic C"
echo "Operation systems:"
echo " linux GNU/Linux"
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"
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
}
exit 2
}
}
native_compile() {
}
native_compile() {
- "$_compiler" -legacy "$@"
+ "$_compiler" $CPCFLAGS -legacy "$@"
}
native_link() {
if $_dolink; then
}
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" $CPLFALGS -os "$_outsystem" -kernel Kernel -main Kernel -legacycodedir . -o "$_outexe" "$@"
+ fi
}
cpfront_import_list() {
}
cpfront_import_list() {
cpfront_main_module() {
local _name="$1"
shift
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() {
}
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"
}
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
fi
shift
if $_dolink; then
done
local _cc_cflags=
case "$CC" in
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=
*) _cc_cflags="" ;;
esac
local _cpu_cflags=
arm) _cpu_cflags="" ;;
*) error "cpfront_link(): unsupported cpu $_cpu" ;;
esac
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
}
fi
}
Posix/Mod/Cdlfcn.cp Posix/Mod/Csignal.cp Posix/Mod/Csetjmp.cp \
Posix/Mod/Clibgen.cp \
Posix/Mod/Cmacro.cp
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
###^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
fi
###^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
fi
compile System/Mod/Kernel.cp \
System/Mod/Console.odc System/Mod/Files.odc System/Mod/Dates.odc \
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
if [ "$_target" = "native" ]; then
mv -t System Code Sym
case "$_system" in
linux) _useposix=true ;;
case "$_system" in
linux) _useposix=true ;;
+ cygwin) _useposix=true ;;
"") error "operation system not specified" ;;
*) error "unsuported operation system $_system" ;;
esac
"") error "operation system not specified" ;;
*) error "unsuported operation system $_system" ;;
esac