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 / browseh / makefile < prev    next >
Encoding:
Makefile  |  1997-11-19  |  7.0 KB  |  293 lines

  1. ####
  2. #makefile - makefile for browseh.dll
  3. #
  4. #       Copyright 1994 - 1997 Microsoft Corporation
  5. #
  6. #Purpose:
  7. #  Builds the Inproc OLE 2.0 Automation object, browseh.dll.
  8. #  By default a 32 bit ANSI DLL 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. # Change the following dev & HOST settings to compile hello for 16 bit, 
  35. # 32 bit Unicode on NT or 32 bit ANSI on NT & Win95
  36.  
  37. !if "$(dev)" == ""
  38. dev = win32 
  39. HOST = WIN95
  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. !if "$(HOST)" == ""
  49. HOST  = DOS
  50. !endif
  51. !endif
  52.  
  53. !if "$(dev)" == "win32"
  54. TARGET  = WIN32
  55. !if "$(HOST)" == ""
  56. HOST  = WIN95
  57. !endif
  58. !endif
  59.  
  60. !undef NODEBUG
  61.  
  62. !if "$(DEBUG)" == "0"
  63. NODEBUG = 1
  64. !endif
  65.  
  66.  
  67.  
  68. ##########################################################################
  69. #
  70. # WIN16 Settings
  71. #
  72. !if "$(TARGET)" == "WIN16"
  73.  
  74. CC   = cl
  75. LINK = link
  76. !if "$(HOST)" == "DOS"
  77. WX   = wx /w 
  78. !else
  79. WX   =
  80. !endif
  81.  
  82. TLIBCOMPILER = $(WX) mktyplib
  83.  
  84. RCFLAGS = -dWIN16
  85. CFLAGS = -c -W3 -AM -GD -DWIN16
  86. LINKFLAGS = /NOD /BATCH /ONERROR:NOEXE 
  87.  
  88. LIBS = libw.lib mdllcew.lib
  89.  
  90. !ifdef NODEBUG
  91. CFLAGS = $(CFLAGS) -Ox $(CL)
  92. LINKFLAGS = $(LINKFLAGS) /FAR /PACKC
  93. !else
  94. CFLAGS = $(CFLAGS) -Od -Zi -D_DEBUG $(CL)
  95. LINKFLAGS = $(LINKFLAGS) /COD
  96. !endif
  97. !endif
  98.  
  99.  
  100. ##########################################################################
  101. #
  102. # WIN32 Settings
  103. #
  104. !if "$(TARGET)" == "WIN32"
  105.  
  106.  
  107. WX = 
  108. TLIBCOMPILER = MIDL /mktyplib203 
  109.  
  110. !include <olesampl.mak>
  111.  
  112. CC = $(cc)
  113. CFLAGS = $(cflags) $(cvarsmt) -DINC_OLE2 $(cdebug)
  114.  
  115. !if "$(HOST)" == "NT"
  116. CFLAGS = $(CFLAGS) -DUNICODE
  117. !endif
  118.  
  119. !ifdef NODEBUG
  120. !else
  121. CFLAGS = $(CFLAGS) -D_DEBUG
  122. !endif
  123.  
  124. LINK = $(link)
  125. LINKFLAGS = $(linkdebug) $(guilflags) -dll -entry:_DllMainCRTStartup$(DLLENTRY)\
  126.  
  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.  
  150. APPS = browseh
  151.  
  152.  
  153. !if "$(TARGET)" == "WIN16"
  154. LIBS = $(LIBS) ole2.lib compobj.lib ole2disp.lib typelib.lib 
  155. !endif
  156. !if "$(TARGET)" == "WIN32"
  157. LIBS = $(ole2libsmt)
  158. !endif
  159.  
  160. OBJS = alias.obj main.obj mydisp.obj browseh.obj browsecf.obj collect.obj \
  161.        enumvar.obj typelib.obj typeinfo.obj intface.obj dispface.obj module.obj \
  162.        coclass.obj function.obj property.obj param.obj enum.obj constant.obj \
  163.        type.obj union.obj struct.obj   
  164.  
  165.  
  166.  
  167. ##########################################################################
  168. #
  169. # Default Goal
  170. #
  171.  
  172. goal : setflags $(APPS).dll
  173.  
  174. setflags :
  175.     set CL=$(CFLAGS)
  176.  
  177.  
  178. ##########################################################################
  179. #
  180. # Application Build (WIN16 Specific)
  181. #
  182.  
  183. !if "$(TARGET)" == "WIN16"
  184. $(APPS).dll : $(APPS).tlb $(OBJS) $(APPS).def $(APPS).res 
  185.     link @<< 
  186. $(LINKFLAGS)+ 
  187. $(OBJS),
  188. $@,,
  189. $(LIBS),
  190. $(APPS).def
  191. <<
  192.     rc -k -t $(APPS).res $@
  193. !endif
  194.  
  195.  
  196. ##########################################################################
  197. #
  198. # Application Build (WIN32 Specific)
  199. #
  200. !if "$(TARGET)" == "WIN32"
  201. $(APPS).dll : $(APPS).tlb $(OBJS) $(APPS).def $(APPS).res 
  202.       $(LINK) @<< 
  203.         $(LINKFLAGS)
  204.         -out:$@ 
  205.         -map:$*.map
  206.         $(OBJS)
  207.         $(APPS).res
  208.         $(LIBS)
  209. <<
  210. !endif
  211.  
  212.  
  213. ##########################################################################
  214. #
  215. # Application Build (Common)
  216. #
  217.  
  218. $(APPS).res : $(APPS).rc
  219.     rc $(RCFLAGS) -r -fo$@ $?
  220.  
  221.  
  222. ##########################################################################
  223. #
  224. # Dependencies
  225. #
  226.  
  227. mydisp.tlb :: mydisp.odl 
  228.      if exist mydisp.tlb  del mydisp.tlb 
  229.      $(TLIBCOMPILER) /D$(TARGET) /o mydisp.log /tlb mydisp.tlb mydisp.odl
  230.      type mydisp.log
  231.  
  232. browseh.tlb : browseh.odl mydisp.tlb
  233.      if exist tlb.h  del tlb.h
  234.      if exist browseh.tlb  del browseh.tlb
  235.      $(TLIBCOMPILER) /D$(TARGET) /h tlb.h /o browseh.log /tlb browseh.tlb browseh.odl
  236.      type browseh.log
  237.  
  238. main.obj : main.cpp browseh.h mydisp.h tlb.h
  239.      $(CC) main.cpp 
  240. mydisp.obj : mydisp.cpp browseh.h mydisp.h tlb.h
  241.      $(CC) mydisp.cpp     
  242. browseh.obj : browseh.cpp browseh.h mydisp.h tlb.h
  243.      $(CC) browseh.cpp
  244. browsecf.obj : browsecf.cpp browseh.h mydisp.h tlb.h
  245.      $(CC) browsecf.cpp
  246. typelib.obj : typelib.cpp browseh.h mydisp.h tlb.h
  247.      $(CC) typelib.cpp     
  248. typeinfo.obj : typeinfo.cpp browseh.h mydisp.h tlb.h
  249.      $(CC) typeinfo.cpp
  250. intface.obj : intface.cpp browseh.h mydisp.h tlb.h
  251.      $(CC) intface.cpp
  252. dispface.obj : dispface.cpp browseh.h mydisp.h tlb.h
  253.      $(CC) dispface.cpp   
  254. module.obj : module.cpp browseh.h mydisp.h tlb.h
  255.      $(CC) module.cpp
  256. coclass.obj : coclass.cpp browseh.h mydisp.h tlb.h
  257.      $(CC) coclass.cpp    
  258. function.obj : function.cpp browseh.h mydisp.h tlb.h
  259.      $(CC) function.cpp
  260. property.obj : property.cpp browseh.h mydisp.h tlb.h
  261.      $(CC) property.cpp
  262. param.obj : param.cpp browseh.h mydisp.h tlb.h
  263.      $(CC) param.cpp   
  264. collect.obj : collect.cpp browseh.h mydisp.h tlb.h
  265.      $(CC) collect.cpp
  266. enumvar.obj : enumvar.cpp browseh.h mydisp.h tlb.h
  267.      $(CC) enumvar.cpp     
  268. enum.obj : enum.cpp browseh.h mydisp.h tlb.h
  269.      $(CC) enum.cpp 
  270. constant.obj : constant.cpp browseh.h mydisp.h tlb.h
  271.      $(CC) constant.cpp   
  272. alias.obj : alias.cpp browseh.h mydisp.h tlb.h
  273.      $(CC) alias.cpp      
  274. struct.obj : struct.cpp browseh.h mydisp.h tlb.h
  275.      $(CC) struct.cpp 
  276. union.obj : union.cpp browseh.h mydisp.h tlb.h
  277.      $(CC) union.cpp
  278. type.obj : type.cpp browseh.h mydisp.h tlb.h
  279.      $(CC) type.cpp
  280.  
  281. ##########################################################################
  282. #
  283. # Clean (erase) generated files
  284. #
  285. clean :
  286.     if exist *.obj       del *.obj
  287.     if exist $(APPS).map del $(APPS).map
  288.     if exist $(APPS).res del $(APPS).res
  289.     if exist *.log       del *.log
  290.     if exist *.exp       del *.exp
  291.     if exist *.lib       del *.lib
  292.