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 / comobj / makefile < prev    next >
Makefile  |  1997-08-05  |  7KB  |  220 lines

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