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 / comuser / makefile < prev    next >
Makefile  |  1997-08-05  |  7KB  |  208 lines

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