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 / conserve / makefile < prev    next >
Makefile  |  1997-09-09  |  8KB  |  243 lines

  1. #/*+=========================================================================
  2. #  File:       MAKEFILE
  3. #
  4. #  Summary:    Makefile for building the CONSERVE.DLL executable.  CONSERVE
  5. #              is a COM Component Server DLL providing a component version
  6. #              of the COM object in the CONSERVE code sample: COBall.
  7. #
  8. #              CONSERVE is meant to work in conjunction with the
  9. #              CONCLIEN.EXE application produced in the CONCLIEN lesson.
  10. #
  11. #              This Makefile creates a subdirectory (TEMP) for the
  12. #              .OBJ and .RES files used during the build process.  It also
  13. #              automatically registers the newly built DLL server
  14. #              as a COM server in the system Registry.  Since the build of
  15. #              this makefile does this registration you must build the
  16. #              REGISTER.EXE utility first (in sibling directory REGISTER).
  17. #
  18. #              For a comprehensive tutorial code tour of CONSERVE's
  19. #              contents and offerings see the tutorial CONSERVE.HTM
  20. #              file.  For more specific technical details see the comments
  21. #              dispersed throughout the CONSERVE source code.
  22. #
  23. #              See also CONCLIEN.HTM (in the main tutorial directory)
  24. #              for more details on the CONCLIEN client application and how
  25. #              it works with CONSERVE.DLL 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 a
  32. #              command prompt window.
  33. #
  34. #  Builds:     CONSERVE.DLL, CONSERVE.LIB
  35. #
  36. #  Origin:     5-30-96: atrent - Editor-inheritance from FRESERVE 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. #  To register server                   nmake register
  67. #  To unregister server                 nmake unregister
  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=BOTH
  95. !include <win32.mak>
  96.  
  97. # Assign the main program name macros.
  98. DLL = conserve
  99.  
  100. # Use a temporary sub-directory to store intermediate
  101. # binary files like *.obj, *.res, *.map, etc.
  102. TDIR = TEMP
  103.  
  104. # Assign destination and consumer sibling directories.
  105. IDIR = ..\inc
  106. LDIR = ..\lib
  107.  
  108. REGEXE = ..\register\register.exe
  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=$(IDIR);$(INCLUDE)
  114. LIB=$(LDIR);$(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. # DLLOBJS is a macro that defines the object files for the DLL.
  143. DLLOBJS = $(TDIR)\$(DLL).obj $(TDIR)\server.obj $(TDIR)\factory.obj \
  144.   $(TDIR)\connect.obj $(TDIR)\ball.obj
  145.  
  146. # The final target.
  147. all: input tempdir output
  148.  
  149. # Check if prior builds were done.
  150. input:
  151.   @IF NOT EXIST $(REGEXE) echo !!!!!! You must build REGISTER first !!!!!!
  152.  
  153. # Make the temporary work sub-directory.
  154. tempdir:
  155.   -mkdir $(TDIR)
  156.  
  157. # The actual output products.
  158. # Register the server after it's DLL is built.
  159. output: $(DLL).dll
  160.   if exist $(DLL).DLL if exist $(REGEXE) $(REGEXE) $(DLL).dll
  161.  
  162. # Compilation/Dependency rules for the .DLL source files.
  163. #
  164. $(TDIR)\$(DLL).obj: $(DLL).cpp $(DLL).h server.h
  165.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ $(DLL).cpp
  166.  
  167. $(TDIR)\server.obj: server.cpp server.h $(DLL).h
  168.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ server.cpp
  169.  
  170. $(TDIR)\factory.obj: factory.cpp factory.h server.h $(DLL).h
  171.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ factory.cpp
  172.  
  173. $(TDIR)\connect.obj: connect.cpp connect.h server.h $(DLL).h
  174.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ connect.cpp
  175.  
  176. $(TDIR)\ball.obj: ball.cpp ball.h server.h $(DLL).h
  177.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ ball.cpp
  178.  
  179. # Compile the DLL resources.
  180. $(TDIR)\$(DLL).res: $(DLL).rc $(DLL).ico server.h
  181.   rc $(RCFLAGS) -r -fo$@ $(DLL).rc
  182.  
  183. # Link the object and resource binaries into the target DLL binary.
  184. # Build the import LIB file so apps can link to and use this DLL.
  185. $(DLL).dll: $(DLLOBJS) $(TDIR)\$(DLL).res
  186.     $(LINK)  @<<
  187.     $(LINKFLAGS) $(dlllflags)
  188.     -out:$@
  189.     -base:0x1C000000
  190.     -def:$*.def
  191.     -implib:$*.lib
  192.     -map:$(TDIR)\$*.map
  193.     $(DLLOBJS)
  194.     $(TDIR)\$*.res
  195.     $(olelibsdll) $(APPLIBS)
  196. <<
  197.  
  198.  
  199. # Target to register the server
  200. register:
  201.   if exist $(DLL).DLL if exist $(REGEXE) $(REGEXE) $(DLL).dll
  202.  
  203. # Target to unregister the server
  204. unregister:
  205.   if exist $(DLL).DLL if exist $(REGEXE) $(REGEXE) /u $(DLL).dll
  206.  
  207. # Target to clean up binaries.
  208. clean:
  209.   -del $(DLL).exp
  210.   -del $(DLL).lib
  211.   -deltree /y $(TDIR)
  212.   -rmdir /s /q $(TDIR)
  213.  
  214. # Target to clean up all generated files.
  215. cleanall:
  216.   -del *.aps
  217.   -del *.bsc
  218.   -del *.dll
  219.   -del *.dsp
  220.   -del *.dsw
  221.   -del *.exe
  222.   -del *.exp
  223.   -del *.lib
  224.   -del *.mak
  225.   -del *.map
  226.   -del *.mdp
  227.   -del *.ncb
  228.   -del *.obj
  229.   -del *.opt
  230.   -del *.pch
  231.   -del *.pdb
  232.   -del *.plg
  233.   -del *.res
  234.   -del *.sbr
  235.   -del *.vcp
  236.   -del resource.h
  237.   -deltree /y $(TDIR)
  238.   -rmdir /s /q $(TDIR)
  239.   -deltree /y debug
  240.   -rmdir /s /q debug
  241.   -deltree /y release
  242.   -rmdir /s /q release
  243.