## Makefile for Top Gun SSH
## See the README file for copyright/licensing terms

TARGET = TGssh
APPNAME = "Top Gun SSH"
APPID = TGss

## Set this to the location of pilotSSLeay-2.0
SSLEAY = ../pilotSSLeay-2.0

OBJS = main.o editmenu.o 3des.o crc32.o idea.o packet.o ssh.o

CC = m68k-palmos-coff-gcc
LIBS = -LTGLoginLib -lTGLogin \
       -L$(SSLEAY)/shlib -lrsa -lbn -lrand -lmd -ldes -lidea

CFLAGS = -Wall -g -O2 -I$(SSLEAY)/include -ITGLoginLib

PILOTTTY = /dev/pilot

PILRC = pilrc
PPMTOTBMP = ppmtoTbmp
OBJRES = m68k-palmos-coff-obj-res
BUILDPRC = build-prc


all: $(TARGET).prc

.S.o:
	$(CC) $(TARGETFLAGS) -c $<

.c.s:
	$(CC) $(CSFLAGS) $<

$(TARGET).prc: code0000.$(TARGET).grc code0001.$(TARGET).grc data0000.$(TARGET).grc pref0000.$(TARGET).grc rloc0000.$(TARGET).grc bin.res
	$(BUILDPRC) $(TARGET).prc $(APPNAME) $(APPID) code0001.$(TARGET).grc code0000.$(TARGET).grc data0000.$(TARGET).grc *.bin pref0000.$(TARGET).grc rloc0000.$(TARGET).grc

code0000.$(TARGET).grc: $(TARGET)
	$(OBJRES) $(TARGET)

code0001.$(TARGET).grc: code0000.$(TARGET).grc

data0000.$(TARGET).grc: code0000.$(TARGET).grc

rloc0000.$(TARGET).grc: code0000.$(TARGET).grc

pref0000.$(TARGET).grc: code0000.$(TARGET).grc

bin.res: $(TARGET).rcp $(TARGET).pnm
	$(PILRC) $(TARGET).rcp .
	$(PPMTOTBMP) $(TARGET).pnm > tAIB03e8.bin
	$(PPMTOTBMP) $(TARGET).pnm > Tbmp0456.bin
	touch bin.res

$(TARGET): $(OBJS) TGLoginLib/libTGLogin.sa
	$(CC) $(CFLAGS) $(OBJS) -o $(TARGET) $(LIBS)

send: $(TARGET).prc
	pilot-xfer $(PILOTTTY) -i $(TARGET).prc

clean:
	-rm -f *.o $(TARGET) *.bin bin.res *.grc

veryclean: clean
	-rm -f $(TARGET).prc
