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

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