all:	clean eeprom temete1.c temete2.c temete2.h temete3.c temete3.h temete4.c temete4.h
	sdcc -mpic14 -p16f877 -I/usr/local/share/sdcc/include/pic/ -I/usr/local/share/sdcc/include/ -c temete1.c
	sdcc -mpic14 -p16f877 -I/usr/local/share/sdcc/include/pic/ -I/usr/local/share/sdcc/include/ -c temete2.c
	sdcc -mpic14 -p16f877 -I/usr/local/share/sdcc/include/pic/ -I/usr/local/share/sdcc/include/ -c temete3.c
	sdcc -mpic14 -p16f877 -I/usr/local/share/sdcc/include/pic/ -I/usr/local/share/sdcc/include/ -c temete4.c
	gplink -I/usr/local/share/sdcc/include/pic/ -m temete1.o temete2.o temete3.o temete4.o -o temete.hex /usr/local/share/sdcc/lib/pic/pic16f877.lib /usr/local/share/sdcc/lib/pic/libsdcc.lib -I/usr/local/share/sdcc/lib/small/
	./unix2dos temete.hex temDOS.hex

sim:	temete.cod
	gpsim -s temete.cod

eeprom:	icons/hex artwork/hex clock/hex
	cat icons/hex/eeprom.bin > eeprom/eeprom.bin
	cat artwork/hex/eeprom.bin >> eeprom/eeprom.bin
	cat clock/hex/eeprom.bin >> eeprom/eeprom.bin

icons/hex:
	mkdir icons/hex
	./create_icons.sh

artwork/hex:
	mkdir artwork/hex
	./create_artwork.sh

clock/hex:
	mkdir clock/hex
	./process_information.sh

clean:	
	rm -f temete.stc temete.map *.asm *.cod *.hex *.lst *.o
	rm -rf ./icons/hex/
	rm -f eeprom/eeprom.bin
	rm -rf ./artwork/hex/
	rm -rf ./clock/hex/
