# Makefile : Builds the PHONE BOOK application
#
# Usage:     NMAKE PHBOOK (build PHBOOK.EXE)
#    or:     NMAKE -f phbook clean  (erase all compiled files)
#
# option:    DEBUG=[0|1]  (DEBUG not defined is equivalent to DEBUG=0)

# This is a part of the Microsoft Foundation Classes C++ library.
# Copyright (C) 1992 Microsoft Corporation
# All rights reserved.
#
# This source code is only intended as a supplement to the
# Microsoft Foundation Classes Reference and Microsoft
# QuickHelp documentation provided with the library.
# See these sources for detailed information regarding the
# Microsoft Foundation Classes product.

DIR=WIN

phbook.exe : $(DIR)\phbook.exe
	copy $** $@

!ifdef WIN16MFC
#!message compiling for WIN16

CPPFLAGS=  /DWINVER=0x0300 /AM /W3 /Zp /GA /GEs /G2
LINKFLAGS=/NOD /ONERROR:NOEXE

!if "$(DEBUG)"=="1"
CPPFLAGS=/D_DEBUG $(CPPFLAGS) /Od /Zi /f /Fo$*.OBJ
LINKFLAGS=$(LINKFLAGS) /COD
LIBS=mafxcwd libw mlibcew commdlg
!else
CPPFLAGS=$(CPPFLAGS) /Oselg /Gs /Fo$*.OBJ
LINKFLAGS=$(LINKFLAGS)  
LIBS=mafxcw libw mlibcew commdlg
!endif


.cpp{$(DIR)}.obj:
	$(CPP) /c $(CPPFLAGS) $<

.rc{$(DIR)}.res:
	$(RC) $(RFLAGS) /r /fo $@ $<

$(DIR)\phbook.exe: $(DIR) $(DIR)\person.obj $(DIR)\view.obj \
				   $(DIR)\database.obj phbook.def $(DIR)\phbook.res
	link $(LINKFLAGS) @<<
$(DIR)\person $(DIR)\view $(DIR)\database,
$@,
NUL,
$(LIBS),
phbook.def;
<<
	rc -30 /k /t $(DIR)\phbook.res
!else

!include ..\ntsample.mak


.cpp{$(DIR)}.obj:
    $(CPP) $(CPPFLAGS) /Fo$*.OBJ /c $<

.rc{$(DIR)}.res:
    rc -r -fo $*.tmp $<
    cvtres -$(CPU) $*.tmp -o $*.res
    del $*.tmp

!endif

$(DIR)\phbook.exe: $(DIR) $(DIR)\person.obj $(DIR)\view.obj \
				   $(DIR)\database.obj phbook.def $(DIR)\phbook.res
    $(LINK) $(GUIFLAGS) -out:$(DIR)\phbook.exe $(OBJS)  \
		$(DIR)\person.obj $(DIR)\view.obj $(DIR)\database.obj \
		$(DIR)\phbook.res $(MFCLIB) $(GUILIBS)


$(DIR):
	@IF NOT EXIST $(DIR)\*.* MD $(DIR)

person.obj : person.h
database.h : person.h
database.obj : database.h
view.obj : view.h database.h resource.h
phbook.res : resource.h phbook.ico phbook.rc phbook.dlg

clean:
	-del $(DIR)\person.obj
	-del $(DIR)\view.obj
	-del $(DIR)\phbook.res
	-del $(DIR)\database.obj
	-del $(DIR)\phbook.exe
