#-----------------------------------------------------------------------------
# ObjectWindows - (C) Copyright 1994 by Borland International
#   Tutorial application -- makefile.
#
# The following models may be built by defines on command line or environment:
#   16-bit OWL DLL model: make          (MODEL=d, SYSTEM=WIN16 are defaults)
#   16-bit large model:   make MODEL=l  (SYSTEM=WIN16 is the default)
#   32-bit static model:  make SYSTEM=WIN32 MODEL=f
#   32-bit OWL DLL model: make SYSTEM=WIN32 MODEL=d
# Additionally set DEBUG=1 to build with debug information
# Specify TARGET=step??.exe to build only one target, rather than all samples
# Specify DOCVIEW=?????.obj to add more doc/view classes (must delete *.mak)
#           (requires .cpp file with template(s) and .rc file with resources)
#
#-----------------------------------------------------------------------------
MODELS=ldf                          # Allowable models

#
# Build EXE(s)
#
EXERES = sampexe
EXEALL = step01.exe step02.exe step03.exe step04.exe step05.exe step06.exe\
         step07.exe step08.exe step09.exe step10.exe step11.exe step12.exe\
         step13.exe step14.exe step15.exe step16.exe step17.exe step18.exe
EXEMAKE= $(STEP1) $(STEP2) $(STEP3) $(STEP4)  $(STEP5)  $(STEP6)\
         $(STEP7) $(STEP8) $(STEP9) $(STEP10) $(STEP11) $(STEP12)\
         $(STEP13) $(STEP14) $(STEP15) $(STEP16) $(CNTRL16) \
         $(STEP17) $(CNTRL17) $(STEP18) $(CNTRL18)


NORES = $(EXERULE:sampexe.res=)
STEP1 = $(NORES:sampexe=step01)
STEP2 = $(NORES:sampexe=step02)
STEP3 = $(NORES:sampexe=step03)
STEP4 = $(NORES:sampexe=step04)
STEP5 = $(EXERULE:sampexe=step05)
STEP6 = $(STEP5:step05=step06)
STEP7 = $(STEP5:step05=step07)
STEP8 = $(STEP5:step05=step08)
STEP9 = $(STEP5:step05=step09)
STEP10= $(STEP5:step05=step10)
STEP11= $(STEP5:step05=step11)
STEPV=  $(EXERULE:sampexe.obj=sampexe.obj sampexedv.obj $(DOCVIEW))
STEPW = $(STEPV:sampexe.res=sampexe.res sampexedv.res $(DOCVIEW:.obj=.res))
STEP12= $(STEPW:sampexe=step12)
STEP13= $(STEPW:sampexe=step13)
STEP14= $(STEPW:sampexe=step14)
STEP15= $(STEPW:sampexe=step15)
STEP16= $(STEPW:sampexe=step16)
CNTRL16= $(STEP1:step01=cntrl16)
STEP17= $(STEPW:sampexe=step17)
CNTRL17= $(STEP1:step01=cntrl17)
STEP18= $(STEPW:sampexe=step18)
CNTRL18= $(STEP1:step01=cntrl18)

RULES = ^
step16.obj: cntrl16.exe^
step17.obj: cntrl17.exe^
step18.obj: cntrl18.exe


#
# Build DLL Server(s)
#
DLL    = sampdll
OBJDLL = sampdllu.obj sampdlldu.obj
RESDLL = sampdll.res sampdlldv.res

STEP15U = $(DLLRULE:sampdll=step15) ^
step15u.obj : step15.cpp ^
  $(BCC) -ostep15u.obj step15.cpp ^
step15du.obj : step15dv.cpp ^
  $(BCC) -ostep15du.obj step15dv.cpp ^

STEP16U = $(STEP15U:step15=step16)
STEP17U = $(STEP15U:step15=step17)
STEP18U = $(STEP15U:step15=step18)

#
# Typically DLLs are built before EXEs - However, this does not have
# to be the case for these samples since non of the EXEs depend on
# the DLLs. Hence, if no TARGET is specified, we build the DLLs last
# using MAKEFILE.GEN's TARGETS macro. This allows a more logical
# build order [step01, step02, step03,...]
#
!if !$d(TARGET)
TARGETS= cfgdllsrvr step15.dll step16.dll step17.dll step18.dll makcln
RULES  = $(RULES) $(STEP15U) $(STEP16U) $(STEP17U) $(STEP18U)^
 ^
cfgdllsrvr: ^
  @copy &&| ^
-I$(INCLUDEPATH) ^
-c $(CFLAGSD)    ^
-w $(CDIAG) $(CPCHD) $(CCFDLL) ^
| $(CFGFILE) >NUL ^
 ^
makcln: ^
  @del $(MAKEFILE)

#
# Prevent MAKEFILE.GEN from building DLL Servers via DLLALL/DLLMAKE
#
DLLALL =
DLLMAKE=


!else

#
# A TARGET was specified
#
DLLALL = step15.dll step16.dll step17.dll step18.dll
DLLMAKE= $(STEP15U) $(STEP16U) $(STEP17U) $(STEP18U)

TARGETS= makcln
RULES  = $(RULES) ^
 ^
makcln: ^
  @del $(MAKEFILE)
!endif

!include $(BCEXAMPLEDIR)\owlocfmk.gen
