# This is the makefile for Win32 to build pdpclib using
# Open Watcom to create an msvcrt.dll suitable for using
# in a graphics-only environment like Win32s

CC=wcl386
CFLAGS=-oneatx
COPTS=-zls -c -ecc $(CFLAGS) -zl -fpi87 -q -D__PDPCLIB_DLL -D__WIN32__ -I. -I..\src -DWIN32S

all: clean pdptest.exe

pdptest.exe: w32start.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 __memmgr.obj fpfuncsw.obj winsupa.obj \
       win32s.obj dllcrt.obj
# These export definitions were generated by the killat utility
  wlink File dllcrt.obj,win32s.obj,temp.lib Name msvcrt2.dll Form windows nt dll Runtime native Library temp.lib,..\src\kernel32.lib,\watcom\lib386\nt\user32.lib,\watcom\lib386\nt\gdi32.lib Option quiet,nod,map,start='__DllMainCRTStartup@12' @watcom.exp
  del msvcrt.lib
#  echo wlib -q -n -ic msvcrt.lib +msvcrt.dll
  wlib -q msvcrt @msvcrt.wat
  wlink File w32start.obj,fpfuncsw.obj,pdptest.obj Name pdptest.exe Form windows nt Runtime con Library msvcrt.lib Option quiet,start=_mainCRTStartup

pdptest.obj: pdptest.c
  $(CC) -c -ecc $(CFLAGS) -zl -fpi87 -q -D__WIN32__ -I. -I..\src $*.c

win32s.obj: win32s.c
  $(CC) -I\watcom\h\nt -I\watcom\h -zls -c -ecc $(COPTS) -D__EXPORT__ -DNEED_START $*.c

w32start.obj: w32start.c
  $(CC) -zls -c -ecc $(CFLAGS) -zl -fpi87 -q -D__WIN32__ -I. -I..\src $*.c

dllcrt.obj: dllcrt.c
  $(CC) -zls -c -ecc $(COPTS) -D__EXPORT__ -DNEED_START $*.c

.c.obj:
  $(CC) $(COPTS) $<
  wlib -b -q temp.lib +$@

.asm.obj:
  wasm -q -zcm -DWATCOM $<
#  as86 -f coff -o $@ $<
  wlib -b -q temp.lib +$@

clean:
  rm -f *.obj
  rm -f pdptest.exe
  rm -f msvcrt.lib
  rm -f msvcrt.dll
  rm -f temp.lib
