home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / inole-a.mak < prev    next >
Text File  |  1997-12-22  |  6KB  |  277 lines

  1. #
  2. # INOLE-A.MAK
  3. # Common Compiler Flags and Definitions
  4. #
  5. # Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  6. #
  7. # Kraig Brockschmidt, Microsoft
  8. # Internet  :  kraigb@microsoft.com
  9. # Compuserve:  >INTERNET:kraigb@microsoft.com
  10. #
  11.  
  12. #
  13. # This makefile (and inole-b.mak) builds Win16/Win32, Unicode/ANSI,
  14. # MDI/SDI, and DEBUG/NODEBUG versions.  The default build is Win32,
  15. # Unicode, MDI, DEBUG.
  16. #
  17. # To build different versions set the appropriate environment
  18. # variable below with "SET <variable>=1:
  19. #
  20. #   Variable    Effect
  21. #   -------------------------------
  22. #   UNICODE     Build Unicode version
  23. #   CLEAN       Cleans up compiled files, overriding all other functions
  24. #   NODEBUG     Build non-debug version
  25. #   SDI         Build SDI version
  26. #   WIN16       Build 16-bit version
  27. #
  28. # In addition, other makefiles control other compilation
  29. # aspects with these variables:
  30. #
  31. #   Variable    Effect
  32. #   -------------------------------------------
  33. #   TARGET      The main filename (no extension) of the project
  34. #   DLL         Switches compiler/linker flags for a DLL.
  35. #   OUTFILE     The final output filename
  36. #   PCHINC      Alternate header to precompile (default is $(TARGET).H
  37. #   TLBHEAD     Name of a type library output header file with /h
  38. #   NODOC       Disables SDI/MDI differences
  39. #   NOPRECOMP   Suppresses creation of precompiled header
  40. #   NOUILIB     Prevents inclusion of UI library during linking
  41. #   NOCLASSLIB  Prevents inclusion of class libraries during linking
  42. #   NOBOOKLIB   Prevents includion of INOLE.LIB
  43. #   NOOCLIB     Prevents includion of OLE Controls run-time
  44. #
  45.  
  46.  
  47.  
  48. !ifdef WIN16
  49. DEFUNICODE =
  50. TLBDEFU    =
  51. !else
  52. !ifdef UNICODE
  53. DEFUNICODE = -DUNICODE -D_UNICODE
  54. TLBDEFU    = -DUNICODE
  55. #Comment the next line and remove the comment from the next one
  56. #for compiling on Windows NT 3.5.
  57. UILIB32    = oledlg.lib
  58. #UILIB32    = mfcuiw32.lib
  59. !else
  60. DEFUNICODE = -DWIN32ANSI
  61. TLBDEFU    =
  62. #Comment the next line and remove the comment from the next one
  63. #for compiling on Windows NT 3.5.
  64. UILIB32    = oledlg.lib
  65. #UILIB32    = mfcuia32.lib
  66. !endif
  67. !endif
  68.  
  69. !ifdef NOBOOKLIB
  70. BOOKLIB =
  71. !else
  72. BOOKLIB =  ..\..\lib\inole.lib 
  73. !endif #NOBOOKLIB
  74.  
  75.  
  76. !ifndef WIN16
  77.  
  78. CL32    = -G3s
  79. WX      =
  80.  
  81. !ifdef DLL
  82. LINKDLL = /DLL
  83. DEFDLL  = -D_DLL
  84. ENTRY   = -entry:LibMain32
  85. !else
  86. LINKDLL =
  87. DEFDLL  =
  88. ENTRY   = ""
  89. !endif  #DLL
  90.  
  91. !ifdef NOUILIB
  92. UILIB   =
  93. !else
  94. #MFCUI*32.LIB both map to OLEDLG.DLL when available
  95. UILIB   = $(UILIB32)
  96. !endif #NOUILIB
  97.  
  98. !ifdef NOOCLIB
  99. OCLIB   =
  100. !else
  101. !ifdef UNICODE
  102. OCLIB   = OLEPRO32.LIB
  103. !else
  104. OCLIB   = OLEPRO32.LIB
  105. !endif
  106.  
  107. !endif #NOOCLIB
  108.  
  109.  
  110. LINKD32 = -debug:full $(LINKDLL) -debugtype:cv
  111. LINKN32 = -debug:none $(LINKDLL)
  112. DEFS32  = -DWIN32 $(DEFDLL) -D_X86_=1 $(DEFUNICODE)
  113. TLBDEFS = -DWIN32
  114. LIBS32A = msvcrt.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib
  115. LIBS32B = ole32.lib oleaut32.lib uuid.lib $(UILIB) $(OCLIB)
  116. LIBS32  = $(LIBS32A) $(LIBS32B) $(BOOKLIB)
  117.  
  118. !else  #!WIN32
  119.  
  120. WX      = wx /w
  121.  
  122. !ifdef DLL
  123. CL32    = -G2s -AL -GD /I$(MSTOOLS)\SAMPLES\OLE\INOLE2\INC /I ..\..\INC /I ..\INC
  124. !else
  125. CL32    = -G2s -AL -Gx -GA /I$(MSTOOLS)\SAMPLES\OLE\INOLE2\INC /I ..\..\INC /I ..\INC
  126. !endif #DLL
  127.  
  128. LINKD32 = /al:16/ONERROR:NOEXE/CO
  129. LINKN32 = /al:16/ONERROR:NOEXE
  130. DEFS32  = -DWIN16
  131. TLBDEFS = -DWIN16
  132.  
  133. !ifdef NOUILIB
  134. UILIB   =
  135. !else
  136. UILIB   = mfcoleui
  137. !endif #NOUILIB
  138.  
  139. !ifdef NOOCLIB
  140. OCLIB   =
  141. !else
  142. OCLIB   = OC25.LIB
  143. !endif #NOOCLIB
  144.  
  145.  
  146. !ifdef DLL
  147. CRTLIB  = ldllcew
  148. !else
  149. CRTLIB  = llibcew
  150. !endif #DLL
  151.  
  152. LIBS32A = libw $(CRTLIB) oldnames commdlg shell $(BOOKLIB)
  153. LIBS32B = compobj storage ole2 ole2disp ole2nls typelib $(UILIB)
  154. LIBS32  = $(LIBS32A) $(LIBS32B)
  155.  
  156. !endif #!WIN32
  157.  
  158. TLBFLAGS = /cpp_opt "/C /E /D__MKTYPLIB__ $(TLBDEFU) $(TLBDEFS)"
  159.  
  160.  
  161.  
  162. !ifdef NODOC
  163. DOC     =
  164. CLASSLIB= ..\..\lib\classMDI.lib 
  165. !else
  166. !ifdef SDI
  167. DOC     = -DSDI
  168. CLASSLIB= classSDI.lib
  169. !else
  170. DOC     = -DMDI
  171. CLASSLIB= ..\..\lib\classMDI.lib
  172. !endif #SDI
  173. !endif #NODOC
  174.  
  175. #
  176. # Set up precompiled header flags.  By default we'll look for
  177. # $(TARGET).H but a specific makefile can override by defining
  178. # the symbol PCHINC
  179. #
  180.  
  181. !ifdef NOPRECOMP
  182. PCHFILE =
  183. PCHFLAGS=
  184. !else
  185.  
  186. !ifndef PCHINC
  187. PCHINC  = $(TARGET).h
  188. !endif #PCHINC
  189.  
  190. PCHFILE = precomp.pch
  191. PCHFLAGS= -Yu$(PCHINC) -Fpprecomp.pch
  192. !endif #NOPRECOMP
  193.  
  194.  
  195. #
  196. #Compiler flags
  197. #Use "SET NODEBUG=1" from command prompt to compile non-debug version.
  198. #
  199.  
  200. !ifndef NODEBUG
  201. CFLAGS  = -c -Od -Z7 -Ze -W3 -nologo $(CL32)
  202. LINK    = $(LINKD32) /NOD
  203. DEFS    = $(DEFS32) -DSTRICT -DDEBUG
  204. !else
  205. CFLAGS  = -c -Oat -Ze -W3 -nologo $(CL32)
  206. LINK    = $(LINKN32) /NOD
  207. DEFS    = $(DEFS32) -DSTRICT
  208. !endif #NODEBUG
  209. CFLAGS = $(CFLAGS) /I $(MSTOOLS)\samples\ole\inole2\inc /I ..\..\INC /I ..\INC
  210.  
  211. !ifdef NOCLASSLIB
  212. LIBS    = $(LIBS32A) $(OCLIB)
  213. CONTIN  =
  214. !else
  215. LIBS    = $(CLASSLIB) $(OCLIB)
  216. CONTIN  = +
  217. !endif #NOCLASSLIB
  218.  
  219.  
  220. .SUFFIXES: .h .obj .exe .dll .cpp .res .rc .tlb .odl
  221.  
  222. !ifdef CLEAN
  223. goal:   clean
  224. !else
  225. goal:   $(PCHFILE) $(OUTFILE)
  226. !endif #CLEAN
  227.  
  228. clean:
  229.     if exist *.pch del *.pch
  230.     if exist *.obj del *.obj
  231.     if exist *.res del *.res
  232.     if exist *.exe del *.exe
  233.     if exist *.dll del *.dll
  234.     if exist *.pdb del *.pdb
  235.     if exist *.exp del *.exp
  236.     if exist *.lib del *.lib
  237.     if exist *.ilk del *.ilk
  238.     if exist *.map del *.map
  239.     if exist *.vcp del *.vcp
  240.     if exist *.tlb del *.tlb
  241.     if exist *.log del *.log
  242.     if exist *.lrf del *.lrf
  243.  
  244. Enforce32Bits:
  245.     echo This sample can only be compiled for 32-bit platforms
  246.  
  247.  
  248. #####
  249.  
  250. .c.obj:
  251.     echo ++++++++++
  252.     echo Compiling $*.c
  253.     cl $(CFLAGS) $(PCHFLAGS) $(DEFS) $(DOC) $*.c
  254.  
  255.  
  256. .cpp.obj:
  257.     echo ++++++++++
  258.     echo Compiling $*.cpp
  259.     cl $(CFLAGS) $(PCHFLAGS) $(DEFS) $(DOC) $*.cpp
  260.  
  261.  
  262. .rc.res:
  263.     echo ++++++++++
  264.     echo Compiling Resources
  265.     rc -r $(DEFS) $(DOC) -fo$@ /I $(MSTOOLS)\SAMPLES\OLE\INOLE2\INC  /I ..\..\INC  /I ..\INC $*.rc
  266.  
  267. .odl.tlb:
  268.     echo ++++++++++
  269.     echo Compiling $*.odl
  270.     $(WX) mktyplib /nologo $(TLBFLAGS) $(TLBHEAD) /o $*.log $*.odl
  271.  
  272.  
  273. precomp.pch : $(INCLS)
  274.     echo ++++++++++
  275.     echo Precompiling $(PCHINC)
  276.     cl $(CFLAGS) $(DEFS) $(DOC) -Yc$(PCHINC) -Fpprecomp.pch -Foprecomp precomp.cpp
  277.