#
# makefile
#
# This is a derivative of the GNU fgrep-1.1.  This file and the
# others are distributed with the original license contract.  See COPYING.
#

MSDOS=1
#NT=1

DEFS=-DX_strerror

%if %defined(MSDOS)
CC=cl
LINK=cl
CFLAGS=-Oax -G2s $(DEFS)
LFLAGS=-link /noe
EXECOUT=-Fe
%endif

%if %defined(NT)
CC=cl386
LINK=link
CFLAGS=-As -G3d -MT -W3 -Di386=1 -DWIN32 -Oax $(DEFS)
LFLAGS=-machine:i386 -subsystem:console -entry:mainCRTStartup
LIBS=\nt\mstools\lib\base.lib \nt\mstools\lib\console.lib \
     \nt\mstools\lib\ntdll.lib \nt\mstools\lib\libcmt.lib
EXECOUT=-out:
%endif

FOBJ=fgrep.o kwset.o obstack.o std.o getopt.o wild.o

.c.o:
	$(CC) $(CFLAGS) -c -nologo -Fo$@ $<

fgrep: fgrep.exe

fgrep.exe: $(FOBJ)
        $(LINK) $(LIBS) $(EXECOUT)$@ $(FOBJ) $(LFLAGS)

clean: FRC
	rm -f fgrep.exe $(FOBJ)

FRC:

fgrep.o: unix.h
kwset.o fgrep.o: kwset.h obstack.h std.h
obstack.o: obstack.h
std.o: std.h unix.h
