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 / apputil / makefile < prev   
Makefile  |  1997-08-05  |  6KB  |  178 lines

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