# This is the makefile for Win32 to build pdpclib using
# the gcc compiler and static linking. Use pdmake etc

# Linking using -lgcc is required on some versions of
# gcc at least (like gcc 3.2 delivered by cygwin)
# in order to get alloca which is auto-generated

CC=gcc
CFLAGS=-O2
COPTS=-c $(CFLAGS) -fno-common -ansi -D__WIN32__ -D__STATIC__ -I . -I../src

all: pdptest.exe

pdptest.exe: p32start.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 winsupc.obj
  cmd /c if exist pdpwin32.a del pdpwin32.a
  ar r pdpwin32.a p32start.o stdio.o string.o stdlib.o winsupc.obj
  ar r pdpwin32.a start.o time.o errno.o assert.o signal.o
  ar r pdpwin32.a locale.o ctype.o setjmp.o math.o __memmgr.o
  gcc -s -nostdlib -o pdptest.exe p32start.o pdptest.o pdpwin32.a ../src/kernel32.a -lgcc

.c.o:
  $(CC) $(COPTS) $<

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

clean:
  rm -rf *.o
  rm -rf pdptest.exe
