#
#  Copyright (C) 1998 International Computer Science Institute (ICSI)
#
#  Author: Vladimir Minenko, minenko@icsi.berkeley.edu
#
#  This 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 2 of the License, or
#  (at your option) any later version.
#
#  This software 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 software; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
#  USA.
#

# Makefile for Palm VNC

TARGET = palmVNC
APPNAME = "PalmVNC"
APPID = "PVNC"

OBJS = d3des.o vncauth.o rfbproto.o AppStdIO.o sockets.o $(TARGET).o
LIBS =

CC = m68k-palmos-gcc

# define OS3 if compiled with SDK 3.0
# define  GRAYSCALE if need to test partial grascale support (never tested)
CONFIG_DEFS = -DOS3 -DGRAYSCALE -DNON_INTERNATIONAL

# CFLAGS = -I./ -Wall -g -DDEBUG $(CONFIG_DEFS)
CFLAGS = -I./ -O2 $(CONFIG_DEFS)
#CFLAGS = -I./ -Wall -g -DDEBUG $(CONFIG_DEFS) -Wpointer-arith -Wcast-align -Wconversion -mdebug-labels

PILRC = pilrc
OBJRES = m68k-palmos-coff-obj-res
BUILDPRC = build-prc
PILOTXFER = pilot-xfer
TXT2BITM = txt2bitm

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
	ls -al $(TARGET).prc

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

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

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

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

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

bin.res: $(TARGET).rcp palmVNC_icon.bmp
	$(PILRC) $(TARGET).rcp .
	touch bin.res

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o $(TARGET) $(LIBS)

send: $(TARGET).prc
	$(PILOTXFER) -i $(TARGET).prc

depend:
	makedepend -Y -I. *.c

clean:
	-rm -f *.[oa] $(TARGET) *.bin bin.res *.grc Makefile.bak *.tmp

veryclean: clean
	-rm -f $(TARGET).prc pilot.ram pilot.scratch *% *.bak

# DO NOT DELETE

AppStdIO.o: AppStdIO.h
palmVNC.o: callback.h palmVNC.h ./rfbproto.h AppStdIO.h palmVNCRsc.h
rfbproto.o: palmVNC.h ./rfbproto.h AppStdIO.h
sockets.o: palmVNC.h ./rfbproto.h AppStdIO.h
