# Makefile for the WAISLOOK program

#NODEBUG = 1

!include <ntwin32.mak>

!IFDEF ddebug
!ELSE
!IFDEF NODEBUG
ddebug =
!ELSE
ddebug = -DDEBUG
!ENDIF
!ENDIF

# Location of libraries
LIBDIR = ..\bin

# Location of backup directory
!IFNDEF BACKDIR
BACKDIR = g:\infeng\freewais
!ENDIF

# Libraries themselves
PROTOCOL_LIB = $(LIBDIR)\wais-$(CPU).lib
INV_LIB = $(LIBDIR)\inv-$(CPU).lib

# We don't use inference rules for compiling, because of the need to
# have .obj files with different names from their .c sources.  This
# macro makes it easier to specify the compilation command. 

ccompile = $(cc) $(cdebug) $(cflags) $(cvarsmt) $(ddebug) -Fo$@ -I..\ir

# Main targets

default: $(LIBDIR)\waislook-$(CPU).exe

backup:
    copy *.c $(BACKDIR)\waislook
    copy *.h $(BACKDIR)\waislook
    copy Makefile $(BACKDIR)\waislook

clean:
    del *.obj *.bak *.map

# Intermediate targets

waislook-$(CPU).obj: waislook.c waisgn.h ..\ir\version.h
    $(ccompile) waislook.c

gotypr-$(CPU).obj: gotype.c
    $(ccompile) gotype.c

$(LIBDIR)\waislook-$(CPU).exe: gotypr-$(CPU).obj waislook-$(CPU).obj $(PROTOCOL_LIB) $(INV_LIB)
    $(link) $(linkdebug) $(conflags) -force -map:$*.map -out:$*.exe $** $(conlibsmt) wsock32.lib advapi32.lib

