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 / hello / hellctrl / makefile < prev    next >
Encoding:
Makefile  |  1997-11-19  |  4.7 KB  |  232 lines

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