# makefile for nc100em

# there are various compile-time options. generally you won't want to
# change the `CFLAGS' line below, but they're described below in case
# you do.
#
# -DPTY_SERIAL enables serial support via a pty. Recommended. Too slow
# for file transfers, but great for use as a serial console in ZCN.
# -DNO_SPEED_CONTROL is necessary on slow machines.
#  XXX WARNING! Omitting it currently causes the console to lock up!!!
#    (in other words, don't omit it. :-))
# -DSCALE=n sets how many times to scale up the window, 1=normal.
#  Don't bother with n>1, it's far too slow. Also, it only works on
#  8-bit displays at the moment.
# -DMITSHM is for the X version. Don't remove it unless you have
#  problems compiling.
#
CFLAGS=-I. -DNO_SPEED_CONTROL -DMITSHM -DSCALE=1 -DPTY_SERIAL -O

# this looks wrong, but *ops.c are actually #include'd by z80.c
NC100EM_OBJS=main.o z80.o
TNC100EM_OBJS=txtmain.o z80.o
XNC100EM_OBJS=xmain.o z80.o

all: nc100em tnc100em xnc100em zcndisk

svga: vga

vga: nc100em zcndisk

text: tnc100em zcndisk

x: xnc100em zcndisk

nc100em: $(NC100EM_OBJS)
	$(CC) -o nc100em $(NC100EM_OBJS) -lvgagl -lvga librawkey.a

tnc100em: $(TNC100EM_OBJS)
	$(CC) -o tnc100em $(TNC100EM_OBJS)

xnc100em: $(XNC100EM_OBJS)
	$(CC) -o xnc100em $(XNC100EM_OBJS) -L/usr/X11R6/lib -lXext -lX11

zcndisk: zcndisk.o
	$(CC) -o zcndisk zcndisk.o

# this is omitted from the 'all' target as most people won't have
# zmac, and 'nc100.rom' will be effectively portable anyway... :-)
nc100.rom: nc100rom.z
	zmac nc100rom.z
	mv nc100rom.bin nc100.rom

install:
	if [ -f nc100em ]; then \
	install -o root -m 4511 -s nc100em /usr/local/bin; fi
	if [ -f tnc100em ]; then \
	install -m 511 -s tnc100em /usr/local/bin; fi
	if [ -f xnc100em ]; then \
	install -m 511 -s xnc100em /usr/local/bin; fi
	install -m 511 -s zcndisk /usr/local/bin

clean:
	$(RM) *.o *~


txtmain.o: main.c
	$(CC) $(CFLAGS) -DTEXT_VER -c main.c -o txtmain.o
