# Released to the public domain.
#
# Anyone and anything may copy, edit, publish,
# use, compile, sell and distribute this work
# and all its parts in any form for any purpose,
# commercial and non-commercial, without any restrictions,
# without complying with any conditions
# and by any means.

# This makefile builds 64-bit uemacs.exe on Windows.
# This doesn't use msvcrt.dll, so that the executable
# works on genuine Windows. ie makefile.c64 was used

CPP=pdcc
CC=cc64
CFLAGS=
LD=pdld
LDFLAGS=-s -nostdlib --no-insert-timestamp --image-base 0x400000
AS=pdas --oformat coff --64
COPTS=-I. -I../pdos/pdpclib -D__WIN32__ -D__STATIC__ -D__NOBIVA__ -D__64BIT__ -D__CC64__ -DC90

OBJS=		ansi.obj basic.obj bind.obj buffer.obj display.obj file.obj \
		fileio.obj line.obj lock.obj main.obj random.obj region.obj \
		search.obj spawn.obj termio.obj window.obj word.obj

TARGET=uemacs.exe

all: clean $(TARGET)

$(TARGET): $(OBJS)
  $(LD) $(LDFLAGS) -o $(TARGET) ../pdos/pdpclib/p32start.obj $(OBJS) ../pdos/pdpclib/pdpwin64.lib ../pdos/src/kernel32.lib

.c.obj:
  $(CPP) -E $(COPTS) -o $*.i $<
  $(CC) -q -c -out:$@ $*.i
  rm -f $*.i

clean:
  rm -f $(OBJS) $(TARGET)
