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 / dcdserve / makefile < prev    next >
Encoding:
Makefile  |  1997-09-09  |  8.1 KB  |  240 lines

  1. #/*+=========================================================================
  2. #  File:       MAKEFILE
  3. #
  4. #  Summary:    Makefile for building the DCDSERVE.EXE executable.
  5. #              DCDSERVE is a COM out-of-process local server
  6. #              providing a component version of the COPaper COM object.
  7. #
  8. #              DCDSERVE is meant to work in conjunction with the
  9. #              DCOMDRAW.EXE client application produced in the
  10. #              DCOMDRAW 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 EXE 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 DCDSERVE's
  20. #              contents and offerings see the tutorial DCDSERVE.HTM
  21. #              file.  For more specific technical details see the comments
  22. #              dispersed throughout the DCDSERVE source code.
  23. #
  24. #              See also DCOMDRAW.HTM (in the main tutorial directory)
  25. #              for more details on the DCOMDRAW client application and how
  26. #              it works with DCDSERVE.EXE.
  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. #              global 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:     DCDSERVE.EXE.
  36. #
  37. #  Origin:     8-23-96: atrent - Editor-inheritance from LOCSERVE 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=WINNT
  96. !include <win32.mak>
  97.  
  98. # Assign the main program name macros.
  99. PGM = dcdserve
  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. # PGMOBJS is a macro that defines the object files for this application.
  144. PGMOBJS = $(TDIR)\$(PGM).obj $(TDIR)\server.obj $(TDIR)\factory.obj \
  145.   $(TDIR)\connect.obj $(TDIR)\paper.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 EXE is built.
  160. output: $(PGM).exe
  161.   if exist $(PGM).EXE if exist $(REGEXE) $(REGEXE) /e $(PGM).EXE
  162.  
  163. # Compilation/Dependency rules for the main source files.
  164. #
  165. $(TDIR)\$(PGM).obj: $(PGM).cpp $(PGM).h server.h
  166.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ $(PGM).cpp
  167.  
  168. $(TDIR)\server.obj: server.cpp server.h $(PGM).h
  169.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ server.cpp
  170.  
  171. $(TDIR)\factory.obj: factory.cpp factory.h server.h $(PGM).h
  172.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ factory.cpp
  173.  
  174. $(TDIR)\connect.obj: connect.cpp connect.h server.h $(PGM).h
  175.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ connect.cpp
  176.  
  177. $(TDIR)\paper.obj: paper.cpp paper.h server.h $(PGM).h
  178.   $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ paper.cpp
  179.  
  180. # Compile the resources.
  181. $(TDIR)\$(PGM).res: $(PGM).rc $(PGM).ico $(PGM).h
  182.   rc $(RCFLAGS) -r -fo$@ $(PGM).rc
  183.  
  184. # Link the object and resource binaries into the target EXEL binary.
  185. # Build the import LIB file so apps can link to and use this EXE.
  186. $(PGM).exe: $(PGMOBJS) $(TDIR)\$(PGM).res
  187.     $(LINK)  @<<
  188.     $(LINKFLAGS)
  189.     -out:$@
  190.     -map:$(TDIR)\$*.map
  191.     $(PGMOBJS)
  192.     $(TDIR)\$*.res
  193.     $(olelibs) $(APPLIBS)
  194. <<
  195.  
  196.  
  197. # Target to register the server
  198. register:
  199.   if exist $(PGM).EXE if exist $(REGEXE) $(REGEXE) /e $(PGM).EXE
  200.  
  201. # Target to unregister the server
  202. unregister:
  203.   if exist $(PGM).EXE if exist $(REGEXE) $(REGEXE) /e /u $(PGM).EXE
  204.  
  205. # Target to clean up binaries.
  206. clean:
  207.   -del $(PGM).pdb
  208.   -deltree /y $(TDIR)
  209.   -rmdir /s /q $(TDIR)
  210.  
  211. # Target to clean up all generated files.
  212. cleanall:
  213.   -del *.aps
  214.   -del *.bsc
  215.   -del *.dll
  216.   -del *.dsp
  217.   -del *.dsw
  218.   -del *.exe
  219.   -del *.exp
  220.   -del *.lib
  221.   -del *.mak
  222.   -del *.map
  223.   -del *.mdp
  224.   -del *.ncb
  225.   -del *.obj
  226.   -del *.opt
  227.   -del *.pch
  228.   -del *.pdb
  229.   -del *.plg
  230.   -del *.res
  231.   -del *.sbr
  232.   -del *.vcp
  233.   -del resource.h
  234.   -deltree /y $(TDIR)
  235.   -rmdir /s /q $(TDIR)
  236.   -deltree /y debug
  237.   -rmdir /s /q debug
  238.   -deltree /y release
  239.   -rmdir /s /q release
  240.