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 / dcomdraw / makefile < prev    next >
Makefile  |  1997-08-30  |  7KB  |  209 lines

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