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 / register / makefile next >
Makefile  |  1997-08-05  |  6KB  |  189 lines

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