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 / licserve / makefile < prev    next >
Encoding:
Makefile  |  1997-09-09  |  8.5 KB  |  247 lines

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