#!/usr/bin/env bash
#
#    ZEsarUX  ZX Second-Emulator And Released for UniX
#    Copyright (C) 2013 Cesar Hernandez Bano
#
#    This file is part of ZEsarUX.
#
#    ZEsarUX is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Nota: si se agregan carpetas nuevas de codigo fuente, agregar a:
# ONLYSOURCEFILES
# FILES_FOR_STATS
# CFLAGS
# Sacar lista con:
# A=`find . -name "*.c"|sort|cut -d '/' -f2|grep -v "\.c"|uniq` ; echo $A

CCOMPILER=gcc

echo
echo "Configuration script for ZEsarUX"
echo


#show dependencies
#for i in *.c; do INCLUDES=`cat $i|grep include|grep -v "<"|sed 's/#include "//'|sed 's/"//'` ; echo -n $i|sed 's/\.c/.o: /' ; echo -n "$i "; echo $INCLUDES; done


show_help()
{

        echo "Usage:"
	echo "--c-compiler CCOMPILER       Change C compiler (default: $CCOMPILER)"
        echo "--disable-stdout             Disable stdout driver"
	echo "--disable-simpletext         Disable simpletext driver"
        echo "--disable-curses             Disable curses driver"
        echo "--disable-cursesw             Disable cursesw driver (extended characters)"
        echo "--disable-aa                 Disable aalib driver"
        echo "--disable-caca               Disable cacalib driver"
        echo "--disable-xwindows           Disable xwindows driver"
        echo "--disable-xext               Disable xwindows extensions"
        echo "--disable-xvidmode           Disable xwindows vidmode extensions"
	echo "--disable-sdl                Disable SDL video & audio driver"
	echo "--disable-fbdev              Disable framebuffer driver"
        echo "--disable-dsp                Disable audio dsp driver"
        echo "--disable-onebitspeaker      Disable audio onebitspeaker driver"
        echo "--disable-alsa               Disable audio alsa driver"
        echo "--disable-pulse              Disable pulseaudio driver"
	echo "--disable-coreaudio          Disable Coreaudio Mac OS X audio"
	echo "--disable-sndfile            Disable sndfile functions"
        echo "--disable-pthreads           Disable using posix threads"
        echo "--disable-networking         Disable networking functions"
	echo "--disable-cocoa              Disable Cocoa Mac OS X native GUI"
	echo "--disable-linuxrealjoystick  Disable linux real joystick support"
	echo "--enable-undoc-scfccf        Enable SCF/CCF undocumented flags emulation"
	echo "--enable-memptr              Enable MEMPTR emulation (enabled by default)"
	echo "--disable-memptr             Disable MEMPTR emulation"
	echo "--enable-visualmem           Enable visual memory option on menu (enabled by default)"
	echo "--disable-visualmem          Disable visual memory option on menu"
	echo "--enable-cpustats            Enable CPU statistics option on menu (enabled by default)"
	echo "--disable-cpustats           Disable CPU statistics option on menu"
	echo "--enable-raspberry           Enable Raspberry extensions"
	echo "--enable-sdl2                Enable SDL2 libraries. Experimental"
	echo "--enable-ssl                 Enable ssl functions"
	echo "--disable-contend            Disable Contended Memory emulation"
	echo "--disable-putpixel-cache     Disable putpixel cache. Test feature"
	echo "--spectrum-reduced-core      Use reduced Spectrum core by default, recommended for slow devices like Raspberry Pi 1 and Zero. You can also switch it from command line or menu"
	echo
	echo "Installation directories:"
	echo "--prefix PREFIX              Install program files in PREFIX [/usr/local]"

	echo
	echo "Environment variables:"
	echo "CFLAGS                       C compiler flags"
	echo "LDFLAGS                      linker flags"
	echo
        exit 1


}

set_installprefix()
{
        INSTALLPREFIX="$1"
        INICIALINSTALLPREFIX=`echo -n $INSTALLPREFIX|cut -c1`
        if [ "$INICIALINSTALLPREFIX" != "/" ]; then
                echo "Error. Install prefix must start by /"
                exit 1
        fi

}


LOGFILE=config.log
echo "Begin configure on date `date`">$LOGFILE
echo "Configure sentence: $0 $@">>$LOGFILE





#Valores por defecto

OPTIONOBJCURSES="scrcurses.o"
OPTIONOBJCURSESW="cursesw_ext.o"
OPTIONOBJSTDOUT="scrstdout.o"
OPTIONOBJSIMPLETEXT="scrsimpletext.o"
OPTIONOBJFBDEV="scrfbdev.o"
OPTIONOBJXWINDOWS="scrxwindows.o"
OPTIONOBJSDL="scrsdl.o audiosdl.o common_sdl.o"
OPTIONOBJAA="scraa.o"
OPTIONOBJCACA="scrcaca.o"
OPTIONOBJDSP="audiodsp.o"
OPTIONOBJONEBITSPEAKER="audioonebitspeaker.o"
OPTIONOBJALSA="audioalsa.o"
OPTIONOBJPULSE="audiopulse.o"
OPTIONOBJCOREAUDIO="audiocoreaudio.o"
OPTIONLINUXREALJOYSTICK="realjoystick_linux.o"

OPTIONWINDOWSRESOURCE=""

#OPTIONOBJSSL="enabled"
OPTIONOBJSSL=""
OPTIONPTHREADS="enabled"
OPTIONNETWORKING="enabled"
OPTIONSNDFILE="enabled"
OPTIONXEXT="enabled"
OPTIONXVIDMODE="enabled"
INSTALLPREFIX="/usr/local"
OPTIONEMULATE_UNDOC_SCF_CCF=""
OPTIONEMULATE_MEMPTR="yes"
OPTIONEMULATE_VISUALMEM="yes"
OPTIONEMULATE_CPU_STATS="yes"
OPTIONEMULATE_RASPBERRY=""
OPTIONEMULATE_CONTEND="yes"
OPTIONPUTPIXELCACHE="yes"
OPTION_WORDS_BIGENDIAN=""
OPTIONCOCOA="enabled"
OPTIONREDUCED_CORE_SPECTRUM=""


LIBSDL="SDL"
TEXTOLIBSDL="sdl"
LIBPTHREADS_WIN=""

#programa que tiene la funcion main. por defecto main_unix
#si compila para mac os x gui (cocoa), se cambia por scrcocoa
MAINSOURCE="main_unix"

#Numero de build para versiones snapshot
BUILDNUMBER=`date +%s`


#Gestion parametros

#Guardamos la variable para luego meterla en el compileoptions.h y mostrarla con --showcompileinfo
CONFIGURE_OPTIONS="$@"
#esta tambien se mete en compileoptions.h y se muestra en --showcompileinfo
COMPILE_VARIABLES=""


while [ $# -gt 0 ]; do

#echo $1

 case "$1" in

	--help)
	show_help

	;;

	--c-compiler)
        shift
	CCOMPILER="$1"
	;;

 	--disable-stdout)
	OPTIONOBJSTDOUT=""
	;;

        --disable-simpletext)
        OPTIONOBJSIMPLETEXT=""
        ;;


        --disable-fbdev)
        OPTIONOBJFBDEV=""
        ;;


 	--disable-curses)
	OPTIONOBJCURSES=""
	;;

	--disable-cursesw)
	OPTIONOBJCURSESW=""
	;;

	--disable-aa)
	OPTIONOBJAA=""
	;;

	--disable-caca)
	OPTIONOBJCACA=""
	;;


	--disable-xwindows)
        OPTIONOBJXWINDOWS=""
        OPTIONXEXT=""
	OPTIONXVIDMODE=""
	;;

        --disable-sdl)
        OPTIONOBJSDL=""
        ;;

	--enable-sdl2)
	LIBSDL="SDL2"
	TEXTOLIBSDL="sdl2"
	OPTIONOBJSDL="scrsdl2.o audiosdl2.o common_sdl2.o"
	;;


	--disable-dsp)
	OPTIONOBJDSP=""
	;;

	--disable-onebitspeaker)
	OPTIONOBJONEBITSPEAKER=""
	;;

	#por compatibilidadhacia atras
	--disable-pcspeaker)
	OPTIONOBJONEBITSPEAKER=""
	;;

	--disable-alsa)
        OPTIONOBJALSA=""
	;;

        --disable-pulse)
        OPTIONOBJPULSE=""
        ;;


        --disable-coreaudio)
        OPTIONOBJCOREAUDIO=""
        ;;



	--disable-pthreads)
        OPTIONPTHREADS=""
	;;

	--disable-networking)
        OPTIONNETWORKING=""
	;;

        --disable-linuxrealjoystick)
	OPTIONLINUXREALJOYSTICK=""
	;;

	--disable-sndfile)
	OPTIONSNDFILE=""
	;;

	--disable-xext)
        OPTIONXEXT=""
	;;

	--disable-xvidmode)
	OPTIONXVIDMODE=""
	;;

	--enable-ssl)
	OPTIONOBJSSL="enabled"
	;;

	--disable-cocoa)
	OPTIONCOCOA=""
	;;

	--enable-undoc-scfccf)
	OPTIONEMULATE_UNDOC_SCF_CCF="yes"
	;;

	--enable-memptr)
	OPTIONEMULATE_MEMPTR="yes"
	;;

	--disable-memptr)
	OPTIONEMULATE_MEMPTR=""
	;;

	--enable-visualmem)
	OPTIONEMULATE_VISUALMEM="yes"
        ;;

	--disable-visualmem)
	OPTIONEMULATE_VISUALMEM=""
        ;;

        --enable-cpustats)
        OPTIONEMULATE_CPU_STATS="yes"
        ;;

        --disable-cpustats)
        OPTIONEMULATE_CPU_STATS=""
        ;;

        --enable-raspberry)
        OPTIONEMULATE_RASPBERRY="yes"
        ;;



        --disable-contend)
        OPTIONEMULATE_CONTEND=""
        ;;

	--disable-putpixel-cache)
	OPTIONPUTPIXELCACHE=""
	;;

	--spectrum-reduced-core)
	OPTIONREDUCED_CORE_SPECTRUM="yes"
	;;



	--prefix)
	shift
	set_installprefix "$1"
	;;

       *)

	#Ver si se pide --prefix=
	echo -n "$1"|grep "prefix=" > /dev/null
	if [ $? == 0 ]; then
		INST=`echo -n "$1"|cut -d '=' -f2`
		set_installprefix "$INST"
	else
		echo Unknown parameter $1
		show_help
	fi
	;;

esac

      shift

done


INITIALCFLAGS=$CFLAGS
INITIALLDFLAGS=$LDFLAGS

echo Initial CFLAGS=$INITIALCFLAGS
echo Initial LDFLAGS=$INITIALLDFLAGS

echo Initial CFLAGS=$INITIALCFLAGS >>$LOGFILE
echo Initial LDFLAGS=$INITIALLDFLAGS >>$LOGFILE


#LDFLAGS="$LDFLAGS -lm"

#en raspberry, char por defecto es unsigned, no signed
#agregar carpetas audio y video y cores etc
#agregar tambien carpeta . necesaria para que al compilar desde carpetas audio y video etc encuentre los includes de esta carpeta principal
CFLAGS="$CFLAGS -fsigned-char -I. -Iaudio -Icopy_interfaces -Icores -Icpus -Imachines -Imenu -Isnap -Istorage -Isoundchips -Ithird_party -Ivideo -Ivideo_chips -Izrcp -Izxvision"

# Si version snapshot, activar tambien warnings extra
# TODO: esto solo vale si el define esta justo al principio de linea
cat cpu.h|grep "^#define SNAPSHOT_VERSION" > /dev/null
if [ $? == 0 ]; then
    echo "Enabling all compiler warnings on snapshot version"
    CFLAGS="$CFLAGS -Wall -Wextra"
fi


#CFLAGS="$CFLAGS -Wunused-but-set-parameter -Wunused-but-set-variable -Wundef -Wuninitialized -Wunknown-pragmas -Wno-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable"
#CFLAGS="$CFLAGS -Wall -Wunused -Wunused-parameter "
# -Wno-format-overflow para que no muestre avisos en Linux tipo: note: ‘sprintf’ output 3 or more bytes (assuming 8193) into a destination of size 4096

#Comprobaciones
echo -n "Checking Operating system ... "
SISTEMA=`uname -o 2>>$LOGFILE`
#lo usamos para los menu About
if [ $? != 0 ]; then
	#para mac os x
	SISTEMA=`uname -s 2>>$LOGFILE`
fi

echo $SISTEMA


if [ "$SISTEMA" == "Msys" ]; then
	# compilamos el archivo de recurso para el icono
	OPTIONWINDOWSRESOURCE="zesarux.res"

	CFLAGS="$CFLAGS -DMINGW"
	#winmm son las librerias multimedia de windows, para usar el Midi
	#y agregar el icono

	LDFLAGS="zesarux.res $LDFLAGS -lwinmm"
fi


if [ "$SISTEMA" == "Haiku" ]; then
	CFLAGS="$CFLAGS -DHAIKU_OS"
	LDFLAGS="$LDFLAGS -lnetwork"
fi


# Ver si aplicamos definicion para llamadas de 64 bits en 32 bits (stat por ejemplo)

if [ "$SISTEMA" == "GNU/Linux" ]; then
	echo -n "Checking if 32 bit Linux ... "
	BITSSISTEMA=`uname -m`

	if [ "$BITSSISTEMA" == "i686" ] || [ "$BITSSISTEMA" == "i386" ]; then
		echo "Applying compiler definition to work with files larger than 2 GB on a 32 bit system"
		CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
	else
		echo "no"
	fi
fi

# obtener relase para sistemas Linux
# TODO: en windows, Mac y otros , obtener tambien release
SISTEMA_RELEASE="$SISTEMA"

if [ -e /etc/os-release ]; then
	SISTEMA_RELEASE=`cat /etc/os-release |grep PRETTY_NAME| head -n1 |cut -d '"' -f2`
fi

echo -n "Checking for $CCOMPILER compiler ... "

RESULT=`which $CCOMPILER`
if [ $? != 0 ]; then
	echo "No $CCOMPILER compiler found"
	exit 1
fi

echo $RESULT





echo -n "Checking size of char ... "
        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <stdio.h>
int main () {
printf ("%lu\n",sizeof(char));
return 0;
}
_EOF

$CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
CHARSIZE=`./$TEMPFILE.o`
rm -f $TEMPFILE $TEMPFILE.o
echo $CHARSIZE
if [ "$CHARSIZE" != "1" ]; then
	echo "Error"
	exit 1
fi


echo -n "Checking size of short ... "
        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <stdio.h>
int main () {
printf ("%lu\n",sizeof(short));
return 0;
}
_EOF

$CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
SHORTSIZE=`./$TEMPFILE.o`
rm -f $TEMPFILE $TEMPFILE.o
echo $SHORTSIZE
if [ "$SHORTSIZE" != "2" ]; then
        echo "Error"
        exit 1
fi


echo -n "Checking size of int ... "
        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <stdio.h>
int main () {
printf ("%lu\n",sizeof(int));
return 0;
}
_EOF

$CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
SHORTSIZE=`./$TEMPFILE.o`
rm -f $TEMPFILE $TEMPFILE.o
echo $SHORTSIZE
if [ "$SHORTSIZE" != "4" ]; then
        echo "Error"
        exit 1
fi


echo -n "Checking size of long long int ... "
        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <stdio.h>
int main () {
printf ("%lu\n",sizeof(long long int));
return 0;
}
_EOF

$CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
SHORTSIZE=`./$TEMPFILE.o`
rm -f $TEMPFILE $TEMPFILE.o
echo $SHORTSIZE
if [ "$SHORTSIZE" != "8" ]; then
        echo "Error"
        exit 1
fi


echo -n "Checking Little Endian System ... "

#RESULT=`echo -n I | hexdump -o | awk '{ print substr($2,6,1); exit}'`
RESULT=`echo -n I | od -to2 | awk '{ print substr($2,6,1); exit}'`
if [ "$RESULT" != "1" ]; then
	echo
	echo "WARNING! Big endian arquitecture. Not tested yet. Run at your own risk!"
	sleep 5
	OPTION_WORDS_BIGENDIAN="yes"
else

echo "ok"

fi


echo -n "Checking for stdout functions ... "
if [ "$OPTIONOBJSTDOUT" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <sys/select.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJSTDOUT=""
        else
                echo "found"
        fi
        rm -f $TEMPFILE $TEMPFILE.o

else
        echo "disabled"
fi


echo -n "Checking for simpletext functions ... "
if [ "$OPTIONOBJSIMPLETEXT" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <stdio.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJSIMPLETEXT=""
        else
                echo "found"
        fi
        rm -f $TEMPFILE $TEMPFILE.o

else
        echo "disabled"
fi



echo -n "Checking for fbdev functions ... "
if [ "$OPTIONOBJFBDEV" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <linux/fb.h>
#include <linux/vt.h>
#include <linux/kd.h>

int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJFBDEV=""
        else
                echo "found"
        fi
        rm -f $TEMPFILE $TEMPFILE.o

else
        echo "disabled"
fi

#ver si ncursesw
echo -n "Checking for cursesw libraries ... "
if [ "$OPTIONOBJCURSESW" != "" ]; then

	TEMPFILE="configure.compile.c"

	cat > $TEMPFILE << _EOF
#include <ncursesw/curses.h>
int main () {
return 0;
}
_EOF

	$CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
	RESULTCODE=$?
	if [ $RESULTCODE != 0 ]; then
		echo "not found"
		OPTIONOBJCURSESW=""
	else
		echo "found"
		    CFLAGS="$CFLAGS -I/usr/include/ncursesw -D_GNU_SOURCE -D_DEFAULT_SOURCE"
        	LDFLAGS="$LDFLAGS -lncursesw"
	fi



	rm -f $TEMPFILE $TEMPFILE.o

else
        echo "disabled"
fi


echo -n "Checking for curses libraries ... "
if [ "$OPTIONOBJCURSES" != "" ]; then
#en principio activo, probemos a compilar

	TEMPFILE="configure.compile.c"

	cat > $TEMPFILE << _EOF
#include <curses.h>
int main () {
return 0;
}
_EOF

	$CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
	RESULTCODE=$?
	if [ $RESULTCODE != 0 ]; then
		echo "not found"
		OPTIONOBJCURSES=""
	else
		echo "found"
			#nota: no debemos linkar contra las dos a la vez

		if [ "$OPTIONOBJCURSESW" == "" ]; then
        	LDFLAGS="$LDFLAGS -lncurses"
        fi
	fi


	rm -f $TEMPFILE $TEMPFILE.o



else
	echo "disabled"
fi



echo -n "Checking for aa libraries ... "
if [ "$OPTIONOBJAA" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <aalib.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJAA=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -laa"
        fi
        rm -f $TEMPFILE $TEMPFILE.o

else
        echo "disabled"
fi

echo -n "Checking for caca libraries ... "
if [ "$OPTIONOBJCACA" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <caca.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJCACA=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -lcaca"
        fi
        rm -f $TEMPFILE $TEMPFILE.o

else
        echo "disabled"
fi


echo -n "Checking for SSL libraries ... "
if [ "$OPTIONOBJSSL" != "" ]; then
#en principio activo, probemos a compilar

#parece que homebrew tiene las cabeceras aqui
if [ -d /usr/local/opt/openssl/include/ ]; then
	CFLAGS="$CFLAGS -I/usr/local/opt/openssl/include/"
	LDFLAGS="$LDFLAGS -L/usr/local/opt/openssl/lib"
fi


        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <openssl/md5.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJSSL=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -lssl -lcrypto"
        fi
        rm -f $TEMPFILE $TEMPFILE.o

else
        echo "disabled"
fi


echo -n "Checking for xwindows libraries ... "
if [ "$OPTIONOBJXWINDOWS" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <X11/Xlib.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS -I/usr/X11R6/include -I/opt/X11/include $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJXWINDOWS=""
		OPTIONXEXT=""
		OPTIONXVIDMODE=""
        else
                echo "found"
        	LDFLAGS="$LDFLAGS -lX11 -L/usr/X11R6/lib -L/opt/X11/lib"
        fi
	rm -f $TEMPFILE $TEMPFILE.o


else
	echo "disabled"
fi



echo -n "Checking for xwindows extensions ... "
if [ "$OPTIONXEXT" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS -I/usr/X11R6/include -I/opt/X11/include $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONXEXT=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -lXext"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi

echo -n "Checking for xwindows vidmode extensions ... "
if [ "$OPTIONXVIDMODE" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>

int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS -I/usr/X11R6/include -I/opt/X11/include $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found."
		echo "Warning. Fullscreen mode not available on XWindow driver"
		sleep 5
                OPTIONXVIDMODE=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -lXxf86vm"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi


echo -n "Checking for posix threads ... "
if [ "$OPTIONPTHREADS" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <pthread.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONPTHREADS=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -lpthread"

#pthreads implica tambien habilitar protocolo remoto y con ello api de sockets
		if [ "$SISTEMA" == "Msys" ]; then
			LDFLAGS="$LDFLAGS -lwsock32"
		fi


		#para la sentencia make windows
		LIBPTHREADS_WIN="pthreadGC2.dll pthreadGC-3.dll libgcc_s_dw2-1.dll libcrypto-1_1.dll libssl-1_1.dll"

        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi



echo -n "Checking for audio dsp ... "
if [ "$OPTIONOBJDSP" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <sys/soundcard.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJDSP=""
        else
                echo "found"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi



echo -n "Checking for audio onebitspeaker ... "
if [ "$OPTIONOBJONEBITSPEAKER" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <sys/io.h>
int main () {
int a=inb(0x61);
a++;
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?

	# Solo para linux. Antes de esta comprobacion me podria saltar la compilacion de prueba
	# pero lo hago para no liarlo mas y asi se parece a otras detecciones de drivers
	# ademas necesita pthreads
        if [ $RESULTCODE != 0 ] || [ "$SISTEMA" != "GNU/Linux" ] || [ "$OPTIONPTHREADS" == "" ]; then
                echo "not found"
                OPTIONOBJONEBITSPEAKER=""
        else
                echo "found"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi



echo -n "Checking for audio alsa ... "
if [ "$OPTIONOBJALSA" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <alsa/asoundlib.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJALSA=""
        else
                echo "found"
		LDFLAGS="$LDFLAGS -lasound"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi

echo -n "Checking for audio pulse ... "
if [ "$OPTIONOBJPULSE" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <pulse/pulseaudio.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJPULSE=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -lpulse -lpulse-simple"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi



echo -n "Checking for coreaudio ... "
if [ "$OPTIONOBJCOREAUDIO" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <CoreAudio/AudioHardware.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJCOREAUDIO=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices -framework CoreMIDI -framework IOKit"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi


echo -n "Checking for Cocoa Mac OS X GUI ... "
if [ "$OPTIONCOCOA" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.m"

        cat > $TEMPFILE << _EOF
#import <Cocoa/Cocoa.h>
int main () {
return 0;
}
_EOF

        clang $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?

        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONCOCOA=""
        else
                echo -n "found"

		if [ "$OPTIONPTHREADS" == "" ]; then
			echo ". But requires pthreads, and it is not enabled. Disabling Cocoa"
			OPTIONCOCOA=""

		else
			echo

			MAINSOURCE="scrcocoa"
        	        LDFLAGS="$LDFLAGS -framework Foundation -framework AppKit -framework OpenGL"

		fi
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi


#Hay que comprobar SDL2 despues de cocoa
echo -n "Checking for $TEXTOLIBSDL libraries ... "
if [ "$OPTIONOBJSDL" != "" ]; then


#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF

#if defined(__APPLE__)

	#include <SDL.h>

#else

	#include <$LIBSDL/SDL.h>

#endif

int main(int argc, char* argv[]) {
return 0;
}
_EOF

	if [ "$SISTEMA" == "Darwin" ]; then
		$CCOMPILER -c $CFLAGS -I/Library/Frameworks/$LIBSDL.framework/Headers -framework $LIBSDL -F/Library/Frameworks $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
	elif [ "$SISTEMA" == "Msys" ]; then
		#echo "$CCOMPILER -c $CFLAGS -Lc:\mingw\${LIBSDL}\lib -Ic:\mingw\${LIBSDL}\include -l$LIBSDL $TEMPFILE -o $TEMPFILE.o"
		#echo LIBSDL=${LIBSDL}
		#temp detectar libsdl1
		#$CCOMPILER -c $CFLAGS -Lc:\\mingw\\SDL2\\lib -Ic:\\mingw\\SDL2\\include -lSDL2 $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
		$CCOMPILER -c $CFLAGS -L/c/mingw/$LIBSDL/lib -I/c/mingw/$LIBSDL/include -lSDL2 $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
	else
        	$CCOMPILER -c $CFLAGS -l$LIBSDL $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
	fi
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONOBJSDL=""
        else
                echo -n "found"


                if [ "$SISTEMA" == "Darwin" ] && [ "$LIBSDL" == "SDL" ]; then
                                echo ". But it's incompatible with Mac OSX. Disabling SDL. Try using SDL2"
                                OPTIONOBJSDL=""

                else

			echo

			if [ "$SISTEMA" == "Darwin" ]; then
				CFLAGS="$CFLAGS -I/Library/Frameworks/$LIBSDL.framework/Headers"
				LDFLAGS="$LDFLAGS -framework $LIBSDL -F/Library/Frameworks"
			elif [ "$SISTEMA" == "Msys" ]; then
                                CFLAGS="$CFLAGS -I/c/mingw/$LIBSDL/include"
                                LDFLAGS="$LDFLAGS -L/c/mingw/$LIBSDL/lib -l$LIBSDL"
			else
		                LDFLAGS="$LDFLAGS -l$LIBSDL"
			fi

		fi
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi



echo -n "Checking for libsndfile ... "
if [ "$OPTIONSNDFILE" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sndfile.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER -I/usr/local $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?
        if [ $RESULTCODE != 0 ]; then
                echo "not found"
                OPTIONSNDFILE=""
        else
                echo "found"
                LDFLAGS="$LDFLAGS -lsndfile"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi


echo -n "Checking for linux real joystick ... "
if [ "$OPTIONLINUXREALJOYSTICK" != "" ]; then
#en principio activo, probemos a compilar

        TEMPFILE="configure.compile.c"

        cat > $TEMPFILE << _EOF
#include <linux/joystick.h>
#include <pthread.h>
int main () {
return 0;
}
_EOF

        $CCOMPILER $CFLAGS $TEMPFILE -o $TEMPFILE.o >> $LOGFILE 2>&1
        RESULTCODE=$?

	#necesita pthreads
        if [ $RESULTCODE != 0 ] || [ "$OPTIONPTHREADS" == "" ]; then
                echo "not found"
                OPTIONLINUXREALJOYSTICK=""

	else
                echo "found"
                LDFLAGS="$LDFLAGS -lpthread"
        fi
        rm -f $TEMPFILE $TEMPFILE.o


else
        echo "disabled"
fi






echo
echo Final CFLAGS=$CFLAGS
echo Final LDFLAGS=$LDFLAGS
echo Final CFLAGS=$CFLAGS >>$LOGFILE
echo Final LDFLAGS=$LDFLAGS >>$LOGFILE


#final

echo "Creating Makefile"
cat > Makefile << _EOF
EMULATOR_VERSION=12.1
CFLAGS=$CFLAGS
LDFLAGS=$LDFLAGS
CC=$CCOMPILER
INSTALLPREFIX=$INSTALLPREFIX


all: zesarux


zesarux: $OPTIONWINDOWSRESOURCE charset.o $OPTIONOBJSTDOUT $OPTIONOBJSIMPLETEXT $OPTIONOBJCURSES $OPTIONOBJCURSESW $OPTIONOBJAA $OPTIONOBJCACA $OPTIONOBJXWINDOWS $OPTIONOBJSDL $OPTIONOBJFBDEV autoselectoptions.o chardetect.o textspeech.o scrnull.o $OPTIONOBJDSP $OPTIONOBJONEBITSPEAKER $OPTIONOBJALSA $OPTIONOBJPULSE $OPTIONOBJCOREAUDIO $OPTIONLINUXREALJOYSTICK audionull.o ay38912.o sn76489an.o vdp_9918a.o vdp_9918a_sms.o msx.o svi.o coleco.o sg1000.o sms.o saa_simul.o cpu.o start.o z80_codsinpr.o z80_codprddfd.o z80_codpred.o operaciones.o debug.o tape.o tape_tap.o tape_tzx.o tape_pzx.o tape_smp.o audio.o audio_ayplayer.o audio_sine_table.o screen.o mem128.o chloe.o prism.o tbblue.o timex.o zx8081.o jupiterace.o z88.o cpc.o pcw.o sam.o atomlite.o zxuno.o snap.o snap_nex.o snap_zsf.o snap_ram.o snap_z81.o snap_zx8081.o snap_rzx.o snap_spg.o spg_depack.o zxvision.o zxvision_topbar.o menu_items.o menu_items_storage.o menu_filesel.o menu_file_viewer_browser.o menu_zeng_online.o menu_items_settings.o menu_debug_cpu.o menu_bitmaps.o about_logo.o settings.o core_spectrum.o core_reduced_spectrum.o core_zx8081.o core_z88.o core_cpc.o core_pcw.o core_ace.o core_sam.o core_ql.o core_mk14.o core_msx.o core_svi.o core_coleco.o core_sg1000.o core_sms.o mk14.o scmp.o timer.o contend.o disassemble.o utils.o utils_text_adventure.o playtzx.o mdvtool.o joystick.o ula.o mmc.o ide.o pd765.o dsk.o plus3dos_handler.o divmmc.o divide.o diviface.o zxpand.o lec.o superupgrade.o dandanator.o gs.o betadisk.o codetests.o kartusho.o samram.o ifrom.o enhanced_zx81_read.o hilow_datadrive.o hilow_barbanegra.o transtape.o mhpokeador.o specmate.o interface007.o dinamid3.o phoenix.o defcon.o ramjet.o datagear.o zxmmcplus.o spritefinder.o multiface.o spectra.o spritechip.o printers.o realjoystick.o ulaplus.o if1.o microdrive.o microdrive_raw.o ds1307.o ql.o ql_qdos_handler.o ql_i8049.o ql_zx8302.o m68kcpu.o m68kdasm.o m68kops.o  m68kopac.o m68kopdm.o m68kopnz.o chrome.o zxevo.o tsconf.o baseconf.o remote.o esxdos_handler.o assemble.o expression_parser.o chardevice.o uartbridge.o network.o zeng.o zeng_online.o zeng_online_client.o zvfs.o atomic.o stats.o sensors.o hilow_datadrive_audio.o scl2trd.o zip.o diskio.o ff.o ffsystem.o ffunicode.o $MAINSOURCE.o
	\$(CC) \$(CFLAGS) cpu.o $MAINSOURCE.o start.o charset.o $OPTIONOBJSTDOUT $OPTIONOBJSIMPLETEXT $OPTIONOBJCURSES $OPTIONOBJCURSESW $OPTIONOBJAA $OPTIONOBJCACA $OPTIONOBJXWINDOWS $OPTIONOBJSDL $OPTIONOBJFBDEV autoselectoptions.o chardetect.o textspeech.o scrnull.o screen.o mem128.o chloe.o prism.o tbblue.o timex.o $OPTIONOBJDSP $OPTIONOBJONEBITSPEAKER $OPTIONOBJALSA $OPTIONOBJPULSE $OPTIONOBJCOREAUDIO $OPTIONLINUXREALJOYSTICK audionull.o ay38912.o sn76489an.o vdp_9918a.o vdp_9918a_sms.o msx.o svi.o coleco.o sg1000.o sms.o saa_simul.o z80_codsinpr.o z80_codprddfd.o z80_codpred.o operaciones.o debug.o tape.o tape_tap.o tape_tzx.o tape_pzx.o tape_smp.o audio.o audio_ayplayer.o audio_sine_table.o zx8081.o jupiterace.o z88.o cpc.o pcw.o sam.o atomlite.o zxuno.o snap.o snap_nex.o snap_zsf.o snap_ram.o snap_z81.o snap_spg.o spg_depack.o snap_zx8081.o snap_rzx.o zxvision.o zxvision_topbar.o menu_items.o menu_items_storage.o menu_filesel.o menu_file_viewer_browser.o menu_zeng_online.o menu_items_settings.o menu_debug_cpu.o menu_bitmaps.o about_logo.o settings.o core_spectrum.o core_reduced_spectrum.o core_zx8081.o core_z88.o core_cpc.o core_pcw.o core_ace.o core_sam.o core_ql.o core_mk14.o core_msx.o core_svi.o core_coleco.o core_sg1000.o core_sms.o mk14.o scmp.o timer.o contend.o disassemble.o utils.o utils_text_adventure.o playtzx.o mdvtool.o joystick.o ula.o mmc.o ide.o pd765.o dsk.o plus3dos_handler.o divmmc.o divide.o diviface.o zxpand.o lec.o superupgrade.o dandanator.o gs.o betadisk.o codetests.o kartusho.o samram.o ifrom.o enhanced_zx81_read.o hilow_datadrive.o hilow_barbanegra.o transtape.o mhpokeador.o specmate.o interface007.o dinamid3.o phoenix.o defcon.o ramjet.o datagear.o spritefinder.o zxmmcplus.o multiface.o spectra.o spritechip.o printers.o realjoystick.o ulaplus.o ds1307.o if1.o microdrive.o microdrive_raw.o ql.o ql_qdos_handler.o ql_i8049.o ql_zx8302.o m68kcpu.o m68kdasm.o m68kops.o  m68kopac.o m68kopdm.o m68kopnz.o chrome.o zxevo.o tsconf.o baseconf.o remote.o esxdos_handler.o assemble.o expression_parser.o chardevice.o uartbridge.o network.o zeng.o zeng_online.o zeng_online_client.o zvfs.o atomic.o stats.o sensors.o hilow_datadrive_audio.o scl2trd.o zip.o diskio.o ff.o ffsystem.o ffunicode.o -o zesarux \$(LDFLAGS)
	@echo
	@echo "Compilation finished"
	@echo "You can run it without installing by typing ./zesarux (or just zesarux on Windows)"
	@echo

charset.o: charset.c charset.h zxvision/zxvision.h
	\$(CC) \$(CFLAGS) -c charset.c

scrnull.o: video/scrnull.c video/scrnull.h debug.h video/screen.h cpu.h settings.h
	\$(CC) \$(CFLAGS) -c video/scrnull.c

z80_codprddfd.o: cpus/z80_codprddfd.c cpu.h operaciones.h debug.h contend.h utils.h compileoptions.h settings.h
	\$(CC) \$(CFLAGS) -c cpus/z80_codprddfd.c

z80_codpred.o: cpus/z80_codpred.c cpu.h operaciones.h debug.h contend.h machines/zxuno.h machines/tbblue.h video/screen.h settings.h storage/samram.h
	\$(CC) \$(CFLAGS) -c cpus/z80_codpred.c

z80_codsinpr.o: cpus/z80_codsinpr.c cpu.h operaciones.h debug.h contend.h utils.h compileoptions.h machines/z88.h snap/snap_rzx.h storage/esxdos_handler.h settings.h
	\$(CC) \$(CFLAGS) -c cpus/z80_codsinpr.c

operaciones.o: operaciones.c cpu.h operaciones.h debug.h audio/audio.h storage/tape.h soundchips/ay38912.h mem128.h machines/chloe.h machines/prism.h machines/tbblue.h machines/timex.h machines/zx8081.h zxvision/zxvision.h video/screen.h compileoptions.h contend.h joystick.h ula.h utils.h printers.h third_party/disassemble.h machines/z88.h video_chips/ulaplus.h machines/zxuno.h chardetect.h storage/mmc.h storage/ide.h storage/divmmc.h storage/divide.h storage/diviface.h storage/zxpand.h video_chips/spectra.h video_chips/spritechip.h machines/jupiterace.h machines/cpc.h machines/sam.h storage/if1.h timer.h storage/pd765.h storage/superupgrade.h snap/snap_rzx.h copy_interfaces/multiface.h machines/chrome.h machines/zxevo.h machines/tsconf.h machines/baseconf.h ds1307.h machines/mk14.h settings.h soundchips/saa_simul.h datagear.h storage/hilow_datadrive.h machines/msx.h machines/coleco.h machines/sg1000.h machines/sms.h machines/svi.h video_chips/vdp_9918a.h soundchips/gs.h storage/samram.h video_chips/vdp_9918a_sms.h copy_interfaces/hilow_barbanegra.h copy_interfaces/transtape.h copy_interfaces/phoenix.h copy_interfaces/defcon.h copy_interfaces/ramjet.h storage/plus3dos_handler.h machines/pcw.h dsk.h utils_text_adventure.h storage/lec.h storage/zxmmcplus.h
	\$(CC) \$(CFLAGS) -c operaciones.c

cpu.o: cpu.c cpu.h start.h video/scrnull.h video/scrstdout.h video/scrsimpletext.h operaciones.h debug.h compileoptions.h storage/tape.h storage/tape_tap.h storage/tape_tzx.h audio/audio.h video/screen.h soundchips/ay38912.h machines/chloe.h machines/prism.h machines/tbblue.h mem128.h machines/timex.h video/scrcurses.h video/scraa.h video/scrxwindows.h video/scrsdl.h video/scrfbdev.h audio/audiodsp.h audio/audioonebitspeaker.h audio/audiosdl.h audio/audionull.h audio/audioalsa.h audio/audiopulse.h machines/zx8081.h snap/snap.h zxvision/zxvision.h cores/core_spectrum.h cores/core_zx8081.h cores/core_z88.h storage/tape_smp.h contend.h utils.h utils_text_adventure.h ula.h printers.h joystick.h realjoystick.h machines/z88.h video_chips/ulaplus.h autoselectoptions.h machines/zxuno.h chardetect.h textspeech.h storage/mmc.h storage/ide.h storage/divmmc.h storage/divide.h storage/diviface.h storage/zxpand.h video_chips/spectra.h video_chips/spritechip.h machines/jupiterace.h machines/cpc.h machines/sam.h storage/if1.h storage/atomlite.h storage/dandanator.h storage/kartusho.h storage/ifrom.h spritefinder.h storage/superupgrade.h machines/ql.h zrcp/remote.h snap/snap_rzx.h copy_interfaces/multiface.h machines/chrome.h machines/zxevo.h machines/tsconf.h machines/baseconf.h cpus/scmp.h machines/mk14.h storage/esxdos_handler.h storage/betadisk.h storage/pd765.h settings.h datagear.h network.h stats.h storage/hilow_datadrive.h machines/msx.h machines/svi.h machines/coleco.h soundchips/sn76489an.h machines/sg1000.h machines/sms.h machines/ql_qdos_handler.h machines/ql_i8049.h snap/snap_ram.h menu/menu_items.h charset.h menu/menu_filesel.h menu/menu_debug_cpu.h copy_interfaces/hilow_barbanegra.h copy_interfaces/transtape.h copy_interfaces/mhpokeador.h copy_interfaces/specmate.h copy_interfaces/phoenix.h copy_interfaces/defcon.h copy_interfaces/ramjet.h copy_interfaces/interface007.h copy_interfaces/dinamid3.h dsk.h storage/plus3dos_handler.h machines/pcw.h storage/lec.h audio/audio_ayplayer.h storage/zxmmcplus.h
	\$(CC) \$(CFLAGS) -c cpu.c

start.o: start.c start.h cpu.h video/scrnull.h video/scrstdout.h video/scrsimpletext.h operaciones.h debug.h compileoptions.h storage/tape.h storage/tape_tap.h storage/tape_tzx.h audio/audio.h video/screen.h soundchips/ay38912.h machines/chloe.h machines/prism.h machines/tbblue.h mem128.h machines/timex.h video/scrcurses.h video/scraa.h video/scrxwindows.h video/scrsdl.h video/scrfbdev.h audio/audiodsp.h audio/audioonebitspeaker.h audio/audiosdl.h audio/audionull.h audio/audioalsa.h audio/audiopulse.h machines/zx8081.h snap/snap.h zxvision/zxvision.h cores/core_spectrum.h cores/core_zx8081.h cores/core_z88.h storage/tape_smp.h contend.h utils.h utils_text_adventure.h ula.h printers.h joystick.h realjoystick.h machines/z88.h video_chips/ulaplus.h autoselectoptions.h machines/zxuno.h chardetect.h textspeech.h storage/mmc.h storage/ide.h storage/divmmc.h storage/divide.h storage/diviface.h storage/zxpand.h video_chips/spectra.h video_chips/spritechip.h machines/jupiterace.h machines/cpc.h machines/sam.h storage/if1.h storage/atomlite.h storage/dandanator.h storage/kartusho.h storage/ifrom.h spritefinder.h storage/superupgrade.h machines/ql.h zrcp/remote.h snap/snap_rzx.h copy_interfaces/multiface.h machines/chrome.h machines/zxevo.h machines/tsconf.h machines/baseconf.h cpus/scmp.h machines/mk14.h storage/esxdos_handler.h storage/betadisk.h codetests.h storage/pd765.h settings.h datagear.h network.h stats.h storage/hilow_datadrive.h machines/msx.h machines/svi.h machines/coleco.h soundchips/sn76489an.h machines/sg1000.h machines/sms.h machines/ql_qdos_handler.h machines/ql_i8049.h snap/snap_ram.h menu/menu_items.h charset.h menu/menu_filesel.h menu/menu_debug_cpu.h copy_interfaces/hilow_barbanegra.h copy_interfaces/transtape.h copy_interfaces/mhpokeador.h copy_interfaces/specmate.h copy_interfaces/phoenix.h copy_interfaces/defcon.h copy_interfaces/ramjet.h copy_interfaces/interface007.h copy_interfaces/dinamid3.h dsk.h storage/plus3dos_handler.h machines/pcw.h zrcp/zeng_online.h zrcp/zeng_online_client.h storage/microdrive.h storage/microdrive_raw.h debug_nested_functions.h audio/audio_ayplayer.h storage/zxmmcplus.h
	\$(CC) \$(CFLAGS) -c start.c

core_reduced_spectrum.o: cores/core_reduced_spectrum.c cores/core_reduced_spectrum.h cores/core_spectrum.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h ula.h utils.h realjoystick.h storage/divmmc.h storage/divide.h storage/diviface.h machines/timex.h machines/zxuno.h machines/prism.h snap/snap_rzx.h storage/superupgrade.h storage/pd765.h machines/zxevo.h machines/tsconf.h machines/baseconf.h settings.h snap/snap_zsf.h zrcp/zeng.h zrcp/zeng_online.h snap/snap_ram.h storage/pd765.h
	\$(CC) \$(CFLAGS) -c cores/core_reduced_spectrum.c

core_spectrum.o: cores/core_spectrum.c cores/core_spectrum.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h ula.h utils.h realjoystick.h storage/divmmc.h storage/divide.h storage/diviface.h machines/timex.h machines/zxuno.h machines/prism.h snap/snap_rzx.h storage/superupgrade.h storage/pd765.h machines/zxevo.h machines/tsconf.h machines/baseconf.h machines/tbblue.h settings.h datagear.h snap/snap_zsf.h zrcp/zeng.h zrcp/zeng_online.h ds1307.h soundchips/gs.h snap/snap_ram.h cpus/z80_codsinpr.h menu/menu_items.h menu/menu_items_storage.h storage/plus3dos_handler.h storage/pd765.h zrcp/zeng_online_client.h storage/if1.h
	\$(CC) \$(CFLAGS) -c cores/core_spectrum.c

core_zx8081.o: cores/core_zx8081.c cores/core_zx8081.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h machines/zx8081.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h ula.h settings.h snap/snap_zsf.h zrcp/zeng.h zrcp/zeng_online.h snap/snap_ram.h zrcp/zeng_online_client.h menu/menu_items_storage.h
	\$(CC) \$(CFLAGS) -c cores/core_zx8081.c

core_ace.o: cores/core_ace.c cores/core_ace.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h machines/jupiterace.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h ula.h settings.h zrcp/zeng.h zrcp/zeng_online.h snap/snap_zsf.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_ace.c

core_ql.o: cores/core_ql.c cores/core_ql.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h ula.h settings.h machines/ql_i8049.h machines/ql_qdos_handler.h machines/ql_zx8302.h zrcp/zeng.h zrcp/zeng_online.h snap/snap_zsf.h snap/snap_ram.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_ql.c

core_mk14.o: cores/core_mk14.c cores/core_mk14.h cpus/scmp.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h ula.h settings.h snap/snap_zsf.h zrcp/zeng.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_mk14.c

core_msx.o: cores/core_msx.c cores/core_msx.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h  settings.h machines/msx.h snap/snap_ram.h cpus/z80_codsinpr.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_msx.c

core_svi.o: cores/core_svi.c cores/core_svi.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h  settings.h machines/svi.h snap/snap_ram.h cpus/z80_codsinpr.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_svi.c

core_coleco.o: cores/core_coleco.c cores/core_coleco.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h  settings.h machines/coleco.h video_chips/vdp_9918a.h soundchips/sn76489an.h video_chips/vdp_9918a_sms.h snap/snap_ram.h cpus/z80_codsinpr.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_coleco.c

core_sg1000.o: cores/core_sg1000.c cores/core_sg1000.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h  settings.h machines/sg1000.h video_chips/vdp_9918a.h soundchips/sn76489an.h video_chips/vdp_9918a_sms.h snap/snap_ram.h cpus/z80_codsinpr.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_sg1000.c

core_sms.o: cores/core_sms.c cores/core_sms.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h soundchips/ay38912.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h snap/snap_zx8081.h utils.h realjoystick.h  settings.h machines/sms.h video_chips/vdp_9918a.h soundchips/sn76489an.h video_chips/vdp_9918a_sms.h snap/snap_ram.h cpus/z80_codsinpr.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_sms.c

core_z88.o: cores/core_z88.c cores/core_z88.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h ula.h utils.h machines/z88.h audio/audio.h utils.h settings.h snap/snap_zsf.h zrcp/zeng.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_z88.c

core_cpc.o: cores/core_cpc.c cores/core_cpc.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h ula.h utils.h audio/audio.h utils.h storage/tape.h machines/cpc.h realjoystick.h settings.h snap/snap_zsf.h zrcp/zeng.h zrcp/zeng_online.h snap/snap_ram.h storage/pd765.h zrcp/zeng_online_client.h audio/audio_ayplayer.h
	\$(CC) \$(CFLAGS) -c cores/core_cpc.c

core_pcw.o: cores/core_pcw.c cores/core_pcw.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h ula.h utils.h audio/audio.h utils.h storage/tape.h machines/pcw.h realjoystick.h settings.h snap/snap_zsf.h zrcp/zeng.h zrcp/zeng_online.h snap/snap_ram.h storage/pd765.h zrcp/zeng_online_client.h audio/audio_ayplayer.h
	\$(CC) \$(CFLAGS) -c cores/core_pcw.c

core_sam.o: cores/core_sam.c cores/core_sam.h cpu.h debug.h storage/tape.h audio/audio.h video/screen.h operaciones.h snap/snap.h timer.h zxvision/zxvision.h chardetect.h compileoptions.h contend.h ula.h utils.h audio/audio.h utils.h storage/tape.h machines/cpc.h realjoystick.h settings.h soundchips/ay38912.h snap/snap_zsf.h zrcp/zeng.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c cores/core_sam.c

mk14.o: machines/mk14.c machines/mk14.h cpu.h debug.h cpus/scmp.h utils.h zxvision/zxvision.h
	\$(CC) \$(CFLAGS) -c machines/mk14.c

scmp.o: cpus/scmp.c cpus/scmp.h cpu.h operaciones.h
	\$(CC) \$(CFLAGS) -c cpus/scmp.c


timer.o: timer.c timer.h cpu.h start.h audio/audio.h debug.h zxvision/zxvision.h storage/tape.h video/screen.h compileoptions.h machines/zx8081.h joystick.h utils.h printers.h machines/z88.h autoselectoptions.h machines/zxuno.h textspeech.h storage/mmc.h storage/ide.h storage/zxpand.h storage/superupgrade.h snap/snap.h snap/snap_rzx.h machines/ql.h storage/esxdos_handler.h storage/betadisk.h storage/pd765.h settings.h machines/ql_i8049.h machines/cpc.h snap/snap_ram.h storage/hilow_datadrive.h dsk.h menu/menu_items.h menu/menu_items_storage.h machines/pcw.h zrcp/zeng_online.h zrcp/zeng_online_client.h zxvision/zxvision_topbar.h storage/microdrive.h storage/microdrive_raw.h audio/audio_ayplayer.h storage/zxmmcplus.h
	\$(CC) \$(CFLAGS) -c timer.c


debug.o: debug.c cpu.h debug.h mem128.h machines/timex.h video/screen.h zxvision/zxvision.h machines/zx8081.h operaciones.h cores/core_spectrum.h cores/core_reduced_spectrum.h cores/core_zx8081.h cores/core_z88.h cores/core_ace.h cores/core_cpc.h cores/core_pcw.h cores/core_msx.h cores/core_svi.h cores/core_coleco.h cores/core_sg1000.h cores/core_sms.h cores/core_ql.h cores/core_sam.h cores/core_mk14.h third_party/disassemble.h utils.h machines/prism.h  video_chips/spectra.h machines/tbblue.h machines/zxuno.h video_chips/ulaplus.h machines/timex.h soundchips/ay38912.h ula.h machines/ql.h cpus/m68k.h storage/superupgrade.h cpus/scmp.h storage/dandanator.h storage/kartusho.h storage/ifrom.h spritefinder.h copy_interfaces/multiface.h machines/chloe.h machines/cpc.h machines/sam.h snap/snap.h storage/diviface.h storage/betadisk.h machines/zxevo.h machines/tsconf.h machines/baseconf.h zrcp/remote.h charset.h settings.h datagear.h expression_parser.h atomic.h machines/msx.h machines/coleco.h soundchips/sn76489an.h machines/svi.h video_chips/vdp_9918a.h machines/ql_zx8302.h storage/ide.h storage/mmc.h storage/esxdos_handler.h video_chips/vdp_9918a_sms.h menu/menu_debug_cpu.h copy_interfaces/transtape.h copy_interfaces/hilow_barbanegra.h storage/pd765.h machines/pcw.h storage/if1.h storage/microdrive.h storage/microdrive_raw.h storage/lec.h storage/zxmmcplus.h
	\$(CC) \$(CFLAGS) -c debug.c

tape.o: storage/tape.c storage/tape.h cpu.h operaciones.h debug.h storage/tape_tap.h storage/tape_tzx.h storage/tape_pzx.h storage/tape_smp.h machines/chloe.h machines/prism.h mem128.h machines/timex.h snap/snap.h compileoptions.h video/screen.h machines/zx8081.h zxvision/zxvision.h snap/snap_z81.h utils.h audio/audio.h video/screen.h autoselectoptions.h machines/zxuno.h timer.h storage/superupgrade.h copy_interfaces/multiface.h machines/chrome.h machines/zxevo.h machines/tsconf.h machines/baseconf.h snap/snap_spg.h machines/tbblue.h settings.h machines/msx.h storage/samram.h menu/menu_items.h zvfs.h copy_interfaces/hilow_barbanegra.h copy_interfaces/transtape.h dsk.h
	\$(CC) \$(CFLAGS) -c storage/tape.c

tape_tap.o: storage/tape_tap.c storage/tape_tap.h storage/tape.h cpu.h operaciones.h debug.h
	\$(CC) \$(CFLAGS) -c storage/tape_tap.c

tape_smp.o: storage/tape_smp.c storage/tape_smp.h storage/tape.h cpu.h operaciones.h debug.h machines/zx8081.h snap/snap.h zxvision/zxvision.h snap/snap_zx8081.h utils.h settings.h
	\$(CC) \$(CFLAGS) -c storage/tape_smp.c

tape_tzx.o: storage/tape_tzx.c storage/tape_tzx.h storage/tape.h cpu.h operaciones.h debug.h utils.h zvfs.h settings.h
	\$(CC) \$(CFLAGS) -c storage/tape_tzx.c

tape_pzx.o: storage/tape_pzx.c storage/tape_pzx.h storage/tape.h cpu.h operaciones.h debug.h utils.h zvfs.h settings.h snap/snap.h
	\$(CC) \$(CFLAGS) -c storage/tape_pzx.c

audio.o: audio/audio.c audio/audio.h cpu.h start.h debug.h video/screen.h utils.h machines/zx8081.h audio/audionull.h machines/jupiterace.h autoselectoptions.h operaciones.h machines/cpc.h settings.h audio/audio_sine_table.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h soundchips/sn76489an.h machines/ql_i8049.h compileoptions.h zvfs.h menu/menu_filesel.h atomic.h menu/menu_items.h timer.h zrcp/zeng_online_client.h audio/audio_ayplayer.h
	\$(CC) \$(CFLAGS) -c audio/audio.c

audio_ayplayer.o: audio/audio_ayplayer.c audio/audio_ayplayer.h audio/audio.h cpu.h debug.h autoselectoptions.h utils.h operaciones.h machines/cpc.h soundchips/ay38912.h zvfs.h start.h menu/menu_items.h menu/menu_filesel.h
	\$(CC) \$(CFLAGS) -c audio/audio_ayplayer.c

audio_sine_table.o: audio/audio_sine_table.c audio/audio_sine_table.h audio/audio.h
	\$(CC) \$(CFLAGS) -c audio/audio_sine_table.c

audionull.o: audio/audionull.c audio/audionull.h cpu.h debug.h audio/audio.h settings.h
	\$(CC) \$(CFLAGS) -c audio/audionull.c

ay38912.o: soundchips/ay38912.c soundchips/ay38912.h cpu.h audio/audio.h joystick.h debug.h
	\$(CC) \$(CFLAGS) -c soundchips/ay38912.c

sn76489an.o: soundchips/sn76489an.c soundchips/sn76489an.h cpu.h audio/audio.h joystick.h debug.h
	\$(CC) \$(CFLAGS) -c soundchips/sn76489an.c

vdp_9918a.o: video_chips/vdp_9918a.c video_chips/vdp_9918a.h cpu.h debug.h video/screen.h settings.h video_chips/vdp_9918a_sms.h
	\$(CC) \$(CFLAGS) -c video_chips/vdp_9918a.c

vdp_9918a_sms.o: video_chips/vdp_9918a_sms.c video_chips/vdp_9918a_sms.h video_chips/vdp_9918a.h cpu.h debug.h video/screen.h settings.h
	\$(CC) \$(CFLAGS) -c video_chips/vdp_9918a_sms.c

msx.o: machines/msx.c machines/msx.h cpu.h debug.h video_chips/vdp_9918a.h storage/tape.h video/screen.h audio/audio.h operaciones.h joystick.h settings.h
	\$(CC) \$(CFLAGS) -c machines/msx.c

svi.o: machines/svi.c machines/svi.h cpu.h debug.h video_chips/vdp_9918a.h storage/tape.h video/screen.h audio/audio.h operaciones.h joystick.h settings.h
	\$(CC) \$(CFLAGS) -c machines/svi.c

coleco.o: machines/coleco.c machines/coleco.h cpu.h debug.h video_chips/vdp_9918a.h video/screen.h audio/audio.h soundchips/sn76489an.h joystick.h video_chips/vdp_9918a_sms.h settings.h
	\$(CC) \$(CFLAGS) -c machines/coleco.c

sg1000.o: machines/sg1000.c machines/sg1000.h cpu.h debug.h video_chips/vdp_9918a.h video/screen.h audio/audio.h soundchips/sn76489an.h joystick.h video_chips/vdp_9918a_sms.h settings.h
	\$(CC) \$(CFLAGS) -c machines/sg1000.c

sms.o: machines/sms.c machines/sms.h cpu.h debug.h video_chips/vdp_9918a.h video/screen.h audio/audio.h soundchips/sn76489an.h joystick.h video_chips/vdp_9918a_sms.h settings.h
	\$(CC) \$(CFLAGS) -c machines/sms.c

saa_simul.o: soundchips/saa_simul.c soundchips/saa_simul.h soundchips/ay38912.h cpu.h audio/audio.h debug.h
	\$(CC) \$(CFLAGS) -c soundchips/saa_simul.c

screen.o: video/screen.c video/screen.h cpu.h debug.h mem128.h machines/chloe.h machines/prism.h machines/timex.h machines/cpc.h machines/prism.h operaciones.h machines/zx8081.h charset.h zxvision/zxvision.h menu/menu_bitmaps.h audio/audio.h contend.h ula.h storage/tape_smp.h machines/z88.h video_chips/ulaplus.h machines/zxuno.h video_chips/spectra.h video_chips/spritechip.h timer.h machines/sam.h machines/ql.h machines/chrome.h machines/zxevo.h machines/tsconf.h machines/baseconf.h machines/mk14.h video_chips/vdp_9918a.h machines/msx.h machines/coleco.h machines/ql_zx8302.h stats.h video_chips/vdp_9918a_sms.h menu/menu_items.h chardetect.h machines/pcw.h textspeech.h zrcp/zeng_online_client.h storage/tape.h
	\$(CC) \$(CFLAGS) -c video/screen.c

mem128.o: mem128.c cpu.h mem128.h debug.h contend.h machines/zxuno.h machines/chloe.h machines/prism.h machines/timex.h machines/sam.h ula.h machines/tbblue.h storage/superupgrade.h machines/chrome.h machines/zxevo.h machines/tsconf.h machines/baseconf.h machines/msx.h machines/coleco.h machines/sg1000.h machines/sms.h machines/svi.h storage/if1.h
	\$(CC) \$(CFLAGS) -c mem128.c

timex.o: machines/timex.c machines/timex.h cpu.h debug.h contend.h storage/tape.h mem128.h zxvision/zxvision.h machines/chloe.h machines/prism.h machines/zxuno.h machines/tbblue.h settings.h
	\$(CC) \$(CFLAGS) -c machines/timex.c

chloe.o: machines/chloe.c machines/chloe.h cpu.h machines/timex.h mem128.h debug.h contend.h machines/zxuno.h machines/timex.h machines/prism.h
	\$(CC) \$(CFLAGS) -c machines/chloe.c

chrome.o: machines/chrome.c machines/chrome.h cpu.h mem128.h debug.h contend.h
	\$(CC) \$(CFLAGS) -c machines/chrome.c

zxevo.o: machines/zxevo.c machines/zxevo.h cpu.h mem128.h debug.h contend.h zxvision/zxvision.h video/screen.h ula.h operaciones.h
	\$(CC) \$(CFLAGS) -c machines/zxevo.c

tsconf.o: machines/tsconf.c machines/tsconf.h cpu.h mem128.h debug.h contend.h zxvision/zxvision.h video/screen.h ula.h operaciones.h machines/zxevo.h chardevice.h uartbridge.h
	\$(CC) \$(CFLAGS) -c machines/tsconf.c

baseconf.o: machines/baseconf.c machines/baseconf.h cpu.h mem128.h debug.h contend.h zxvision/zxvision.h video/screen.h ula.h operaciones.h machines/zxevo.h
	\$(CC) \$(CFLAGS) -c machines/baseconf.c

prism.o: machines/prism.c machines/prism.h cpu.h machines/timex.h mem128.h debug.h contend.h machines/zxuno.h machines/timex.h utils.h zxvision/zxvision.h
	\$(CC) \$(CFLAGS) -c machines/prism.c

remote.o: zrcp/remote.c zrcp/remote.h cpu.h start.h debug.h utils.h compileoptions.h network.h machines/ql.h third_party/disassemble.h zxvision/zxvision.h menu/menu_items.h audio/audio.h timer.h video/screen.h soundchips/ay38912.h charset.h storage/diviface.h ula.h storage/superupgrade.h machines/tbblue.h machines/zxevo.h machines/tsconf.h machines/baseconf.h operaciones.h snap/snap.h storage/kartusho.h storage/ifrom.h settings.h datagear.h storage/esxdos_handler.h assemble.h expression_parser.h joystick.h snap/snap_zsf.h autoselectoptions.h zrcp/zeng.h zrcp/zeng_online.h machines/ql_qdos_handler.h storage/tape.h snap/snap_ram.h storage/mmc.h menu/menu_debug_cpu.h atomic.h audio/audio_ayplayer.h
	\$(CC) \$(CFLAGS) -c zrcp/remote.c

network.o: network.c network.h cpu.h debug.h utils.h compileoptions.h chardevice.h atomic.h
	\$(CC) \$(CFLAGS) -c network.c

zeng.o: zrcp/zeng.c zrcp/zeng.h cpu.h debug.h utils.h network.h compileoptions.h zrcp/remote.h snap/snap_zsf.h autoselectoptions.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c zrcp/zeng.c

zeng_online.o: zrcp/zeng_online.c zrcp/zeng_online.h cpu.h debug.h utils.h network.h compileoptions.h zrcp/remote.h snap/snap_zsf.h autoselectoptions.h soundchips/ay38912.h atomic.h stats.h textspeech.h settings.h timer.h
	\$(CC) \$(CFLAGS) -c zrcp/zeng_online.c

zeng_online_client.o: zrcp/zeng_online_client.c zrcp/zeng_online_client.h cpu.h debug.h utils.h network.h compileoptions.h zrcp/remote.h snap/snap_zsf.h zrcp/zeng_online.h zrcp/zeng.h stats.h video/screen.h timer.h autoselectoptions.h textspeech.h settings.h mem128.h ula.h
	\$(CC) \$(CFLAGS) -c zrcp/zeng_online_client.c

zvfs.o: zvfs.c zvfs.h cpu.h debug.h utils.h third_party/ff.h compileoptions.h
	\$(CC) \$(CFLAGS) -c zvfs.c

atomic.o: atomic.c atomic.h compileoptions.h
	\$(CC) \$(CFLAGS) -c atomic.c

scl2trd.o: third_party/scl2trd.c third_party/scl2trd.h debug.h utils.h zvfs.h
	\$(CC) \$(CFLAGS) -c third_party/scl2trd.c

zip.o: third_party/zip.c third_party/zip.h miniz.h debug.h
	\$(CC) \$(CFLAGS) -c third_party/zip.c

diskio.o: third_party/diskio.c third_party/diskio.h third_party/ff.h third_party/ffconf.h utils.h
	\$(CC) \$(CFLAGS) -c third_party/diskio.c

ff.o: third_party/ff.c third_party/ff.h third_party/ffconf.h third_party/diskio.h
	\$(CC) \$(CFLAGS) -c third_party/ff.c

ffsystem.o: third_party/ffsystem.c third_party/ffconf.h third_party/ff.h
	\$(CC) \$(CFLAGS) -c third_party/ffsystem.c

ffunicode.o: third_party/ffunicode.c third_party/ffconf.h third_party/ff.h
	\$(CC) \$(CFLAGS) -c third_party/ffunicode.c

stats.o: stats.c stats.h cpu.h zxvision/zxvision.h compileoptions.h debug.h network.h video/screen.h timer.h
	\$(CC) \$(CFLAGS) -c stats.c

sensors.o: sensors.c sensors.h cpu.h debug.h soundchips/ay38912.h video/screen.h zxvision/zxvision.h timer.h stats.h audio/audio.h soundchips/sn76489an.h zrcp/zeng_online_client.h ula.h machines/tbblue.h
	\$(CC) \$(CFLAGS) -c sensors.c

esxdos_handler.o: storage/esxdos_handler.c storage/esxdos_handler.h cpu.h operaciones.h debug.h utils.h storage/diviface.h video/screen.h menu/menu_filesel.h storage/mmc.h storage/divmmc.h menu/menu_items.h
	\$(CC) \$(CFLAGS) -c storage/esxdos_handler.c

tbblue.o: machines/tbblue.c machines/tbblue.h cpu.h mem128.h debug.h contend.h utils.h zxvision/zxvision.h storage/divmmc.h storage/diviface.h video/screen.h machines/timex.h audio/audio.h datagear.h soundchips/ay38912.h copy_interfaces/multiface.h uartbridge.h settings.h joystick.h operaciones.h
	\$(CC) \$(CFLAGS) -c machines/tbblue.c

zx8081.o: machines/zx8081.c machines/zx8081.h cpu.h video/screen.h debug.h audio/audio.h cores/core_zx8081.h operaciones.h zxvision/zxvision.h ula.h storage/zxpand.h
	\$(CC) \$(CFLAGS) -c machines/zx8081.c

jupiterace.o: machines/jupiterace.c machines/jupiterace.h cpu.h video/screen.h debug.h audio/audio.h cores/core_ace.h operaciones.h zxvision/zxvision.h
	\$(CC) \$(CFLAGS) -c machines/jupiterace.c

z88.o: machines/z88.c machines/z88.h cpu.h video/screen.h debug.h cores/core_z88.h contend.h joystick.h zxvision/zxvision.h operaciones.h utils.h timer.h compileoptions.h
	\$(CC) \$(CFLAGS) -c machines/z88.c

cpc.o: machines/cpc.c machines/cpc.h cpu.h video/screen.h debug.h cores/core_cpc.h contend.h joystick.h zxvision/zxvision.h operaciones.h utils.h soundchips/ay38912.h storage/tape.h dsk.h storage/pd765.h audio/audio_ayplayer.h
	\$(CC) \$(CFLAGS) -c machines/cpc.c

pcw.o: machines/pcw.c machines/pcw.h cpu.h video/screen.h debug.h cores/core_pcw.h contend.h joystick.h zxvision/zxvision.h operaciones.h utils.h audio/audio.h dsk.h storage/pd765.h ula.h soundchips/ay38912.h settings.h
	\$(CC) \$(CFLAGS) -c machines/pcw.c

sam.o: machines/sam.c machines/sam.h cpu.h video/screen.h debug.h cores/core_sam.h contend.h joystick.h zxvision/zxvision.h operaciones.h utils.h
	\$(CC) \$(CFLAGS) -c machines/sam.c

atomlite.o: storage/atomlite.c storage/atomlite.h cpu.h video/screen.h debug.h zxvision/zxvision.h operaciones.h utils.h storage/ide.h
	\$(CC) \$(CFLAGS) -c storage/atomlite.c

zxuno.o: machines/zxuno.c machines/zxuno.h cpu.h debug.h contend.h mem128.h utils.h ula.h video/screen.h zxvision/zxvision.h storage/divmmc.h storage/diviface.h soundchips/ay38912.h video_chips/ulaplus.h operaciones.h machines/chloe.h chardevice.h uartbridge.h menu/menu_items.h
	\$(CC) \$(CFLAGS) -c machines/zxuno.c

#ql.o: 68000.c 68000_debug.c op68kadd.c op68karith.c op68ksub.c op68klogop.c op68kmisc.c op68kmove.c op68kshift.c 68000_additional.c machines/ql.c
#	\$(CC) \$(CFLAGS) -c 68000.c 68000_debug.c op68kadd.c op68karith.c op68ksub.c op68klogop.c op68kmisc.c op68kmove.c op68kshift.c 68000_additional.c machines/ql.c

ql.o: machines/ql.c machines/ql.h debug.h cpus/m68k.h utils.h zxvision/zxvision.h operaciones.h settings.h machines/ql_i8049.h machines/ql_zx8302.h compileoptions.h
	\$(CC) \$(CFLAGS) -c machines/ql.c

ql_qdos_handler.o: machines/ql_qdos_handler.c machines/ql_qdos_handler.h machines/ql.h debug.h cpus/m68k.h utils.h zxvision/zxvision.h operaciones.h settings.h machines/ql_i8049.h machines/ql_zx8302.h menu/menu_items.h timer.h
	\$(CC) \$(CFLAGS) -c machines/ql_qdos_handler.c

ql_i8049.o: machines/ql_i8049.c machines/ql_i8049.h debug.h utils.h machines/ql.h audio/audio.h
	\$(CC) \$(CFLAGS) -c machines/ql_i8049.c

ql_zx8302.o: machines/ql_zx8302.c machines/ql_zx8302.h debug.h utils.h machines/ql.h machines/ql_i8049.h timer.h
	\$(CC) \$(CFLAGS) -c machines/ql_zx8302.c


m68kcpu.o: cpus/m68kcpu.c
	\$(CC) \$(CFLAGS) -c cpus/m68kcpu.c

m68kdasm.o: cpus/m68kdasm.c
	\$(CC) \$(CFLAGS) -c cpus/m68kdasm.c

m68kops.o: cpus/m68kops.c
	\$(CC) \$(CFLAGS) -c cpus/m68kops.c

m68kopac.o: cpus/m68kopac.c
	\$(CC) \$(CFLAGS) -c cpus/m68kopac.c

m68kopdm.o: cpus/m68kopdm.c
	\$(CC) \$(CFLAGS) -c cpus/m68kopdm.c

m68kopnz.o: cpus/m68kopnz.c
	\$(CC) \$(CFLAGS) -c cpus/m68kopnz.c



snap.o: snap/snap.c snap/snap.h cpu.h debug.h operaciones.h machines/zx8081.h mem128.h soundchips/ay38912.h compileoptions.h autoselectoptions.h soundchips/ay38912.h storage/tape_smp.h audio/audio.h video/screen.h zxvision/zxvision.h storage/tape.h snap/snap_z81.h snap/snap_zx8081.h snap/snap_rzx.h utils.h ula.h joystick.h realjoystick.h machines/z88.h chardetect.h machines/jupiterace.h machines/cpc.h machines/timex.h machines/zxuno.h video_chips/ulaplus.h machines/chloe.h machines/prism.h storage/diviface.h snap/snap_rzx.h machines/chrome.h machines/zxevo.h machines/tsconf.h machines/baseconf.h snap/snap_spg.h settings.h machines/tbblue.h storage/esxdos_handler.h snap/snap_nex.h
	\$(CC) \$(CFLAGS) -c snap/snap.c

snap_nex.o: snap/snap_nex.c snap/snap_nex.h cpu.h debug.h operaciones.h mem128.h compileoptions.h autoselectoptions.h ula.h machines/timex.h settings.h machines/tbblue.h storage/esxdos_handler.h joystick.h
	\$(CC) \$(CFLAGS) -c snap/snap_nex.c

snap_zsf.o: snap/snap_zsf.c snap/snap_zsf.h cpu.h debug.h operaciones.h machines/zx8081.h mem128.h soundchips/ay38912.h compileoptions.h autoselectoptions.h soundchips/ay38912.h storage/tape_smp.h audio/audio.h video/screen.h zxvision/zxvision.h storage/tape.h snap/snap_z81.h snap/snap_zx8081.h snap/snap_rzx.h utils.h ula.h joystick.h realjoystick.h machines/z88.h chardetect.h machines/jupiterace.h machines/cpc.h machines/timex.h machines/zxuno.h video_chips/ulaplus.h machines/chloe.h machines/prism.h storage/diviface.h snap/snap_rzx.h machines/chrome.h machines/zxevo.h machines/tsconf.h machines/baseconf.h storage/divmmc.h storage/divide.h machines/tbblue.h machines/msx.h video_chips/vdp_9918a.h machines/coleco.h machines/sg1000.h machines/sms.h soundchips/sn76489an.h cpus/m68k.h machines/ql_zx8302.h machines/ql_i8049.h video_chips/vdp_9918a_sms.h settings.h cpus/scmp.h machines/mk14.h machines/chrome.h machines/sam.h machines/pcw.h zrcp/zeng_online_client.h datagear.h
	\$(CC) \$(CFLAGS) -c snap/snap_zsf.c

snap_ram.o: snap/snap_ram.c snap/snap_ram.h cpu.h debug.h operaciones.h snap/snap_zsf.h zxvision/zxvision.h autoselectoptions.h
	\$(CC) \$(CFLAGS) -c snap/snap_ram.c

snap_z81.o: snap/snap_z81.c snap/snap_z81.h cpu.h debug.h operaciones.h snap/snap.h
	\$(CC) \$(CFLAGS) -c snap/snap_z81.c

snap_spg.o: snap/snap_spg.c snap/snap_spg.h cpu.h debug.h operaciones.h snap/snap.h mem128.h machines/tsconf.h
	\$(CC) \$(CFLAGS) -c snap/snap_spg.c

spg_depack.o: snap/spg_depack.c
	\$(CC) \$(CFLAGS) -c snap/spg_depack.c

snap_zx8081.o: snap/snap_zx8081.c snap/snap_zx8081.h cpu.h debug.h operaciones.h machines/zx8081.h audio/audio.h video/screen.h storage/tape.h storage/tape_smp.h snap/snap_z81.h zxvision/zxvision.h snap/snap.h utils.h settings.h
	\$(CC) \$(CFLAGS) -c snap/snap_zx8081.c

snap_rzx.o: snap/snap_rzx.c snap/snap_rzx.h snap/snap.h cpu.h debug.h operaciones.h utils.h zxvision/zxvision.h video/screen.h
	\$(CC) \$(CFLAGS) -c snap/snap_rzx.c

zxvision.o: zxvision/zxvision.c zxvision/zxvision.h zxvision/zxvision_topbar.h menu/menu_items.h menu/menu_items_storage.h menu/menu_items_settings.h menu/menu_bitmaps.h menu/menu_debug_cpu.h menu/menu_file_viewer_browser.h menu/menu_zeng_online.h video/screen.h cpu.h start.h debug.h soundchips/ay38912.h storage/tape.h audio/audio.h timer.h operaciones.h utils.h joystick.h ula.h realjoystick.h video/scrstdout.h autoselectoptions.h charset.h chardetect.h textspeech.h machines/prism.h machines/cpc.h machines/sam.h machines/tbblue.h zrcp/remote.h machines/tsconf.h settings.h stats.h network.h machines/ql.h zvfs.h menu/menu_filesel.h storage/pd765.h dsk.h zrcp/zeng_online_client.h machines/ql_qdos_handler.h machines/ql_i8049.h
	\$(CC) \$(CFLAGS) -c zxvision/zxvision.c

zxvision_topbar.o: zxvision/zxvision_topbar.c zxvision/zxvision.h cpu.h joystick.h debug.h settings.h menu/menu_items.h menu/menu_items_settings.h
	\$(CC) \$(CFLAGS) -c zxvision/zxvision_topbar.c

menu_filesel.o: menu/menu_filesel.c menu/menu_filesel.h zxvision/zxvision.h menu/menu_file_viewer_browser.h video/screen.h cpu.h debug.h timer.h utils.h compileoptions.h third_party/ff.h third_party/diskio.h zvfs.h snap/snap.h joystick.h textspeech.h network.h ula.h settings.h
	\$(CC) \$(CFLAGS) -c menu/menu_filesel.c

menu_items_storage.o: menu/menu_items_storage.c menu/menu_items.h zxvision/zxvision.h menu/menu_items_settings.h menu/menu_debug_cpu.h menu/menu_zeng_online.h menu/menu_file_viewer_browser.h video/screen.h cpu.h start.h debug.h machines/zx8081.h soundchips/ay38912.h compileoptions.h storage/tape.h audio/audio.h timer.h snap/snap.h operaciones.h third_party/disassemble.h utils.h contend.h joystick.h ula.h printers.h realjoystick.h video/scrstdout.h machines/z88.h video_chips/ulaplus.h autoselectoptions.h charset.h chardetect.h textspeech.h  storage/mmc.h storage/ide.h storage/divmmc.h storage/divide.h storage/diviface.h storage/zxpand.h video_chips/spectra.h video_chips/spritechip.h machines/jupiterace.h machines/timex.h machines/chloe.h machines/cpc.h machines/prism.h machines/sam.h storage/if1.h storage/pd765.h storage/atomlite.h machines/tbblue.h storage/dandanator.h storage/kartusho.h storage/ifrom.h spritefinder.h copy_interfaces/multiface.h storage/superupgrade.h cpus/m68k.h zrcp/remote.h snap/snap_rzx.h copy_interfaces/multiface.h cpus/scmp.h storage/esxdos_handler.h machines/zxevo.h machines/tsconf.h machines/baseconf.h snap/snap_spg.h storage/betadisk.h storage/tape_tzx.h snap/snap_zsf.h settings.h datagear.h assemble.h expression_parser.h uartbridge.h zrcp/zeng.h zrcp/zeng_online.h network.h stats.h video_chips/vdp_9918a.h machines/msx.h machines/coleco.h machines/sg1000.h machines/sms.h machines/svi.h soundchips/sn76489an.h machines/ql_qdos_handler.h machines/ql_i8049.h soundchips/gs.h zvfs.h video_chips/vdp_9918a_sms.h snap/snap_ram.h sensors.h storage/samram.h storage/hilow_datadrive.h menu/menu_filesel.h menu/menu_bitmaps.h utils_text_adventure.h about_logo.h storage/hilow_datadrive_audio.h copy_interfaces/hilow_barbanegra.h copy_interfaces/transtape.h copy_interfaces/mhpokeador.h copy_interfaces/specmate.h copy_interfaces/phoenix.h copy_interfaces/defcon.h copy_interfaces/ramjet.h copy_interfaces/interface007.h copy_interfaces/dinamid3.h dsk.h storage/plus3dos_handler.h machines/pcw.h zrcp/zeng_online.h machines/mk14.h storage/microdrive.h storage/microdrive_raw.h storage/lec.h zesarux.h storage/zxmmcplus.h enhanced_zx81_read.h
	\$(CC) \$(CFLAGS) -c menu/menu_items_storage.c

menu_items.o: menu/menu_items.c menu/menu_items.h menu/menu_items_storage.h zxvision/zxvision.h menu/menu_items_settings.h menu/menu_debug_cpu.h menu/menu_zeng_online.h menu/menu_file_viewer_browser.h video/screen.h cpu.h start.h debug.h machines/zx8081.h soundchips/ay38912.h compileoptions.h storage/tape.h audio/audio.h timer.h snap/snap.h operaciones.h third_party/disassemble.h utils.h contend.h joystick.h ula.h printers.h realjoystick.h video/scrstdout.h machines/z88.h video_chips/ulaplus.h autoselectoptions.h machines/zxuno.h charset.h chardetect.h textspeech.h  storage/mmc.h storage/ide.h storage/divmmc.h storage/divide.h storage/diviface.h storage/zxpand.h video_chips/spectra.h video_chips/spritechip.h machines/jupiterace.h machines/timex.h machines/chloe.h machines/cpc.h machines/prism.h machines/sam.h storage/if1.h storage/pd765.h storage/atomlite.h machines/tbblue.h storage/dandanator.h spritefinder.h copy_interfaces/multiface.h cpus/m68k.h zrcp/remote.h snap/snap_rzx.h copy_interfaces/multiface.h cpus/scmp.h storage/esxdos_handler.h machines/zxevo.h machines/tsconf.h machines/baseconf.h snap/snap_spg.h storage/betadisk.h storage/tape_tzx.h snap/snap_zsf.h settings.h datagear.h assemble.h expression_parser.h uartbridge.h zrcp/zeng.h zrcp/zeng_online.h network.h stats.h video_chips/vdp_9918a.h machines/msx.h machines/coleco.h machines/sg1000.h machines/sms.h machines/svi.h soundchips/sn76489an.h machines/ql_qdos_handler.h machines/ql_i8049.h soundchips/gs.h zvfs.h video_chips/vdp_9918a_sms.h snap/snap_ram.h sensors.h storage/samram.h menu/menu_filesel.h menu/menu_bitmaps.h utils_text_adventure.h about_logo.h copy_interfaces/transtape.h copy_interfaces/mhpokeador.h copy_interfaces/specmate.h copy_interfaces/phoenix.h copy_interfaces/defcon.h copy_interfaces/ramjet.h copy_interfaces/interface007.h copy_interfaces/dinamid3.h dsk.h storage/plus3dos_handler.h machines/pcw.h zrcp/zeng_online.h machines/mk14.h storage/microdrive.h storage/microdrive_raw.h storage/lec.h audio/audio_ayplayer.h storage/zxmmcplus.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c menu/menu_items.c

menu_file_viewer_browser.o: menu/menu_file_viewer_browser.c zxvision/zxvision.h compileoptions.h video/screen.h cpu.h debug.h settings.h zvfs.h snap/snap.h storage/tape_tzx.h machines/msx.h snap/snap_spg.h snap/snap_zsf.h storage/hilow_datadrive.h menu/menu_items.h menu/menu_items_storage.h machines/zx8081.h storage/microdrive.h storage/microdrive_raw.h
	\$(CC) \$(CFLAGS) -c menu/menu_file_viewer_browser.c

menu_zeng_online.o: menu/menu_zeng_online.c zxvision/zxvision.h menu/menu_items.h compileoptions.h video/screen.h cpu.h debug.h network.h zrcp/zeng_online_client.h zrcp/zeng_online.h stats.h settings.h
	\$(CC) \$(CFLAGS) -c menu/menu_zeng_online.c

menu_items_settings.o: menu/menu_items_settings.c menu/menu_items_settings.h menu/menu_items_storage.h zxvision/zxvision.h menu/menu_file_viewer_browser.h video/screen.h cpu.h start.h debug.h machines/zx8081.h soundchips/ay38912.h compileoptions.h storage/tape.h audio/audio.h timer.h snap/snap.h operaciones.h third_party/disassemble.h utils.h contend.h joystick.h ula.h printers.h realjoystick.h video/scrstdout.h machines/z88.h video_chips/ulaplus.h autoselectoptions.h machines/zxuno.h charset.h chardetect.h textspeech.h  storage/mmc.h storage/ide.h storage/divmmc.h storage/divide.h storage/diviface.h storage/zxpand.h video_chips/spectra.h video_chips/spritechip.h machines/jupiterace.h machines/timex.h machines/chloe.h machines/cpc.h machines/prism.h machines/sam.h storage/if1.h storage/pd765.h storage/atomlite.h machines/tbblue.h storage/dandanator.h storage/kartusho.h storage/ifrom.h spritefinder.h storage/superupgrade.h cpus/m68k.h zrcp/remote.h snap/snap_rzx.h copy_interfaces/multiface.h cpus/scmp.h storage/esxdos_handler.h machines/zxevo.h machines/tsconf.h machines/baseconf.h snap/snap_spg.h storage/betadisk.h storage/tape_tzx.h snap/snap_zsf.h settings.h datagear.h assemble.h expression_parser.h uartbridge.h zrcp/zeng.h zrcp/zeng_online.h network.h stats.h video_chips/vdp_9918a.h machines/msx.h machines/coleco.h machines/sg1000.h machines/sms.h machines/svi.h soundchips/sn76489an.h machines/ql_qdos_handler.h machines/ql_i8049.h soundchips/gs.h zvfs.h video_chips/vdp_9918a_sms.h snap/snap_ram.h sensors.h storage/samram.h snap/snap_zx8081.h menu/menu_bitmaps.h menu/menu_filesel.h menu/menu_debug_cpu.h machines/pcw.h utils_text_adventure.h
	\$(CC) \$(CFLAGS) -c menu/menu_items_settings.c

menu_debug_cpu.o: menu/menu_debug_cpu.c menu/menu_debug_cpu.h zxvision/zxvision.h cpu.h debug.h cpus/scmp.h cpus/m68k.h machines/zx8081.h machines/z88.h settings.h operaciones.h video/screen.h joystick.h machines/tbblue.h ula.h timer.h audio/audio.h machines/prism.h menu/menu_items.h menu/menu_filesel.h third_party/disassemble.h soundchips/ay38912.h realjoystick.h utils_text_adventure.h
	\$(CC) \$(CFLAGS) -c menu/menu_debug_cpu.c

menu_bitmaps.o: menu/menu_bitmaps.c menu/menu_bitmaps.h settings.h
	\$(CC) \$(CFLAGS) -c menu/menu_bitmaps.c

about_logo.o: about_logo.c about_logo.h
	\$(CC) \$(CFLAGS) -c about_logo.c

settings.o: settings.c settings.h menu/menu_items.h zxvision/zxvision.h video/screen.h cpu.h debug.h machines/zx8081.h soundchips/ay38912.h compileoptions.h storage/tape.h audio/audio.h timer.h snap/snap.h operaciones.h third_party/disassemble.h utils.h contend.h joystick.h ula.h printers.h realjoystick.h video/scrstdout.h machines/z88.h video_chips/ulaplus.h autoselectoptions.h machines/zxuno.h charset.h chardetect.h textspeech.h  storage/mmc.h storage/ide.h storage/divmmc.h storage/divide.h storage/diviface.h storage/zxpand.h video_chips/spectra.h video_chips/spritechip.h machines/jupiterace.h machines/timex.h machines/chloe.h machines/cpc.h machines/prism.h machines/sam.h storage/if1.h storage/pd765.h storage/atomlite.h machines/tbblue.h storage/dandanator.h storage/kartusho.h storage/ifrom.h spritefinder.h copy_interfaces/multiface.h storage/superupgrade.h cpus/m68k.h zrcp/remote.h snap/snap_rzx.h copy_interfaces/multiface.h cpus/scmp.h storage/esxdos_handler.h machines/zxevo.h machines/tsconf.h machines/baseconf.h snap/snap_spg.h storage/betadisk.h storage/tape_tzx.h snap/snap_zsf.h datagear.h
	\$(CC) \$(CFLAGS) -c settings.c

disassemble.o: third_party/disassemble.c third_party/disassemble.h cpu.h operaciones.h debug.h machines/ql.h utils.h cpus/scmp.h zxvision/zxvision.h machines/tbblue.h utils_text_adventure.h menu/menu_debug_cpu.h
	\$(CC) \$(CFLAGS) -c third_party/disassemble.c

utils.o: utils.c utils.h cpu.h start.h debug.h joystick.h compileoptions.h storage/tape.h snap/snap.h video/screen.h realjoystick.h zxvision/zxvision.h machines/z88.h third_party/playtzx.h storage/tape_tzx.h storage/tape_pzx.h operaciones.h machines/zx8081.h autoselectoptions.h video_chips/ulaplus.h soundchips/ay38912.h textspeech.h video_chips/spectra.h machines/zxuno.h video_chips/spritechip.h machines/timex.h machines/cpc.h machines/sam.h storage/divmmc.h storage/divide.h storage/superupgrade.h chardetect.h machines/zx8081.h machines/jupiterace.h storage/mmc.h storage/ide.h storage/zxpand.h storage/diviface.h storage/divmmc.h storage/divide.h storage/dandanator.h storage/kartusho.h storage/ifrom.h spritefinder.h machines/ql.h cpus/m68k.h zrcp/remote.h ula.h snap/snap_rzx.h cpus/scmp.h machines/mk14.h storage/esxdos_handler.h machines/tbblue.h machines/zxevo.h machines/tsconf.h machines/baseconf.h third_party/mdvtool.h storage/betadisk.h storage/pd765.h settings.h datagear.h zrcp/zeng.h zrcp/zeng_online.h network.h stats.h third_party/scl2trd.h third_party/zip.h machines/msx.h machines/coleco.h machines/sg1000.h machines/sms.h machines/svi.h charset.h snap/snap_zsf.h machines/ql_qdos_handler.h machines/ql_i8049.h storage/samram.h third_party/ff.h third_party/diskio.h third_party/ffconf.h zvfs.h snap/snap_ram.h menu/menu_items.h menu/menu_items_storage.h storage/tape_smp.h menu/menu_file_viewer_browser.h menu/menu_filesel.h utils_text_adventure.h menu/menu_debug_cpu.h storage/hilow_datadrive.h storage/hilow_datadrive_audio.h copy_interfaces/transtape.h copy_interfaces/mhpokeador.h copy_interfaces/specmate.h copy_interfaces/phoenix.h copy_interfaces/defcon.h copy_interfaces/ramjet.h copy_interfaces/interface007.h copy_interfaces/dinamid3.h dsk.h storage/plus3dos_handler.h machines/pcw.h menu/menu_bitmaps.h zrcp/zeng_online_client.h zrcp/zeng_online.h storage/if1.h storage/microdrive.h storage/microdrive_raw.h storage/lec.h audio/audio_ayplayer.h storage/zxmmcplus.h enhanced_zx81_read.h
	\$(CC) \$(CFLAGS) -c utils.c


utils_text_adventure.o: utils_text_adventure.c utils_text_adventure.h utils.h cpu.h debug.h compileoptions.h operaciones.h machines/cpc.h video/screen.h menu/menu_items.h
	\$(CC) \$(CFLAGS) -c utils_text_adventure.c

playtzx.o: third_party/playtzx.c third_party/playtzx.h debug.h audio/audio.h utils.h
	\$(CC) \$(CFLAGS) -c third_party/playtzx.c

mdvtool.o: third_party/mdvtool.c third_party/mdvtool.h debug.h utils.h soundchips/ay38912.h
	\$(CC) \$(CFLAGS) -c third_party/mdvtool.c

contend.o: contend.c contend.h cpu.h debug.h video/screen.h compileoptions.h video_chips/ulaplus.h machines/zxuno.h ula.h machines/tbblue.h
	\$(CC) \$(CFLAGS) -c contend.c

joystick.o: joystick.c joystick.h cpu.h debug.h video/screen.h zxvision/zxvision.h zrcp/zeng.h zrcp/zeng_online.h
	\$(CC) \$(CFLAGS) -c joystick.c

ula.o: ula.c ula.h cpu.h start.h debug.h video/screen.h contend.h zxvision/zxvision.h copy_interfaces/multiface.h storage/betadisk.h settings.h storage/divmmc.c storage/hilow_datadrive.h storage/samram.h copy_interfaces/hilow_barbanegra.h copy_interfaces/transtape.h copy_interfaces/mhpokeador.h copy_interfaces/specmate.h copy_interfaces/phoenix.h copy_interfaces/defcon.h copy_interfaces/ramjet.h copy_interfaces/interface007.h copy_interfaces/dinamid3.h operaciones.h storage/zxmmcplus.h
	\$(CC) \$(CFLAGS) -c ula.c

mmc.o: storage/mmc.c storage/mmc.h cpu.h debug.h utils.h zxvision/zxvision.h video/screen.h storage/divmmc.h compileoptions.h operaciones.h menu/menu_items.h
	\$(CC) \$(CFLAGS) -c storage/mmc.c

zxmmcplus.o: storage/zxmmcplus.c storage/zxmmcplus.h cpu.h debug.h utils.h operaciones.h zesarux.h storage/mmc.h mem128.h menu/menu_items.h video/screen.h
	\$(CC) \$(CFLAGS) -c storage/zxmmcplus.c

ide.o: storage/ide.c storage/ide.h cpu.h debug.h utils.h zxvision/zxvision.h video/screen.h storage/divide.h menu/menu_items.h
	\$(CC) \$(CFLAGS) -c storage/ide.c

pd765.o: storage/pd765.c storage/pd765.h cpu.h debug.h utils.h dsk.h menu/menu_items.h menu/menu_items_storage.h video/screen.h settings.h machines/pcw.h
	\$(CC) \$(CFLAGS) -c storage/pd765.c

dsk.o: dsk.c dsk.h cpu.h debug.h utils.h storage/tape.h menu/menu_items.h video/screen.h storage/pd765.h settings.h timer.h
	\$(CC) \$(CFLAGS) -c dsk.c

plus3dos_handler.o: storage/plus3dos_handler.c storage/plus3dos_handler.h cpu.h debug.h utils.h operaciones.h mem128.h dsk.h
	\$(CC) \$(CFLAGS) -c storage/plus3dos_handler.c

zxpand.o: storage/zxpand.c storage/zxpand.h storage/mmc.h cpu.h debug.h utils.h zxvision/zxvision.h video/screen.h machines/zx8081.h joystick.h menu/menu_items.h
	\$(CC) \$(CFLAGS) -c storage/zxpand.c

dandanator.o: storage/dandanator.c storage/dandanator.h cpu.h debug.h utils.h operaciones.h ula.h audio/audio.h video/screen.h menu/menu_items.h
	\$(CC) \$(CFLAGS) -c storage/dandanator.c

gs.o: soundchips/gs.c soundchips/gs.h cpu.h debug.h utils.h operaciones.h contend.h audio/audio.h
	\$(CC) \$(CFLAGS) -c soundchips/gs.c

betadisk.o: storage/betadisk.c storage/betadisk.h cpu.h debug.h utils.h operaciones.h ula.h mem128.h video/screen.h machines/tsconf.h menu/menu_items.h menu/menu_items_storage.h settings.h
	\$(CC) \$(CFLAGS) -c storage/betadisk.c

codetests.o: codetests.c codetests.h cpu.h debug.h utils.h operaciones.h ula.h mem128.h video/screen.h machines/tbblue.h assemble.h expression_parser.h audio/audio.h zrcp/zeng.h zrcp/zeng_online.h network.h settings.h atomic.h machines/cpc.h timer.h audio/audio_ayplayer.h
	\$(CC) \$(CFLAGS) -c codetests.c

assemble.o: assemble.c assemble.h cpu.h debug.h utils.h
	\$(CC) \$(CFLAGS) -c assemble.c

chardevice.o: chardevice.c chardevice.h cpu.h debug.h
	\$(CC) \$(CFLAGS) -c chardevice.c

uartbridge.o: uartbridge.c uartbridge.h cpu.h debug.h utils.h chardevice.h video/screen.h
	\$(CC) \$(CFLAGS) -c uartbridge.c

expression_parser.o: expression_parser.c expression_parser.h cpu.h debug.h utils.h operaciones.h video/screen.h mem128.h cpus/scmp.h cpus/m68k.h machines/prism.h machines/tbblue.h storage/hilow_datadrive.h storage/pd765.h storage/superupgrade.h
	\$(CC) \$(CFLAGS) -c expression_parser.c

kartusho.o: storage/kartusho.c storage/kartusho.h cpu.h debug.h utils.h operaciones.h ula.h
	\$(CC) \$(CFLAGS) -c storage/kartusho.c

samram.o: storage/samram.c storage/samram.h cpu.h debug.h utils.h operaciones.h ula.h joystick.h
	\$(CC) \$(CFLAGS) -c storage/samram.c

ifrom.o: storage/ifrom.c storage/ifrom.h cpu.h debug.h utils.h operaciones.h ula.h
	\$(CC) \$(CFLAGS) -c storage/ifrom.c

hilow_datadrive.o: storage/hilow_datadrive.c storage/hilow_datadrive.h cpu.h debug.h utils.h operaciones.h ula.h video/screen.h menu/menu_items.h mem128.h compileoptions.h audio/audio.h
	\$(CC) \$(CFLAGS) -c storage/hilow_datadrive.c

hilow_barbanegra.o: copy_interfaces/hilow_barbanegra.c copy_interfaces/hilow_barbanegra.h cpu.h debug.h utils.h operaciones.h mem128.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/hilow_barbanegra.c

transtape.o: copy_interfaces/transtape.c copy_interfaces/transtape.h cpu.h debug.h utils.h operaciones.h mem128.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/transtape.c

mhpokeador.o: copy_interfaces/mhpokeador.c copy_interfaces/mhpokeador.h cpu.h debug.h utils.h operaciones.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/mhpokeador.c

specmate.o: copy_interfaces/specmate.c copy_interfaces/specmate.h cpu.h debug.h utils.h operaciones.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/specmate.c

interface007.o: copy_interfaces/interface007.c copy_interfaces/interface007.h cpu.h debug.h utils.h operaciones.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/interface007.c

dinamid3.o: copy_interfaces/dinamid3.c copy_interfaces/dinamid3.h cpu.h debug.h utils.h operaciones.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/dinamid3.c

phoenix.o: copy_interfaces/phoenix.c copy_interfaces/phoenix.h cpu.h debug.h utils.h operaciones.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/phoenix.c

defcon.o: copy_interfaces/defcon.c copy_interfaces/defcon.h cpu.h debug.h utils.h operaciones.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/defcon.c

ramjet.o: copy_interfaces/ramjet.c copy_interfaces/ramjet.h cpu.h debug.h utils.h operaciones.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/ramjet.c

datagear.o: datagear.c datagear.h cpu.h debug.h utils.h operaciones.h ula.h
	\$(CC) \$(CFLAGS) -c datagear.c

spritefinder.o: spritefinder.c spritefinder.h cpu.h debug.h utils.h operaciones.h ula.h video/screen.h
	\$(CC) \$(CFLAGS) -c spritefinder.c

multiface.o: copy_interfaces/multiface.c copy_interfaces/multiface.h cpu.h debug.h utils.h operaciones.h
	\$(CC) \$(CFLAGS) -c copy_interfaces/multiface.c

superupgrade.o: storage/superupgrade.c storage/superupgrade.h cpu.h debug.h utils.h operaciones.h mem128.h zxvision/zxvision.h video/screen.h
	\$(CC) \$(CFLAGS) -c storage/superupgrade.c

lec.o: storage/lec.c storage/lec.h cpu.h debug.h utils.h operaciones.h mem128.h
	\$(CC) \$(CFLAGS) -c storage/lec.c

spectra.o: video_chips/spectra.c video_chips/spectra.h cpu.h debug.h utils.h zxvision/zxvision.h video/screen.h operaciones.h mem128.h video_chips/ulaplus.h
	\$(CC) \$(CFLAGS) -c video_chips/spectra.c

spritechip.o: video_chips/spritechip.c video_chips/spritechip.h cpu.h debug.h utils.h video/screen.h ula.h video_chips/ulaplus.h mem128.h
	\$(CC) \$(CFLAGS) -c video_chips/spritechip.c

divmmc.o: storage/divmmc.c storage/divmmc.h storage/divide.h storage/diviface.h cpu.h debug.h utils.h
	\$(CC) \$(CFLAGS) -c storage/divmmc.c

divide.o: storage/divide.c storage/divide.h storage/divmmc.h storage/diviface.h cpu.h debug.h utils.h
	\$(CC) \$(CFLAGS) -c storage/divide.c

diviface.o: storage/diviface.c storage/diviface.h cpu.h debug.h utils.h zxvision/zxvision.h video/screen.h operaciones.h machines/zxuno.h contend.h machines/prism.h machines/tbblue.h machines/tsconf.h
	\$(CC) \$(CFLAGS) -c storage/diviface.c

if1.o: storage/if1.c storage/if1.h storage/microdrive.h storage/microdrive_raw.h cpu.h debug.h utils.h operaciones.h zxvision/zxvision.h mem128.h video/screen.h zesarux.h
	\$(CC) \$(CFLAGS) -c storage/if1.c

microdrive.o: storage/microdrive.c storage/microdrive.h storage/microdrive_raw.h storage/if1.h cpu.h debug.h utils.h operaciones.h zxvision/zxvision.h menu/menu_items.h video/screen.h
	\$(CC) \$(CFLAGS) -c storage/microdrive.c

microdrive_raw.o: storage/microdrive_raw.c storage/microdrive_raw.h storage/microdrive.h storage/if1.h cpu.h debug.h utils.h operaciones.h zxvision/zxvision.h menu/menu_items.h video/screen.h audio/audio.h
	\$(CC) \$(CFLAGS) -c storage/microdrive_raw.c

ds1307.o: ds1307.c ds1307.h cpu.h debug.h utils.h operaciones.h zxvision/zxvision.h
	\$(CC) \$(CFLAGS) -c ds1307.c

printers.o: printers.c printers.h cpu.h debug.h utils.h video/screen.h zxvision/zxvision.h
	\$(CC) \$(CFLAGS) -c printers.c

realjoystick.o: realjoystick.c realjoystick.h cpu.h debug.h joystick.h zxvision/zxvision.h utils.h  video/screen.h compileoptions.h snap/snap_ram.h zrcp/zeng.h operaciones.h
	\$(CC) \$(CFLAGS) -c realjoystick.c

ulaplus.o: video_chips/ulaplus.c video_chips/ulaplus.h cpu.h debug.h video/screen.h video_chips/spectra.h zxvision/zxvision.h
	\$(CC) \$(CFLAGS) -c video_chips/ulaplus.c

autoselectoptions.o: autoselectoptions.c autoselectoptions.h debug.h machines/zx8081.h cpu.h video/screen.h joystick.h storage/tape.h realjoystick.h video_chips/ulaplus.h zxvision/zxvision.h utils.h chardetect.h
	\$(CC) \$(CFLAGS) -c autoselectoptions.c

chardetect.o: chardetect.c chardetect.h cpu.h operaciones.h debug.h video/screen.h textspeech.h third_party/disassemble.h zxvision/zxvision.h settings.h utils_text_adventure.h
	\$(CC) \$(CFLAGS) -c chardetect.c

textspeech.o: textspeech.c textspeech.h cpu.h operaciones.h debug.h video/screen.h chardetect.h zxvision/zxvision.h utils.h machines/sam.h
	\$(CC) \$(CFLAGS) -c textspeech.c


hilow_datadrive_audio.o: storage/hilow_datadrive_audio.c
	\$(CC) \$(CFLAGS) -c storage/hilow_datadrive_audio.c

enhanced_zx81_read.o: enhanced_zx81_read.c enhanced_zx81_read.h
	\$(CC) \$(CFLAGS) -c enhanced_zx81_read.c

clean:
	rm -f *.o zesarux zesarux.exe smpatap sp_z80 tapabin bin_sprite_to_c leezx81 run_enhanced_zx81_read lee_hilow_datadrive_audio file_to_eprom bmp_to_prism_4_planar bmp_to_sprite spedtotxt install.sh
	rm -fR bintargztemp/ sourcetargztemp/ ZEsarUX_win-\$(EMULATOR_VERSION)/
	rm -fR macos/zesarux.app
	rm -f macos/zesarux-noncompressed.dmg
	rm -f macos/zesarux-noncompressed.dmg.gz
	rm -f macos/ZEsarUX_macos-\$(EMULATOR_VERSION).dmg
	rm -f ZEsarUX_`uname -s`-\$(EMULATOR_VERSION)_`uname -m`.tar.gz
	rm -f ZEsarUX_src-\$(EMULATOR_VERSION).tar.gz
	rm -f ZEsarUX_win-\$(EMULATOR_VERSION).zip
	rm -f ZEsarUX_extras-\$(EMULATOR_VERSION).zip

COMMONFILES=ACKNOWLEDGEMENTS LICENSE LICENSES_info Changelog Cambios TODO* README HISTORY FEATURES FEATURES_es EXCLUSIVEFEATURES INSTALL INSTALLWINDOWS IN_MEMORIAM* ALTERNATEROMS INCLUDEDTAPES DONATE DONORS FAQ *.odt mantransfev3.bin *.rom zxuno.flash zxmmcplus.flash tbblue.mmc pcw_8x_boot*dsk zesarux.mp3 zesarux.xcf editionnamegame.* keyboards alternate_roms z88_shortcuts.bmp zesarux.pdf docs licenses my_soft copiers steering_wheel_presets speech_filters text_image_filters

ONLYSOURCEFILES=icons_buttons macos patches tests *.c *.h *.tpl DEVELOPMENT CHECKLIST configure *.sh *.asm benchmark_*.txt current_checklist.txt prism_change_boot.txt Dockerfile* audio copy_interfaces cores cpus machines menu other_sources_not_ZEsarUX snap soundchips storage third_party video video_chips zrcp zxvision



ONLYUNIXBINARIES=install.sh zesarux
ONLYWINBINARIES=zesarux.exe $LIBSDL.dll $LIBPTHREADS_WIN

sourcetargz:
	rm -fR sourcetargztemp
	mkdir -p sourcetargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYSOURCEFILES) sourcetargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C sourcetargztemp -cvzf ZEsarUX_src-\$(EMULATOR_VERSION).tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_src-\$(EMULATOR_VERSION).tar.gz"

backupsrc:
	rm -fR backupsrctemp
	mkdir -p backupsrctemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(ONLYSOURCEFILES) backupsrctemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C backupsrctemp -cvzf ZEsarUX_backupsrc-\$(EMULATOR_VERSION).tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_backupsrc-\$(EMULATOR_VERSION).tar.gz"

bintargz: all
	./generate_install_sh.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_`uname -s`-\$(EMULATOR_VERSION)_`uname -m`.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_`uname -s`-\$(EMULATOR_VERSION)_`uname -m`.tar.gz"


rpi: all
	./generate_install_sh.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_raspberrypios-framebuffer-\$(EMULATOR_VERSION)_`uname -m`.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_raspberrypios-framebuffer-\$(EMULATOR_VERSION)_`uname -m`.tar.gz"


debian32: all
	./generate_install_sh.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_linux-\$(EMULATOR_VERSION)-debian12_i686.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_linux-\$(EMULATOR_VERSION)-debian12_i686.tar.gz"


debian64: all
	./generate_install_sh.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_linux-\$(EMULATOR_VERSION)-debian12_x86_64.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_linux-\$(EMULATOR_VERSION)-debian12_x86_64.tar.gz"

haiku: all
	./generate_install_sh.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_haiku-\$(EMULATOR_VERSION)_x86_64.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_haiku-\$(EMULATOR_VERSION)_x86_64.tar.gz"


freebsd: all
	./generate_install_sh.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_freebsd-\$(EMULATOR_VERSION)-freebsd12_amd64.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_freebsd-\$(EMULATOR_VERSION)-freebsd12_amd64.tar.gz"


ubuntu:
	./docker-zesarux.sh build-version-and-get-binary ubuntu
	mv zesarux.ubuntu zesarux
	mv install.sh.ubuntu install.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_linux-\$(EMULATOR_VERSION)-ubuntu22_x86_64.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	rm zesarux install.sh
	echo
	echo "Generated file is : ZEsarUX_linux-\$(EMULATOR_VERSION)-ubuntu22_x86_64.tar.gz"


fedora:
	./docker-zesarux.sh build-version-and-get-binary fedora
	mv zesarux.fedora zesarux
	mv install.sh.fedora install.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_linux-\$(EMULATOR_VERSION)-fedora38_x86_64.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	rm zesarux install.sh
	echo
	echo "Generated file is : ZEsarUX_linux-\$(EMULATOR_VERSION)-fedora38_x86_64.tar.gz"


#just for testing right now
debiandocker:
	./docker-zesarux.sh build-version-and-get-binary debian
	mv zesarux.debian zesarux
	mv install.sh.debian install.sh
	rm -fR bintargztemp
	mkdir -p bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYUNIXBINARIES) bintargztemp/ZEsarUX-\$(EMULATOR_VERSION)/
	tar -C bintargztemp -cvzf ZEsarUX_linux-\$(EMULATOR_VERSION)-debian12_x86_64.tar.gz ZEsarUX-\$(EMULATOR_VERSION)
	echo
	echo "Generated file is : ZEsarUX_linux-\$(EMULATOR_VERSION)-debian12_x86_64.tar.gz"


extra_files:
	echo "Run the following: cd ../../zesarux-extras/ && zip -r /tmp/ZEsarUX_extras-\$(EMULATOR_VERSION).zip *"
	echo "Generated file will be: /tmp/ZEsarUX_extras-\$(EMULATOR_VERSION).zip"

windows:
	mkdir -p ZEsarUX_windows-\$(EMULATOR_VERSION)
	cp -a \$(COMMONFILES) \$(ONLYWINBINARIES) ZEsarUX_windows-\$(EMULATOR_VERSION)/
	zip -r ZEsarUX_windows-\$(EMULATOR_VERSION).zip ZEsarUX_windows-\$(EMULATOR_VERSION)/
	echo
	echo "Generated file is: ZEsarUX_windows-\$(EMULATOR_VERSION).zip"

macapp: all
	mkdir -p macos/zesarux.app
	cp -r macos/apptemplate/* macos/zesarux.app/
	cp zesarux macos/zesarux.app/Contents/MacOS/zesarux
	cp -a \$(COMMONFILES) macos/zesarux.app/Contents/Resources/
	rm -f macos/zesarux-noncompressed.dmg
	rm -f macos/zesarux-noncompressed.dmg.gz
	rm -f macos/ZEsarUX_macos-\$(EMULATOR_VERSION).dmg
	hdiutil create -megabytes 128 -fs HFS+ -volname ZEsarUX macos/zesarux-noncompressed.dmg
	hdiutil attach -mountpoint macos/tempmount macos/zesarux-noncompressed.dmg
	cp -R macos/zesarux.app macos/tempmount
	ln -s /Applications/ macos/tempmount/Applications
	sleep 5
	hdiutil detach macos/tempmount
	#gzip macos/zesarux-noncompressed.dmg
	#UDBZ - UDIF bzip2-compressed image (Mac OS X 10.4+ only)
	hdiutil convert macos/zesarux-noncompressed.dmg -format UDBZ -o macos/ZEsarUX_macos-\$(EMULATOR_VERSION).dmg
	rm -f macos/zesarux-noncompressed.dmg
	echo "Generated file is: macos/ZEsarUX_macos-\$(EMULATOR_VERSION).dmg"


#CC32=$CCOMPILER \$(CFLAGS) -m32
#CC64=$CCOMPILER \$(CFLAGS) -m64

#UTILS32=smpatap_x32 sp_z80_x32 tapabin_x32 leezx81_x32
#UTILS64=smpatap_x64 sp_z80_x64 tapabin_x64 leezx81_x64

#utilities32: \$(UTILS32)

#utilities64: \$(UTILS64)


#smpatap_x32: smpatap_unix.c
#	\$(CC32) \$(CFLAGS) smpatap_unix.c -o smpatap_x32

#smpatap_x64: smpatap_unix.c
#	\$(CC64) \$(CFLAGS) smpatap_unix.c -o smpatap_x64

#leezx81_x32: leezx81_unix.c
#	\$(CC32) \$(CFLAGS) leezx81_unix.c -o leezx81_x32

#leezx81_x64: leezx81_unix.c
#	\$(CC64) \$(CFLAGS) leezx81_unix.c -o leezx81_x64

#sp_z80_x32: sp_z80_unix.c
#	\$(CC32) \$(CFLAGS) sp_z80_unix.c -o sp_z80_x32

#sp_z80_x64: sp_z80_unix.c
#	\$(CC64) \$(CFLAGS) sp_z80_unix.c -o sp_z80_x64

#tapabin_x32: tapabin_unix.c
#	\$(CC32) \$(CFLAGS) tapabin_unix.c -o tapabin_x32

#tapabin_x64: tapabin_unix.c
#	\$(CC64) \$(CFLAGS) tapabin_unix.c -o tapabin_x64


#UTILITIES=smpatap sp_z80 tapabin leezx81


install: all
	./generate_install_sh.sh
	./install.sh

#utilities: \$(UTILITIES)

#Nota: si en el futuro en la carpeta other_sources_not_ZEsarUX hay algun archivo .h, se necesitara agregar a CFLAGS -Iother_sources_not_ZEsarUX
utilities: smpatap sp_z80 tapabin leezx81 run_enhanced_zx81_read file_to_eprom bmp_to_prism_4_planar bmp_to_sprite spedtotxt bin_sprite_to_c lee_hilow_datadrive_audio

main_enhanced_zx81_read.o: other_sources_not_ZEsarUX/main_enhanced_zx81_read.c enhanced_zx81_read.c enhanced_zx81_read.h
	\$(CC) \$(CFLAGS) -c other_sources_not_ZEsarUX/main_enhanced_zx81_read.c

run_enhanced_zx81_read: main_enhanced_zx81_read.o enhanced_zx81_read.o
	\$(CC) \$(CFLAGS) main_enhanced_zx81_read.o enhanced_zx81_read.o -o run_enhanced_zx81_read

main_lee_hilow_datadrive_audio.o: other_sources_not_ZEsarUX/main_lee_hilow_datadrive_audio.c storage/hilow_datadrive_audio.h
	\$(CC) \$(CFLAGS) -c other_sources_not_ZEsarUX/main_lee_hilow_datadrive_audio.c

lee_hilow_datadrive_audio: main_lee_hilow_datadrive_audio.o hilow_datadrive_audio.o
	\$(CC) \$(CFLAGS) main_lee_hilow_datadrive_audio.o hilow_datadrive_audio.o -o lee_hilow_datadrive_audio


spedtotxt: other_sources_not_ZEsarUX/spedtotxt.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/spedtotxt.c -o spedtotxt

smpatap: other_sources_not_ZEsarUX/smpatap_unix.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/smpatap_unix.c -o smpatap

leezx81: other_sources_not_ZEsarUX/leezx81_unix.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/leezx81_unix.c -o leezx81

sp_z80: other_sources_not_ZEsarUX/sp_z80_unix.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/sp_z80_unix.c -o sp_z80

tapabin: other_sources_not_ZEsarUX/tapabin_unix.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/tapabin_unix.c -o tapabin

file_to_eprom: other_sources_not_ZEsarUX/file_to_eprom.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/file_to_eprom.c -o file_to_eprom

bmp_to_prism_4_planar: other_sources_not_ZEsarUX/bmp_to_prism_4_planar.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/bmp_to_prism_4_planar.c -o bmp_to_prism_4_planar

bmp_to_sprite: other_sources_not_ZEsarUX/bmp_to_sprite.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/bmp_to_sprite.c -o bmp_to_sprite

bin_sprite_to_c: other_sources_not_ZEsarUX/bin_sprite_to_c.c
	\$(CC) \$(CFLAGS) other_sources_not_ZEsarUX/bin_sprite_to_c.c -o bin_sprite_to_c

_EOF


if [ "$MAINSOURCE" == "main_unix" ]; then

cat >> Makefile << _EOF
main_unix.o: main_unix.c cpu.h start.h
	\$(CC) \$(CFLAGS) -c main_unix.c

_EOF

fi


if [ "$MAINSOURCE" == "scrcocoa" ]; then
cat >> Makefile << _EOF
scrcocoa.o: video/scrcocoa.m joystick.h compileoptions.h cpu.h start.h video/screen.h charset.h debug.h utils.h timer.h zxvision/zxvision.h machines/cpc.h machines/prism.h machines/sam.h machines/ql.h settings.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h realjoystick.h machines/pcw.h
	clang -I. -Iaudio -Ivideo -Icores -Imenu -Isnap -Icopy_interfaces -Imachines -I zxvision video/scrcocoa.m -c -o scrcocoa.o

_EOF

fi



if [ "$OPTIONOBJSTDOUT" != "" ]; then

cat >> Makefile << _EOF
scrstdout.o: video/scrstdout.c video/scrstdout.h debug.h video/screen.h mem128.h machines/zx8081.h operaciones.h cpu.h utils.h zxvision/zxvision.h joystick.h ula.h third_party/disassemble.h machines/z88.h timer.h chardetect.h textspeech.h machines/tsconf.h machines/baseconf.h settings.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c video/scrstdout.c

_EOF

fi

if [ "$OPTIONOBJSIMPLETEXT" != "" ]; then

cat >> Makefile << _EOF
scrsimpletext.o: video/scrsimpletext.c video/scrsimpletext.h debug.h video/screen.h mem128.h machines/zx8081.h operaciones.h cpu.h utils.h zxvision/zxvision.h joystick.h ula.h third_party/disassemble.h machines/z88.h timer.h machines/tsconf.h machines/baseconf.h settings.h textspeech.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h
	\$(CC) \$(CFLAGS) -c video/scrsimpletext.c

_EOF

fi



if [ "$OPTIONOBJCURSES" != "" ]; then

cat >> Makefile << _EOF
scrcurses.o: video/scrcurses.c cpu.h video/scrcurses.h compileoptions.h operaciones.h mem128.h charset.h debug.h machines/zx8081.h video/screen.h audio/audio.h zxvision/zxvision.h utils.h joystick.h ula.h machines/z88.h machines/sam.h charset.h machines/tsconf.h machines/baseconf.h settings.h machines/chloe.h machines/timex.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h zrcp/zeng.h zrcp/zeng_online.h zrcp/zeng_online_client.h
	\$(CC) \$(CFLAGS) -c video/scrcurses.c

_EOF

fi

if [ "$OPTIONOBJCURSESW" != "" ]; then

cat >> Makefile << _EOF
cursesw_ext.o: cursesw_ext.c cursesw_ext.h cpu.h debug.h settings.h
	\$(CC) \$(CFLAGS) -c cursesw_ext.c

_EOF

fi

if [ "$OPTIONOBJFBDEV" != "" ]; then

cat >> Makefile << _EOF
scrfbdev.o: video/scrfbdev.c cpu.h video/scrfbdev.h operaciones.h mem128.h charset.h debug.h machines/zx8081.h video/screen.h audio/audio.h zxvision/zxvision.h utils.h joystick.h ula.h machines/z88.h machines/cpc.h machines/prism.h machines/sam.h machines/ql.h settings.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h machines/pcw.h
	\$(CC) \$(CFLAGS) -c video/scrfbdev.c

_EOF

fi


if [ "$OPTIONOBJAA" != "" ]; then

cat >> Makefile << _EOF
scraa.o: video/scraa.c cpu.h video/scraa.h operaciones.h mem128.h charset.h debug.h machines/zx8081.h audio/audio.h zxvision/zxvision.h video/screen.h utils.h joystick.h ula.h machines/z88.h textspeech.h settings.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h machines/pcw.h
	\$(CC) \$(CFLAGS) -c video/scraa.c

_EOF

fi

if [ "$OPTIONOBJCACA" != "" ]; then

cat >> Makefile << _EOF
scrcaca.o: video/scrcaca.c cpu.h video/scrcaca.h operaciones.h mem128.h charset.h debug.h machines/zx8081.h audio/audio.h zxvision/zxvision.h video/screen.h utils.h joystick.h machines/z88.h settings.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h machines/pcw.h
	\$(CC) \$(CFLAGS) -c video/scrcaca.c

_EOF

fi




if [ "$OPTIONOBJXWINDOWS" != "" ]; then

cat >> Makefile << _EOF
scrxwindows.o: video/scrxwindows.c cpu.h video/scrxwindows.h debug.h video/screen.h mem128.h compileoptions.h machines/zx8081.h audio/audio.h charset.h zxvision/zxvision.h timer.h utils.h joystick.h machines/cpc.h machines/prism.h machines/z88.h machines/sam.h machines/ql.h settings.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h machines/pcw.h
	\$(CC) \$(CFLAGS) -I/usr/X11R6/include -I/opt/X11/include -c video/scrxwindows.c

_EOF

fi


if [ "$OPTIONOBJSDL" != "" ] && [ "$LIBSDL" == "SDL" ]; then

cat >> Makefile << _EOF
scrsdl.o: video/scrsdl.c cpu.h video/scrsdl.h debug.h video/screen.h mem128.h compileoptions.h machines/zx8081.h audio/audio.h charset.h zxvision/zxvision.h timer.h utils.h joystick.h common_sdl.h machines/cpc.h machines/prism.h machines/sam.h machines/ql.h settings.h realjoystick.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h machines/pcw.h
	\$(CC) \$(CFLAGS) -c video/scrsdl.c

audiosdl.o: audio/audiosdl.c audio/audiosdl.h cpu.h audio/audio.h compileoptions.h debug.h common_sdl.h settings.h timer.h
	\$(CC) \$(CFLAGS) -c audio/audiosdl.c

common_sdl.o: common_sdl.c common_sdl.h cpu.h compileoptions.h debug.h timer.h
	\$(CC) \$(CFLAGS) -c common_sdl.c

_EOF

fi

if [ "$OPTIONOBJSDL" != "" ] && [ "$LIBSDL" == "SDL2" ]; then

cat >> Makefile << _EOF
scrsdl2.o: video/scrsdl2.c cpu.h video/scrsdl2.h debug.h video/screen.h mem128.h compileoptions.h machines/zx8081.h audio/audio.h charset.h zxvision/zxvision.h timer.h utils.h joystick.h common_sdl2.h machines/cpc.h machines/prism.h machines/sam.h machines/ql.h settings.h realjoystick.h machines/msx.h machines/svi.h machines/coleco.h machines/sg1000.h machines/sms.h machines/pcw.h
	\$(CC) \$(CFLAGS) -c video/scrsdl2.c

audiosdl2.o: audio/audiosdl2.c audio/audiosdl2.h cpu.h audio/audio.h compileoptions.h debug.h common_sdl2.h utils.h settings.h timer.h
	\$(CC) \$(CFLAGS) -c audio/audiosdl2.c

common_sdl2.o: common_sdl2.c common_sdl2.h cpu.h compileoptions.h debug.h timer.h
	\$(CC) \$(CFLAGS) -c common_sdl2.c

_EOF

fi



if [ "$OPTIONOBJDSP" != "" ]; then

cat >> Makefile << _EOF
audiodsp.o: audio/audiodsp.c audio/audiodsp.h cpu.h audio/audio.h compileoptions.h debug.h settings.h
	\$(CC) \$(CFLAGS) -c audio/audiodsp.c

_EOF

fi


if [ "$OPTIONOBJONEBITSPEAKER" != "" ]; then

cat >> Makefile << _EOF
audioonebitspeaker.o: audio/audioonebitspeaker.c audio/audioonebitspeaker.h cpu.h audio/audio.h compileoptions.h debug.h settings.h
	 \$(CC) \$(CFLAGS) -c audio/audioonebitspeaker.c

_EOF

fi


if [ "$OPTIONOBJALSA" != "" ]; then

cat >> Makefile << _EOF
audioalsa.o: audio/audioalsa.c audio/audioalsa.h cpu.h audio/audio.h compileoptions.h debug.h settings.h soundchips/ay38912.h utils.h
	\$(CC) \$(CFLAGS) -c audio/audioalsa.c

_EOF

fi


if [ "$OPTIONOBJPULSE" != "" ]; then

cat >> Makefile << _EOF
audiopulse.o: audio/audiopulse.c audio/audiopulse.h cpu.h audio/audio.h compileoptions.h debug.h utils.h settings.h timer.h
	\$(CC) \$(CFLAGS) -c audio/audiopulse.c

_EOF

fi



if [ "$OPTIONOBJCOREAUDIO" != "" ]; then

cat >> Makefile << _EOF
audiocoreaudio.o: audio/audiocoreaudio.c audio/audiocoreaudio.h cpu.h audio/audio.h compileoptions.h debug.h settings.h
	\$(CC) \$(CFLAGS) -c audio/audiocoreaudio.c

_EOF

fi


if [ "$OPTIONWINDOWSRESOURCE" != "" ]; then

cat >> Makefile << _EOF
zesarux.res: zesarux.rc
	windres zesarux.rc -O coff zesarux.res

_EOF

fi





echo "Creating compileoptions.h"

cat > compileoptions.h << _EOF

#ifndef OPTIONS_H
#define OPTIONS_H


_EOF

if [ "$OPTIONOBJSTDOUT" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_STDOUT
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_STDOUT"
fi

if [ "$OPTIONOBJSIMPLETEXT" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_SIMPLETEXT
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_SIMPLETEXT"
fi



if [ "$OPTIONOBJCURSES" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_CURSES
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_CURSES"
fi

if [ "$OPTIONOBJCURSESW" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_CURSESW
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_CURSESW"
fi

if [ "$OPTIONOBJAA" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_AA
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_AA"
fi

if [ "$OPTIONOBJCACA" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_CACA
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_CACA"
fi



if [ "$OPTIONOBJXWINDOWS" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_XWINDOWS
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_XWINDOWS"
fi

if [ "$OPTIONOBJSDL" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_SDL
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_SDL"

if [ "$LIBSDL" == "SDL2" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_SDL2
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_SDL2"
fi
fi



if [ "$OPTIONOBJFBDEV" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_FBDEV
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_FBDEV"
fi



if [ "$OPTIONOBJSSL" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_SSL
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_SSL"
fi


if [ "$OPTIONXEXT" != "" ]; then
cat >> compileoptions.h << _EOF
#define USE_XEXT
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES USE_XEXT"
fi

if [ "$OPTIONXVIDMODE" != "" ]; then
cat >> compileoptions.h << _EOF
#define USE_XVIDMODE
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES USE_XVIDMODE"
fi



if [ "$OPTIONPTHREADS" != "" ]; then
cat >> compileoptions.h << _EOF
#define USE_PTHREADS
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES USE_PTHREADS"


else

#si no hay pthreads, tampoco habra networking
OPTIONNETWORKING=""

#ni soporte real joystick en linux
OPTIONLINUXREALJOYSTICK=""

fi


if [ "$OPTIONNETWORKING" == "" ]; then
cat >> compileoptions.h << _EOF
#define NETWORKING_DISABLED
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES NETWORKING_DISABLED"

fi



if [ "$OPTIONCOCOA" != "" ]; then
cat >> compileoptions.h << _EOF
#define USE_COCOA
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES USE_COCOA"
fi




if [ "$OPTIONSNDFILE" != "" ]; then
cat >> compileoptions.h << _EOF
#define USE_SNDFILE
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES USE_SNDFILE"
fi



if [ "$OPTIONOBJDSP" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_DSP
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_DSP"
fi


if [ "$OPTIONOBJONEBITSPEAKER" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_ONEBITSPEAKER
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_ONEBITSPEAKER"
fi




if [ "$OPTIONOBJALSA" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_ALSA
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_ALSA"
fi

if [ "$OPTIONOBJPULSE" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_PULSE
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_PULSE"
fi


if [ "$OPTIONOBJCOREAUDIO" != "" ]; then
cat >> compileoptions.h << _EOF
#define COMPILE_COREAUDIO
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES COMPILE_COREAUDIO"
fi


if [ "$OPTIONEMULATE_UNDOC_SCF_CCF" != "" ]; then
cat >> compileoptions.h << _EOF
#define EMULATE_SCF_CCF_UNDOC_FLAGS
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES EMULATE_SCF_CCF_UNDOC_FLAGS"
fi


if [ "$OPTIONEMULATE_MEMPTR" != "" ]; then
cat >> compileoptions.h << _EOF
#define EMULATE_MEMPTR
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES EMULATE_MEMPTR"
fi


if [ "$OPTIONEMULATE_VISUALMEM" != "" ]; then
cat >> compileoptions.h << _EOF
#define EMULATE_VISUALMEM
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES EMULATE_VISUALMEM"
fi


if [ "$OPTIONEMULATE_CPU_STATS" != "" ]; then
cat >> compileoptions.h << _EOF
#define EMULATE_CPU_STATS
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES EMULATE_CPU_STATS"
fi

if [ "$OPTIONEMULATE_RASPBERRY" != "" ]; then
cat >> compileoptions.h << _EOF
#define EMULATE_RASPBERRY
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES EMULATE_RASPBERRY"
fi


if [ "$OPTIONEMULATE_CONTEND" != "" ]; then
cat >> compileoptions.h << _EOF
#define EMULATE_CONTEND
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES EMULATE_CONTEND"
fi

if [ "$OPTIONPUTPIXELCACHE" != "" ]; then
cat >> compileoptions.h << _EOF
#define PUTPIXELCACHE
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES PUTPIXELCACHE"
fi

if [ "$OPTION_WORDS_BIGENDIAN" != "" ]; then
cat >> compileoptions.h << _EOF
#define WORDS_BIGENDIAN
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES WORDS_BIGENDIAN"
fi


if [ "$OPTIONLINUXREALJOYSTICK" != "" ]; then
cat >> compileoptions.h << _EOF
#define USE_LINUXREALJOYSTICK
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES USE_LINUXREALJOYSTICK"
fi


if [ "$OPTIONREDUCED_CORE_SPECTRUM" != "" ]; then
cat >> compileoptions.h << _EOF
#define USE_REDUCED_CORE_SPECTRUM
_EOF
COMPILE_VARIABLES="$COMPILE_VARIABLES USE_REDUCED_CORE_SPECTRUM"
fi


#Para que la fecha y mensajes del wc salgan en ingles
export LANG=C

#Estadisticas
FILES_FOR_STATS="*.c *.h audio/* copy_interfaces/* cores/* cpus/* machines/* menu/* snap/* soundchips/* storage/* third_party/* video/* video_chips/* zrcp/* zxvision/*"
#Lineas codigo fuente
#Descartando lineas vacias
LINES_SOURCE=`cat $FILES_FOR_STATS|grep -v "^$"|wc -l|tail -1|awk '{printf $1}'`

#Cantidad comentarios (TODO: esto es aprox porque puede haber un comentario en varias lineas con //)
COMMENTS_TYPE_LINE=`grep '//' $FILES_FOR_STATS|wc -l|tail -1|awk '{printf $1}'`
COMMENTS_TYPE_BLOCK=`grep '/\*' $FILES_FOR_STATS|wc -l|tail -1|awk '{printf $1}'`
TOTAL_COMMENTS=$(($COMMENTS_TYPE_LINE+$COMMENTS_TYPE_BLOCK))

#contamos entradas en los TODO files que empiezan con guion (-)
TODO_FILES_LINES=`cat TODO*|grep -v "^$"|grep "^-"|wc -l|awk '{printf $1}'`
#y comentarios tipo "TODO" en los archivos .c
TODO_C_LINES=`grep TODO $FILES_FOR_STATS|wc -l|awk '{printf $1}'`

TOTAL_TODO_ITEMS=$(($TODO_FILES_LINES+$TODO_C_LINES))


cat >> compileoptions.h << _EOF

#define COMPILATION_DATE "`date`"
#define COMPILATION_SYSTEM "$SISTEMA"
#define COMPILATION_SYSTEM_RELEASE "$SISTEMA_RELEASE"
#define CONFIGURE_OPTIONS "$0 $CONFIGURE_OPTIONS"
#define COMPILE_VARIABLES "$COMPILE_VARIABLES"
#define COMPILE_INITIALCFLAGS "$INITIALCFLAGS"
#define COMPILE_INITIALLDFLAGS "$INITIALLDFLAGS"
#define COMPILE_FINALCFLAGS "$CFLAGS"
#define COMPILE_FINALLDFLAGS "$LDFLAGS"
#define INSTALL_PREFIX "$INSTALLPREFIX"

#define LINES_SOURCE $LINES_SOURCE
#define TOTAL_COMMENTS $TOTAL_COMMENTS
#define TOTAL_TODO_ITEMS $TOTAL_TODO_ITEMS

#define BUILDNUMBER "$BUILDNUMBER"


#endif

_EOF



echo
echo "Config files successfully generated by $0"

echo

echo -n " Enabled Video output drivers: "
if [ "$OPTIONOBJSTDOUT" != "" ]; then
        echo -n "stdout "
fi

if [ "$OPTIONOBJSIMPLETEXT" != "" ]; then
        echo -n "simpletext "
fi


if [ "$OPTIONOBJCURSES" != "" ]; then
        echo -n "curses "
fi

if [ "$OPTIONOBJCURSESW" != "" ]; then
        echo -n "cursesw "
fi

if [ "$OPTIONOBJAA" != "" ]; then
        echo -n "aa "
fi

if [ "$OPTIONOBJCACA" != "" ]; then
        echo -n "caca "
fi


if [ "$OPTIONCOCOA" != "" ]; then
        echo -n "cocoa "
fi

if [ "$OPTIONOBJXWINDOWS" != "" ]; then
        echo -n "xwindows "
fi

if [ "$OPTIONOBJSDL" != "" ]; then
        echo -n "$TEXTOLIBSDL "
fi


if [ "$OPTIONOBJFBDEV" != "" ]; then
        echo -n "fbdev "
fi

echo "null"



echo -n " Disabled Video output drivers: "
if [ "$OPTIONOBJSTDOUT" == "" ]; then
        echo -n "stdout "
fi

if [ "$OPTIONOBJSIMPLETEXT" == "" ]; then
        echo -n "simpletext "
fi


if [ "$OPTIONOBJCURSES" == "" ]; then
        echo -n "curses "
fi

if [ "$OPTIONOBJCURSESW" == "" ]; then
        echo -n "cursesw "
fi


if [ "$OPTIONOBJAA" == "" ]; then
        echo -n "aa "
fi

if [ "$OPTIONOBJCACA" == "" ]; then
        echo -n "caca "
fi


if [ "$OPTIONCOCOA" == "" ]; then
        echo -n "cocoa "
fi

if [ "$OPTIONOBJXWINDOWS" == "" ]; then
        echo -n "xwindows "
fi

if [ "$OPTIONOBJSDL" == "" ]; then
        echo -n "$TEXTOLIBSDL "
fi



if [ "$OPTIONOBJFBDEV" == "" ]; then
        echo -n "fbdev "
fi






echo

echo -n " Enabled Audio output drivers: "
if [ "$OPTIONOBJDSP" != "" ]; then
        echo -n "dsp "
fi

if [ "$OPTIONOBJONEBITSPEAKER" != "" ]; then
        echo -n "onebitspeaker "
fi

if [ "$OPTIONOBJALSA" != "" ]; then
        echo -n "alsa "
fi

if [ "$OPTIONOBJPULSE" != "" ]; then
        echo -n "pulse "
fi


if [ "$OPTIONOBJCOREAUDIO" != "" ]; then
        echo -n "coreaudio "
fi

if [ "$OPTIONOBJSDL" != "" ]; then
        echo -n "$TEXTOLIBSDL "
fi


echo "null"



echo -n " Disabled Audio output drivers: "
if [ "$OPTIONOBJDSP" == "" ]; then
        echo -n "dsp "
fi

if [ "$OPTIONOBJONEBITSPEAKER" == "" ]; then
        echo -n "onebitspeaker "
fi

if [ "$OPTIONOBJALSA" == "" ]; then
        echo -n "alsa "
fi

if [ "$OPTIONOBJPULSE" == "" ]; then
        echo -n "pulse "
fi


if [ "$OPTIONOBJCOREAUDIO" == "" ]; then
        echo -n "coreaudio "
fi

if [ "$OPTIONOBJSDL" == "" ]; then
        echo -n "$TEXTOLIBSDL "
fi

echo



echo -n " Enabled Audio File output drivers: "

echo -n "raw "

if [ "$OPTIONSNDFILE" != "" ]; then
	echo -n "wav "
fi

echo



echo -n " Disabled Audio File output drivers: "

if [ "$OPTIONSNDFILE" == "" ]; then
        echo -n "wav "
fi

echo


echo -n " Pthreads support: "

if [ "$OPTIONPTHREADS" == "" ]; then
	echo "no"
else
	echo "yes"
fi


echo -n " SSL support: "

if [ "$OPTIONOBJSSL" == "" ]; then
        echo "no"
else
        echo "yes"
fi

echo -n " Networking support: "

if [ "$OPTIONNETWORKING" == "" ]; then
        echo "no"
else
        echo "yes"
fi


echo -n " Remote command protocol support: "

if [ "$OPTIONNETWORKING" == "" ]; then
        echo "no. It needs networking support"
else
        echo "yes"
fi



echo -n " Linux real joystick support: "

if [ "$OPTIONLINUXREALJOYSTICK" == "" ]; then
        echo "no"
else
        echo "yes"
fi




echo -n " MEMPTR emulation: "
if [ "$OPTIONEMULATE_MEMPTR" == "" ]; then
	echo "no"
else
	echo "yes"
fi

echo -n " Visual memory option: "
if [ "$OPTIONEMULATE_VISUALMEM" == "" ]; then
        echo "no"
else
        echo "yes"
fi


echo -n " CPU statistics option: "
if [ "$OPTIONEMULATE_CPU_STATS" == "" ]; then
        echo "no"
else
        echo "yes"
fi

echo -n " Raspberry extensions: "
if [ "$OPTIONEMULATE_RASPBERRY" == "" ]; then
        echo "no"
else
        echo "yes"
fi




echo -n " Contended memory emulation: "
if [ "$OPTIONEMULATE_CONTEND" == "" ]; then
        echo "no"
else
        echo "yes"
fi

echo -n " Putpixel cache: "
if [ "$OPTIONPUTPIXELCACHE" == "" ]; then
        echo "no"
else
        echo "yes"
fi

echo -n " Spectrum default core: "
if [ "$OPTIONREDUCED_CORE_SPECTRUM" == "" ]; then
        echo "Normal"
else
        echo "Reduced"
fi


#	echo "!!!!!WARNING!!!!!"
#	echo "You are using the fast Spectrum Core, but the following features will NOT be available or will NOT be properly emulated:"
#	echo "Debug t-states, Char detection, +3 Disk, Save to tape, Divide, Divmmc, RZX, Raster interrupts, TBBlue Copper, Audio DAC, Video out to file"
#	echo
#	echo "--spectrum-fast-core         Use a faster (and REDUCED) Spectrum core, useful on slow devices (Raspberry Pi One/Zero) and machines without Speculative Execution on the CPU"




echo
echo "Install prefix: $INSTALLPREFIX"

echo
#echo "'make' will now compile zesarux."
#echo
#echo "You can also compile the utilities with:"
#echo "make utils"
