# $Id: Makefile 8169 2011-01-07 17:32:36Z luigi $

CC=arm-linux-gnueabi-gcc
STRIP=arm-linux-gnueabi-strip
CFLAGS = -Os -Wall -Werror -g
# files to publish
PUB= $(HEADERS) $(ALLSRCS) Makefile README myts.arm myts.ini keydefs.ini $(TABLES)

CODEPAGES = CP437 CP1255
TABLES = $(patsubst %,%.table,$(CODEPAGES))

HEADERS = config.h dynstring.h font.h myts.h pixop.h screen.h terminal.h
HEADERS += linux/
ALLSRCS= myts.c terminal.c dynstring.c
ALLSRCS += config.c launchpad.c
ALLSRCS += screen.c pixop.c font.c
SRCS= $(ALLSRCS)
CFLAGS += -I.

OBJS := $(strip $(patsubst %.c,%.o,$(strip $(SRCS))))

myts.arm: $(OBJS)
	$(CC) $(CFLAGS) -o myts.arm $(OBJS) -lutil
	$(STRIP) $@

$(OBJS): myts.h
terminal.o: terminal.h

tgz: $(PUB)
	tar cvzf /tmp/kiterm.tgz --exclude .svn $(PUB)

myts.zip: $(PUB)
	rm -f myts.zip
	mkdir -p myts
	mkdir -p launchpad
	cp myts.l.ini launchpad/
	cp profile myts.sh myts.ini unifont.hex *.table README keymap keydefs.ini font.b.hex myts/
	cp myts.arm myts/myts
	zip -r myts.zip launchpad myts
	rm -r myts/ launchpad/

clean:
	rm -rf myts.arm *.o *.core *.table myts.zip

# conversion
# hexdump -e '"\n\t" 8/1 "%3d, "'
# DO NOT DELETE

%.table: codepage.sh 
	./codepage.sh $*
