# makefile for nc100d

# nc100d requires djgpp in order to compile. I use the rather old 1.x
# as I happen to have a copy on an old CD :-) - it may or may not work
# with later versions. So I wouldn't recommend recompiling unless
# you're prepared to mess about with things one way or another.

CC=gcc
CFLAGS=-O -Wall

# set this to where stub.exe is.
DJGPPBIN=c:\djgpp\bin

# you shouldn't need to edit the rest
#-----------------------------------------------------------------

# this looks wrong, but *ops.c are actually #include'd by z80.c
NC100D_OBJS=main.o common.o libdir.o z80.o \
	getoptn.o rawkey.o vga.o timer.o

all: nc100d makememc zcntools

nc100d: $(NC100D_OBJS)
	$(CC) -o nc100d $(NC100D_OBJS) -lpc
	coff2exe nc100d
	copy nc100d.exe ..
	del nc100d.exe

makememc: makememc.c libdir.o
	$(CC) -o makememc makememc.c libdir.o
	coff2exe makememc
	copy makememc.exe ..
	del makememc.exe

zcntools: zcntools.o libdir.o
	$(CC) -o zcntools zcntools.o libdir.o
	coff2exe zcntools
	copy $(DJGPPBIN)\stub.exe zcnls.exe
	stubedit zcnls.exe runfile=zcntools
	command /c for %i in (cat df fmt get info) do copy zcnls.exe zcn%i.exe
	command /c for %i in (put ren rm zero) do copy zcnls.exe zcn%i.exe
	copy zcn*.exe ..
	del zcn*.exe

pdrom.h: pdrom.bin mkromhdr
	go32 ./mkromhdr >pdrom.h

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

clean:
	$(RM) *.o *.lst nc100d zcntools makememc
	$(RM) mkromhdr pdrom.h


common.o: common.c pdrom.h z80.h libdir.h

