# This builds a.out files for PDOS386, on Windows
# For the 32-bit version of PDOS we define __PDOS386__

# Note that the traditional as386 assembler targeting
# a.out treats .align as a power of 2, which the
# traditional gcc386 compiler generates. gccwin was
# switched to use .balign to produce consistent results

CC=gccwin
COPTS=-S -O2 -ansi -U__WIN32__ -DNOLIBALLOC -fno-common -D__PDOS386__ -D__32BIT__ -I. -I../src

pdptest.exe: pdosst32.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 pos.o support.o pdossupc.o
  rm -f pdos.a
  xar r pdos.a pdosst32.o stdio.o string.o stdlib.o
  xar r pdos.a start.o time.o errno.o assert.o signal.o
  xar r pdos.a locale.o ctype.o setjmp.o math.o
  xar r pdos.a pos.o support.o pdossupc.o
  xar s pdos.a
  ld86 -N -s -e ___pdosst32 -o pdptest.exe pdosst32.o pdptest.o pdos.a

pos.o: ../src/pos.c
  $(CC) $(COPTS) -o $*.s ../src/pos.c
  pdas -o $*.o $*.s
  rm -f $*.s

support.o: ../src/support.s
  pdas -o $*.o ../src/support.s

.c.o:
  $(CC) $(COPTS) -o $*.s $<
  pdas -o $*.o $*.s
  rm -f $*.s
