# You need to have built PDPCLIB with makefile.c64 first

CPP=pdcc

ifeq "$(tools)" "mcc"
CC=mcc
CFLAGS=
else
CC=cc64
CFLAGS=-D__CC64__
endif

LD=pdld
LDFLAGS=-s
AS=pdas --oformat coff --64
COPTS=-O2 -D__WIN32__ -D__STATIC__ -D__NOBIVA__ -DWIN32 -DNO_QUICK \
    -I../../pdos/pdpclib -I../../pdos/src

OBJS= ansi.obj areas.obj bmg.obj config.obj control.obj date.obj dialogs.obj \
     dirute.obj dlgbox.obj fido.obj getopts.obj help.obj helpcmp.obj \
     helpinfo.obj init.obj \
     keycode.obj list.obj maintmsg.obj makemsgn.obj memextra.obj menu.obj \
     misc.obj mnu.obj msged.obj mxbt.obj normalc.obj nshow.obj quote.obj  \
     readmail.obj screen.obj strextra.obj system.obj template.obj textfile.obj \
     userlist.obj vsev.obj vsevops.obj win.obj wrap.obj unixio.obj

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

.c.obj:
  $(CPP) -E $(COPTS) -o $*.i $<
ifeq "$(tools)" "mcc"
  $(CC) -o:$*.s $*.i
else
  $(CC) -c -out:$@ $*.i
endif
  rm -f $*.i
ifeq "$(tools)" "mcc"
  $(AS) -o $@ $*.s
  rm -f $*.s
endif

clean:
  rm -f $(OBJS) msged.exe
