home *** CD-ROM | disk | FTP | other *** search
/ PC Press 1997 July / Sezamfile97_2.iso / windows / program / activex / axtsamp.exe / TSBRANCH.EXE / MARSHAL / MAKEFILE next >
Text File  |  1996-12-29  |  9KB  |  257 lines

  1. #/*+=========================================================================
  2. #  File:       MAKEFILE
  3. #
  4. #  Summary:    Makefile for building the MARSHAL.DLL marshaling server
  5. #              that provides the necessary Proxys and Stubs for the
  6. #              ICar, IUtility, and ICruise interfaces that are to be
  7. #              used across process boundaries in the LOCSERVE and
  8. #              LOCCLIEN local server and client code samples.  The
  9. #              MIDL compiler is used for this.  MICARS.IDL is the
  10. #              primary source to this lesson.  It contains the the
  11. #              interface specifications in the MIDL language.  During
  12. #              the build, MIDL creates the following intermediate source
  13. #              files that are compiled to produce the final MARSHAL.DLL:
  14. #              MICARS.H, MICARS_I.C, MICARS_P.C, and DLLDATA.C.
  15. #
  16. #              This Makefile creates a subdirectory (TEMP) for the
  17. #              .OBJ and .RES files used during the build process.  It also
  18. #              automatically registers the newly built DLL server in the
  19. #              system Registry.  Since the build of this makefile does this
  20. #              registration you must build the REGISTER.EXE utility first
  21. #              (in sibling directory REGISTER).
  22. #
  23. #              For a comprehensive tutorial code tour of MARSHAL's
  24. #              contents and offerings see the tutorial MARSHAL.HTM
  25. #              file.  For more specific technical details see the comments
  26. #              dispersed throughout the MARSHAL source code.
  27. #
  28. #              See also LOCCLIEN.HTM (in the main tutorial directory)
  29. #              for more details on the LOCCLIEN app and how it works with
  30. #              MARSHAL.DLL itself.
  31. #
  32. #              In general, to set up your system to build and test the
  33. #              Win32 code samples in this ActiveX Tutorial series, see the
  34. #              global TUTORIAL.HTM file for details.  This MAKEFILE is
  35. #              Microsoft NMAKE compatible and the 'debug' build can be
  36. #              achieved by simply issuing the NMAKE command in a command
  37. #              prompt window.
  38. #
  39. #  Builds:     MARSHAL.DLL, MARSHAL.LIB, MICARS.H, MICARS_I.C, MICARS_P.C,
  40. #              DLLDATA.C.
  41. #
  42. #  Origin:     11-24-95: atrent - Editor-inheritance from DLLSERVE source.
  43. #
  44. #--Usage:-------------------------------------------------------------------
  45. #  NMAKE Options
  46. #
  47. #  Use the table below to determine the additional options for NMAKE to
  48. #  generate various application debugging, profiling and performance tuning
  49. #  information.
  50. #
  51. #  Application Information Type         Invoke NMAKE
  52. #  ----------------------------         ------------
  53. #  For No Debugging Info                nmake nodebug=1
  54. #  For Working Set Tuner Info           nmake tune=1
  55. #  For Call Attributed Profiling Info   nmake profile=1
  56. #
  57. #  Note: The three options above are mutually exclusive (you may use only
  58. #        one to compile/link the application).
  59. #
  60. #  Note: creating the environment variables NODEBUG, TUNE, and PROFILE
  61. #        is an alternate method to setting these options via the nmake
  62. #        command line.
  63. #
  64. #  Additional NMAKE Options             Invoke NMAKE
  65. #  ----------------------------         ------------
  66. #  For No ANSI NULL Compliance          nmake no_ansi=1
  67. #    (ANSI NULL is defined as PVOID 0)
  68. #  To compile for Unicode               nmake unicode=1
  69. #    (Default is ANSI)
  70. #  To clean up temporary binaries       nmake clean
  71. #  To clean up all generated files      nmake cleanall
  72. #  To register DLL                      nmake register
  73. #  To unregister DLL                    nmake unregister
  74. #
  75. #---------------------------------------------------------------------------
  76. #  This file is part of the Microsoft ActiveX Tutorial Code Samples.
  77. #
  78. #  Copyright (C) Microsoft Corporation, 1997.  All rights reserved.
  79. #
  80. #  This source code is intended only as a supplement to Microsoft
  81. #  Development Tools and/or on-line documentation.  See these other
  82. #  materials for detailed information regarding Microsoft code samples.
  83. #
  84. #  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  85. #  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  86. #  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  87. #  PARTICULAR PURPOSE.
  88. #=========================================================================+*/
  89.  
  90. #  WIN32.MAK should be included at the front of every Win32 makefile.
  91. #
  92. #  Define APPVER = [ 3.50 | 3.51 | 4.0 ] prior to including win32.mak to get
  93. #  build time checking for version dependencies and to mark the executable
  94. #  with version information.
  95. #
  96. #  Define TARGETOS = [ WIN95 | WINNT | BOTH ] prior to including win32.mak
  97. #  to get some build time checking for platform dependencies.
  98. #
  99. APPVER=4.0
  100. TARGETOS=BOTH
  101. !include <win32.mak>
  102.  
  103. # Assign the main program name macros.
  104. DLL = marshal
  105.  
  106. # Use a temporary sub-directory to store intermediate
  107. # binary files like *.obj, *.res, *.map, etc.
  108. TDIR = TEMP
  109.  
  110. # Assign destination and consumer sibling directories.
  111. IDIR = ..\inc
  112. LDIR = ..\lib
  113.  
  114. REGEXE = ..\register\register.exe
  115.  
  116. # The sibling ..\INC and ..\LIB directories are added to the front of
  117. # the INCLUDE and LIB macros to inform the compiler and linker of
  118. # these application-specific locations for include and lib files.
  119. INCLUDE=$(IDIR);$(INCLUDE)
  120. LIB=$(LDIR);$(LIB)
  121.  
  122. LINK = $(link)
  123.  
  124. # If UNICODE=1 is defined then define UNICODE during Compiles.
  125. # The default is to compile with ANSI for running under both
  126. # Win95 and WinNT.
  127. !IFDEF UNICODE
  128. LINKFLAGS = $(ldebug)
  129. CDBG=$(cdebug) -DUNICODE -D_UNICODE
  130. RCFLAGS = -DWIN32 -DRC_INCLUDE -DUNICODE
  131. !ELSE
  132. LINKFLAGS = $(ldebug)
  133. CDBG=$(cdebug)
  134. RCFLAGS = -DWIN32 -DRC_INCLUDE
  135. !ENDIF
  136.  
  137. # If NODEBUG is not defined then define DEBUG during Compiles.
  138. # The default is to compile with debug symbols in the binaries.
  139. !IFNDEF NODEBUG
  140. CDBG = $(CDBG) -DDEBUG
  141. RCFLAGS = $(RCFLAGS) -DDEBUG
  142. !ENDIF
  143.  
  144. # APPLIBS are libraries used by this application that are outside
  145. # of its indigenous file set and are needed during the final link.
  146. APPLIBS = apputil.lib urlmon.lib rpcrt4.lib
  147.  
  148. # DLLOBJS is a macro that defines the object files for the DLL.
  149. DLLOBJS = $(TDIR)\$(DLL).obj $(TDIR)\micars_p.obj $(TDIR)\micars_i.obj \
  150.   $(TDIR)\dlldata.obj
  151.  
  152. # The final target.
  153. all: input tempdir output
  154.  
  155. # Check if prior builds were done.
  156. input:
  157.   @IF NOT EXIST $(REGEXE) echo !!!!!! You must build REGISTER first !!!!!!
  158.  
  159. # Make the temporary work sub-directory.
  160. tempdir:
  161.   -mkdir $(TDIR)
  162.  
  163. # Generate the proxy/stub source from the .IDL file.
  164. micars.h micars_p.c micars_i.c dlldata.c: micars.idl
  165.   midl /ms_ext /app_config /c_ext micars.idl
  166.  
  167. # The actual output products.
  168. # Register the server after it's DLL is built.
  169. output: micars.h micars_p.c micars_i.c dlldata.c $(DLL).dll
  170.   if exist $(DLL).DLL if exist $(REGEXE) $(REGEXE) $(DLL).dll
  171.   if exist micars.h copy micars.h $(IDIR)
  172.  
  173. # Compilation/Dependency rules for the .DLL source files.
  174. #
  175. $(TDIR)\micars_i.obj: micars.h
  176.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ micars_i.c
  177.  
  178. $(TDIR)\micars_p.obj: micars.h
  179.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ micars_p.c
  180.  
  181. $(TDIR)\dlldata.obj: micars.h
  182.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ dlldata.c
  183.  
  184. $(TDIR)\$(DLL).obj: $(DLL).cpp
  185.   $(cc) $(cvarsdll) $(cflags) $(CDBG) -Fo$@ $(DLL).cpp
  186.  
  187. # Compile the DLL resources.
  188. $(TDIR)\$(DLL).res: $(DLL).rc $(DLL).ico
  189.   rc $(RCFLAGS) -r -fo$@ $(DLL).rc
  190.  
  191. # Link the object and resource binaries into the target DLL binary.
  192. # Build the import LIB file so apps can link to and use this DLL.
  193. $(DLL).dll: $(DLLOBJS) $(TDIR)\$(DLL).res
  194.     $(LINK)  @<<
  195.     $(LINKFLAGS) $(dlllflags)
  196.     -export:DllGetClassObject
  197.     -export:DllCanUnloadNow
  198.     -export:GetProxyDllInfo
  199.     -export:DllRegisterServer
  200.     -export:DllUnregisterServer
  201.     -out:$@
  202.     -base:0x1C000000
  203.     -implib:$*.lib
  204.     -map:$(TDIR)\$*.map
  205.     $(DLLOBJS)
  206.     $(TDIR)\$*.res
  207.     $(olelibsdll) $(APPLIBS)
  208. <<
  209.  
  210.  
  211. # Target to register the server
  212. register:
  213.   if exist $(DLL).DLL if exist $(REGEXE) $(REGEXE) $(DLL).dll
  214.  
  215. # Target to unregister the server
  216. unregister:
  217.   if exist $(DLL).DLL if exist $(REGEXE) $(REGEXE) /u $(DLL).dll
  218.  
  219. # Target to clean up binaries.
  220. clean:
  221.   -del $(DLL).exp
  222.   -del $(DLL).lib
  223.   -deltree /y $(TDIR)
  224.   -rmdir /s /q $(TDIR)
  225.  
  226. # Target to clean up all generated files.
  227. cleanall:
  228.   if exist $(DLL).DLL if exist $(REGEXE) $(REGEXE) /u $(DLL).dll
  229.   -del *.exe
  230.   -del *.dll
  231.   -del *.lib
  232.   -del *.exp
  233.   -del *.obj
  234.   -del *.res
  235.   -del *.map
  236.   -del *.pdb
  237.   -del *.vcp
  238.   -del *.aps
  239.   -del *.pch
  240.   -del *.sbr
  241.   -del *.bsc
  242.   -del *.mdp
  243.   -del *.ncb
  244.   -del *.mak
  245.   -del micars.h
  246.   -del micars_i.c
  247.   -del micars_p.c
  248.   -del dlldata.c
  249.   -del makefile.exe
  250.   -del resource.h
  251.   -deltree /y windebug
  252.   -rmdir /s /q windebug
  253.   -deltree /y winrel
  254.   -rmdir /s /q winrel
  255.   -deltree /y $(TDIR)
  256.   -rmdir /s /q $(TDIR)
  257.