home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / oleaut / dispcalc / makefile < prev    next >
Encoding:
Makefile  |  1997-11-19  |  4.3 KB  |  232 lines

  1. ##############################################################################
  2. #
  3. #  (c) Copyright Microsoft Corp. 1992-1993 All Rights Reserved
  4. #
  5. #  File:
  6. #
  7. #    makefile - makefile for spoly2.exe
  8. #
  9. #  Purpose:
  10. #
  11. #    Builds the OLE 2.0 sample IDispatch server, dispcalc.exe.
  12. #
  13. #
  14. #  Usage:
  15. #
  16. #     NMAKE                     ; build with defaults
  17. #     or: NMAKE option          ; build with the given option(s)
  18. #     or: NMAKE clean           ; erase all compiled files
  19. #
  20. #     option:
  21. #         dev = [win16 | win32] ; dev=win32 is the default
  22. #         DEBUG=[0|1]           ; DEBUG=1 is the default
  23. #
  24. #  Notes:
  25. #
  26. #    This makefile assumes that the PATH, INCLUDE and LIB environment
  27. #    variables are setup properly.
  28. #
  29. ##############################################################################
  30.  
  31.  
  32.  
  33. ##########################################################################
  34. #
  35. # Default Settings
  36. #
  37.  
  38. !if "$(dev)" == ""
  39. dev = win32
  40. !endif
  41.  
  42. !if !("$(dev)" == "win16" || "$(dev)" == "win32")
  43. !error Invalid dev option, choose from [win16 | win32]
  44. !endif
  45.  
  46. !if "$(dev)" == "win16"
  47. TARGET  = WIN16
  48. !endif
  49.  
  50. !if "$(dev)" == "win32"
  51. TARGET  = WIN32
  52. !endif
  53.  
  54. !ifdef NODEBUG
  55. DEBUG = 0
  56. !endif
  57.  
  58. !if "$(DEBUG)" == "0"
  59. NODEBUG = 1
  60. !endif
  61.  
  62. !if "$(DEBUG)" == ""
  63. DEBUG = 1
  64. !endif
  65.  
  66.  
  67. ##########################################################################
  68. #
  69. # WIN16 Settings
  70. #
  71. !if "$(TARGET)" == "WIN16"
  72.  
  73. CC   = cl
  74. LINK = link
  75.  
  76. RCFLAGS = -dWIN16
  77. CFLAGS = -c -W3 -AM -GA -GEs -DWIN16
  78. LINKFLAGS = /NOD /NOI /BATCH /ONERROR:NOEXE
  79.  
  80. LIBS = libw.lib mlibcew.lib
  81.  
  82. !if "$(DEBUG)" == "1"
  83. CFLAGS = $(CFLAGS) -Od -Zi -D_DEBUG $(CL)
  84. LINKFLAGS = $(LINKFLAGS) /COD
  85. !else
  86. CFLAGS = $(CFLAGS) -Ox $(CL)
  87. LINKFLAGS = $(LINKFLAGS) /FAR /PACKC
  88. !endif
  89. !endif
  90.  
  91.  
  92. ##########################################################################
  93. #
  94. # WIN32 Settings
  95. #
  96. !if "$(TARGET)" == "WIN32"
  97.  
  98. !include <olesampl.mak>
  99.  
  100. CC = $(cc)
  101. CFLAGS = $(cflags) $(cvarsmt) -DINC_OLE2 $(cdebug)
  102.  
  103. !ifndef NODEBUG
  104. CFLAGS = $(CFLAGS) -D_DEBUG
  105. !endif
  106.  
  107. LINK = $(link)
  108. LINKFLAGS = $(linkdebug) $(guilflags)
  109. RCFLAGS = -DWIN32
  110.  
  111. !endif
  112.  
  113.  
  114. ##########################################################################
  115. #
  116. # Build rules
  117. #
  118.  
  119. .cpp.obj:
  120.     @echo Compiling $<...
  121.     $(CC) $<
  122.  
  123. .c.obj:
  124.     @echo Compiling $<...
  125.     $(CC) $<
  126.  
  127.  
  128. ##########################################################################
  129. #
  130. # Application Settings
  131. #
  132.  
  133. APPS = dispcalc
  134.  
  135.  
  136. !if "$(TARGET)" == "WIN16"
  137. LIBS = ole2.lib compobj.lib ole2disp.lib $(LIBS)
  138. !else
  139. !if "$(TARGET)" == "WIN32"
  140. LIBS = $(olelibsmt)
  141. !endif
  142. !endif
  143.  
  144. OBJS = \
  145.         winmain.obj     \
  146.         idata.obj       \
  147.         dispcalc.obj    \
  148.         clsid.obj
  149.  
  150.  
  151. ##########################################################################
  152. #
  153. # Default Goal
  154. #
  155.  
  156. goal : setflags $(APPS).exe
  157.  
  158. setflags :
  159.         set CL=$(CFLAGS)
  160.  
  161.  
  162. ##########################################################################
  163. #
  164. # Clean (erase) generated files
  165. #
  166. clean :
  167.     if exist *.obj       del *.obj
  168.     if exist $(APPS).exe del $(APPS).exe
  169.     if exist $(APPS).map del $(APPS).map
  170.     if exist $(APPS).res del $(APPS).res
  171.  
  172.  
  173. ##########################################################################
  174. #
  175. # Application Build (WIN16 Specific)
  176. #
  177.  
  178. !if "$(TARGET)" == "WIN16"
  179. $(APPS).exe : $(OBJS) $(APPS).def $(APPS).res $(APPS).ico
  180.         link $(LINKFLAGS) @<<
  181. $(OBJS),
  182. $@,,
  183. $(LIBS),
  184. $(APPS).def
  185. <<
  186.         rc -k -t $(APPS).res $@
  187. !endif
  188.  
  189.  
  190. ##########################################################################
  191. #
  192. # Application Build (WIN32 Specific)
  193. #
  194. !if "$(TARGET)" == "WIN32"
  195. $(APPS).exe : $(OBJS) $(APPS).def $(APPS).res $(APPS).ico
  196.       $(LINK) @<<
  197.         $(LINKFLAGS)
  198.         -out:$@
  199.         -map:$*.map
  200.         $(OBJS)
  201.         $(APPS).res
  202.         $(LIBS)
  203. <<
  204. !endif
  205.  
  206.  
  207. ##########################################################################
  208. #
  209. # Application Build (Common)
  210. #
  211.  
  212. $(APPS).res : $(APPS).rc
  213.         rc  $(RCFLAGS) -r -fo$@ $?
  214.  
  215.  
  216. ##########################################################################
  217. #
  218. # Dependencies
  219. #
  220.  
  221. winmain.obj: winmain.cpp dispcalc.h
  222.     $(CC) winmain.cpp
  223.  
  224. idata.obj: idata.cpp dispcalc.h
  225.     $(CC) idata.cpp
  226.  
  227. dispcalc.obj: dispcalc.cpp dispcalc.h
  228.     $(CC) dispcalc.cpp
  229.  
  230. clsid.obj: clsid.c clsid.h
  231.     $(CC) clsid.c
  232.