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

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