# This builds a PDOS-generic executable


# Note that you can use Watcom tools instead by going:
# wcl386 -q -D__PDOS386__ -D__PDOSGEN__
# -I. -I..\generic -I..\src -zl -s -ecc
# -"option start=___crt0"
# -fe=pdptest.exe pgastart.c pdptest.c fpfuncsw.c

# or alternatively, add "-c" to the above and change linker,
# such as:
# pdld -o pdptest.exe --emit-relocs -e ___crt0
# pgastart.obj pdptest.obj fpfuncsw.obj


# Note that a PDOS-generic executable can be run under
# PDOS/386 (built with comp4w.bat, comp5w.bat and comp6w.bat),
# PDOS-generic (built with generic/makefile.w32 and run under
# a suitable pseudobios such as makebios.efi) or it can be
# run directly under the pseudobios itself if it happens to
# export an entire C90 library in a compatible way (ie
# processor and calling convention need to match), as the
# above example does. And makebios.w32 is another example of
# a pseudobios that is in a position to export the entire C
# library, allowing you to run a.out etc executables under
# Windows, like this:
# bios -quiet pdptest "abc def"


CC=gccwin
COPTS=-S -O2 -U__WIN32__ -D__PDOS386__ -D__PDOSGEN__ \
    -D__NOBIVA__ -I . -I../generic -I../src

all: clean pdptest.exe

pdptest.exe: pgastart.o pdptest.o
  rm -f pdptest.exe
  pdld -s -e ___crt0 -o pdptest.exe pgastart.o pdptest.o

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

.asm.obj:
  pdas -o $@ $<

clean:
  rm -f pdptest.exe
