home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / tutsamp / perclien / makefile < prev    next >
Encoding:
Makefile  |  1997-08-05  |  8.3 KB  |  242 lines

  1. #/*+=========================================================================
  2. #  File:       MAKEFILE
  3. #
  4. #  Summary:    Makefile for building the PERCLIEN.EXE binary. PERCLIEN
  5. #              is a Win32 EXE that acts as a client of the PERSERVE,
  6. #              PERTEXT, and PERDRAW DLL servers to create and manipulate
  7. #              various COM objects for an application that edits and
  8. #              stores an open-ended series of text and drawing pages.
  9. #
  10. #              This Makefile therefore depends on a prior build (and the
  11. #              resultant registration) of the PERSERVE.DLL, PERTEXT.DLL,
  12. #              and PERDRAW.DLL COM servers.
  13. #
  14. #              This Makefile creates a subdirectory (TEMP) for the
  15. #              .OBJ and .RES files used during the build process.
  16. #
  17. #              For a comprehensive tutorial code tour of PERCLIEN's
  18. #              contents and offerings see the tutorial PERCLIEN.HTM
  19. #              file. For more specific technical details see the comments
  20. #              dispersed throughout the PERCLIEN source code.
  21. #
  22. #              See PERSERVE.HTM (in the main tutorial directory) more
  23. #              details on the PERSERVE server and how it works with
  24. #              PERCLIEN.EXE.
  25. #
  26. #              See PERTEXT.HTM (in the main tutorial directory) more
  27. #              details on the PERTEXT server and how it works with
  28. #              PERCLIEN.EXE.
  29. #
  30. #              See PERDRAW.HTM (in the main tutorial directory) more
  31. #              details on the PERDRAW server and how it works with
  32. #              PERCLIEN.EXE.
  33. #
  34. #              In general, to set up your system to build and test the
  35. #              Win32 code samples in this COM Tutorial series, see the
  36. #              main TUTORIAL.HTM file for details.  This MAKEFILE is
  37. #              Microsoft NMAKE compatible and the 'debug' build can be
  38. #              achieved by simply issuing the NMAKE command in the
  39. #              command prompt window.
  40. #
  41. #  Builds:     PERCLIEN.EXE.
  42. #
  43. #  Origin:     5-20-97: atrent - Editor-inheritance from STOCLIEN code
  44. #              sample makefile.
  45. #
  46. #--Usage:-------------------------------------------------------------------
  47. #  NMAKE Options
  48. #
  49. #  Use the table below to determine the additional options for NMAKE to
  50. #  generate various application debugging, profiling and performance tuning
  51. #  information.
  52. #
  53. #  Application Information Type         Invoke NMAKE
  54. #  ----------------------------         ------------
  55. #  For No Debugging Info                nmake nodebug=1
  56. #  For Working Set Tuner Info           nmake tune=1
  57. #  For Call Attributed Profiling Info   nmake profile=1
  58. #
  59. #  Note: The three options above are mutually exclusive (you may use only
  60. #        one to compile/link the application).
  61. #
  62. #  Note: creating the environment variables NODEBUG, TUNE, and PROFILE
  63. #        is an alternate method to setting these options via the nmake
  64. #        command line.
  65. #
  66. #  Additional NMAKE Options             Invoke NMAKE
  67. #  ----------------------------         ------------
  68. #  For No ANSI NULL Compliance          nmake no_ansi=1
  69. #    (ANSI NULL is defined as PVOID 0)
  70. #  To compile for Unicode               nmake unicode=1
  71. #    (Default is ANSI)
  72. #  To clean up temporary binaries       nmake clean
  73. #  To clean up all generated files      nmake cleanall
  74. #
  75. #---------------------------------------------------------------------------
  76. #  This file is part of the Microsoft COM Tutorial Code Samples.
  77. #
  78. #  Copyright (C) Microsoft Corporation, 1997.  All rights reserved.
  79. #
  80. #  This source code is intended only as a supplement to Microsoft
  81. #  Development Tools and/or on-line documentation.  See these other
  82. #  materials for detailed information regarding Microsoft code samples.
  83. #
  84. #  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  85. #  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  86. #  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  87. #  PARTICULAR PURPOSE.
  88. #=========================================================================+*/
  89.  
  90. #  WIN32.MAK should be included at the front of every Win32 makefile.
  91. #
  92. #  Define APPVER = [ 3.50 | 3.51 | 4.0 ] prior to including win32.mak to get
  93. #  build time checking for version dependencies and to mark the executable
  94. #  with version information.
  95. #
  96. #  Define TARGETOS = [ WIN95 | WINNT | BOTH ] prior to including win32.mak
  97. #  to get some build time checking for platform dependencies.
  98. #
  99. APPVER=4.0
  100. TARGETOS=BOTH
  101. !include <win32.mak>
  102.  
  103. # Assign the main program name macro.
  104. PGM=perclien
  105.  
  106. # Use a temporary sub-directory to store intermediate
  107. # binary files like *.obj, *.res, *.map, etc.
  108. TDIR = TEMP
  109.  
  110. # The sibling ..\INC and ..\LIB directories are added to the front of
  111. # the INCLUDE and LIB macros to inform the compiler and linker of
  112. # these application-specific locations for include and lib files.
  113. INCLUDE=..\inc;$(INCLUDE)
  114. LIB=..\lib;$(LIB)
  115.  
  116. LINK = $(link)
  117.  
  118. # If UNICODE=1 is defined then define UNICODE during Compiles.
  119. # The default is to compile with ANSI for running under both
  120. # Win95 and WinNT.
  121. !IFDEF UNICODE
  122. LINKFLAGS = $(ldebug)
  123. CDBG=$(cdebug) -DUNICODE -D_UNICODE
  124. RCFLAGS = -DWIN32 -DRC_INCLUDE -DUNICODE
  125. !ELSE
  126. LINKFLAGS = $(ldebug)
  127. CDBG=$(cdebug)
  128. RCFLAGS = -DWIN32 -DRC_INCLUDE
  129. !ENDIF
  130.  
  131. # If NODEBUG is not defined then define DEBUG during Compiles.
  132. # The default is to compile with debug symbols in the binaries.
  133. !IFNDEF NODEBUG
  134. CDBG = $(CDBG) -DDEBUG
  135. RCFLAGS = $(RCFLAGS) -DDEBUG
  136. !ENDIF
  137.  
  138. # APPLIBS are libraries used by this application that are outside
  139. # of its indigenous file set and are needed during the final link.
  140. APPLIBS = apputil.lib shell32.lib
  141.  
  142. # PGMOBJS is a macro that defines the object files for this application.
  143. PGMOBJS = $(TDIR)\$(PGM).obj $(TDIR)\guilist.obj $(TDIR)\listsink.obj \
  144.           $(TDIR)\pagefile.obj $(TDIR)\listwin.obj $(TDIR)\textwin.obj \
  145.           $(TDIR)\guitext.obj $(TDIR)\textsink.obj \
  146.           $(TDIR)\guidraw.obj $(TDIR)\drawsink.obj
  147.  
  148.  
  149. # The final target.
  150. all: tempdir output
  151.  
  152. # Make the temporary work sub-directory.
  153. tempdir:
  154.   -mkdir $(TDIR)
  155.  
  156. # The actual output products.
  157. output: $(PGM).exe
  158.  
  159. # Compilation/Dependency rules for the main source files.
  160. $(TDIR)\$(PGM).obj: $(PGM).cpp $(PGM).h resdef.h guilist.h
  161.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ $(PGM).cpp
  162.  
  163. $(TDIR)\guilist.obj: guilist.cpp guilist.h $(PGM).h resdef.h listsink.h \
  164.        listwin.h guitext.h textwin.h
  165.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ guilist.cpp
  166.  
  167. $(TDIR)\listsink.obj: listsink.cpp listsink.h guilist.h
  168.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ listsink.cpp
  169.  
  170. $(TDIR)\pagefile.obj: pagefile.cpp pagefile.h
  171.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ pagefile.cpp
  172.  
  173. $(TDIR)\listwin.obj: listwin.cpp listwin.h
  174.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ listwin.cpp
  175.  
  176. $(TDIR)\guitext.obj: guitext.cpp guitext.h $(PGM).h resdef.h \
  177.        textsink.h textwin.h
  178.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ guitext.cpp
  179.  
  180. $(TDIR)\textsink.obj: textsink.cpp textsink.h guitext.h
  181.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ textsink.cpp
  182.  
  183. $(TDIR)\textwin.obj: textwin.cpp textwin.h
  184.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ textwin.cpp
  185.  
  186. $(TDIR)\guidraw.obj: guidraw.cpp guidraw.h $(PGM).h resdef.h drawsink.h
  187.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ guidraw.cpp
  188.  
  189. $(TDIR)\drawsink.obj: drawsink.cpp drawsink.h guidraw.h
  190.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ drawsink.cpp
  191.  
  192. # Compile the resources.
  193. $(TDIR)\$(PGM).res: $(PGM).rc $(PGM).ico resdef.h
  194.   rc $(RCFLAGS) -r -fo$@ $(PGM).rc
  195.  
  196. # Link the object and resource binaries into the final target binary.
  197. $(PGM).exe: $(PGMOBJS) $(TDIR)\$(PGM).res
  198.   $(LINK) @<<
  199.     $(LINKFLAGS)
  200.     -out:$@
  201.     -map:$(TDIR)\$*.map
  202.     $(PGMOBJS)
  203.     $(TDIR)\$*.res
  204.     $(olelibs) $(APPLIBS)
  205. <<
  206.  
  207. # Target to clean up temporary binaries.
  208. clean:
  209.   -del $(PGM).pdb
  210.   -deltree /y $(TDIR)
  211.   -rmdir /s /q $(TDIR)
  212.  
  213. # Target to clean up all generated files.
  214. cleanall:
  215.   -del *.aps
  216.   -del *.bsc
  217.   -del *.dll
  218.   -del *.dsp
  219.   -del *.dsw
  220.   -del *.exe
  221.   -del *.exp
  222.   -del *.lib
  223.   -del *.mak
  224.   -del *.map
  225.   -del *.mdp
  226.   -del *.ncb
  227.   -del *.obj
  228.   -del *.opt
  229.   -del *.pch
  230.   -del *.pdb
  231.   -del *.plg
  232.   -del *.res
  233.   -del *.sbr
  234.   -del *.vcp
  235.   -del resource.h
  236.   -deltree /y $(TDIR)
  237.   -rmdir /s /q $(TDIR)
  238.   -deltree /y debug
  239.   -rmdir /s /q debug
  240.   -deltree /y release
  241.   -rmdir /s /q release
  242.