# This is the makefile for Linux to build pdpclib using
# the xcc compiler.
#
# Also define __W32EMUL__ if you wish to make the
# pseudo-bios. It has no meaning outside of that -
# it isn't Linux-related

# This uses coff format until the link step

CC=xcc
AR=xar

AS=sasm -f coff
#AS=ml -c
# If you wish to use pdas, you need to use linsupa instead of linsupb
###AS=pdas --oformat coff

AS2=sasm -f coff
#AS2=ml -c
LD=pdld --oformat elf

COPTS=-D__W32EMUL__ -U__WIN32__ -S -D__gnu_linux__ -D__NOBIVA__ -I .

pdptest: linstart.o linsupb.o pdptest.o stdio.o string.o stdlib.o \
       start.o time.o errno.o assert.o signal.o locale.o \
       ctype.o setjmp.o math.o __memmgr.o
  rm -f pdplinux.a
  $(AR) r pdplinux.a linstart.o linsupb.o stdio.o string.o stdlib.o
  $(AR) r pdplinux.a start.o time.o errno.o assert.o signal.o
  $(AR) r pdplinux.a locale.o ctype.o setjmp.o math.o __memmgr.o
  $(AR) s pdplinux.a
  $(LD) -s --emit-relocs -nostdlib -e ___pdpent -o pdptest.exe linstart.o pdptest.o pdplinux.a

.c.o:
  $(CC) $(COPTS) -o $*.s $<
  $(AS2) -o $*.o $*.s
#  $(AS2) -Fo=$*.o $*.s
  rm -f $*.s

.asm.o:
  $(AS) -o $@ $<
#  $(AS) -Fo=$@ $<
