# This builds support library for PDOS386 programs, on Windows using Visual Studio
# This allows the Pos* functions to be called by applications
# PDOS itself uses the C library, but defines the Pos functions internally
# For the 32-bit version of PDOS we define __PDOS386__

CC=cl
COPTS=-D__MSC__ -O2 -U__WIN32__ -DNOLIBALLOC -D__PDOS386__ -D__32BIT__ -I. -I../src -c -Oi- -Zl -GS- -nologo

pdptest.exe: pdosst32.obj pdptest.obj stdio.obj string.obj stdlib.obj \
       start.obj time.obj errno.obj assert.obj signal.obj locale.obj \
       ctype.obj setjmp.obj math.obj pos.obj supportf.obj pdossupc.obj \
       fpfuncsv.obj
  rm -f pdos.lib
  lib -nologo -out:temp1.lib pdosst32.obj stdio.obj string.obj stdlib.obj
  lib -nologo -out:temp2.lib start.obj time.obj errno.obj assert.obj signal.obj
  lib -nologo -out:temp3.lib locale.obj ctype.obj setjmp.obj math.obj
  lib -nologo -out:temp4.lib pos.obj supportf.obj pdossupc.obj fpfuncsv.obj
  lib -nologo -out:pdos.lib temp1.lib temp2.lib temp3.lib temp4.lib
  rm -f temp1.lib
  rm -f temp2.lib
  rm -f temp3.lib
  rm -f temp4.lib
  link -nologo -fixed:no -nodefaultlib -entry:__pdosst32 -out:pdptest.exe pdosst32.obj pdptest.obj pdos.lib
#  pdld --no-insert-timestamp -s -e ___pdosst32 -o pdptest.exe pdosst32.o pdptest.o pdos.a

pos.obj: ../src/pos.c
  $(CC) $(COPTS) -Fo$@ ../src/pos.c

supportf.obj: ../src/supportf.asm
  ml -nologo -c -coff -Fo$@ $<
#  as86 -f coff -o $@ ../src/supportf.asm

.c.obj:
  $(CC) $(COPTS) -Fo$@ $<
