!include <ntwin32.mak>

C_DEFINES=-DWIN_NT -DSTDC_HEADERS -D_POSIX_SOURCE -DDIRENT -DSTACK_DIRECTION=-1 -DMSS -D__STDC__ -D_POSIX_ -DCONVERT_TO_SLASHES -UCONVERT_TO_BACKSLASHES
C_INCLUDES=-I..\include\bsd -I..\include\df

all: grep.exe

..\bsdpsx\bsdpsx.lib:
	cd ..\bsdpsx
	nmake
	cd ..\grep

grep.obj: grep.c *.h

egrep.obj: egrep.c *.h

regerror.obj: regerror.c *.h

regexp.obj: regexp.c *.h

regsub.obj: regsub.c *.h

getopt.obj: getopt.c *.h

glob.obj: glob.c *.h

grep.exe: grep.obj egrep.obj regerror.obj regexp.obj regsub.obj getopt.obj glob.obj ..\bsdpsx\bsdpsx.lib
	$(link) $(linkdebug) $(psxflags) -out:$*.exe $** $(psxlibs) ..\bsdpsx\bsdpsx.lib

.c.obj:
	$(cc) $(cflags) $(psxvars) $(cvars) $(cdebug) $(C_DEFINES) $(C_INCLUDES) $*.c
