home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / Platform.mak < prev    next >
Text File  |  1997-04-02  |  28KB  |  811 lines

  1. #====START_GENERATED_PROLOG======================================
  2. #
  3. #
  4. #   COMPONENT_NAME: odsamples
  5. #
  6. #   CLASSES: none
  7. #
  8. #   ORIGINS: 27
  9. #
  10. #
  11. #   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  12. #   All Rights Reserved
  13. #   Licensed Materials - Property of IBM
  14. #   US Government Users Restricted Rights - Use, duplication or
  15. #   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16. #
  17. #   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. #   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. #   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20. #   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  21. #   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  22. #   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  23. #   OR PERFORMANCE OF THIS SOFTWARE.
  24. #
  25. #====END_GENERATED_PROLOG========================================
  26. #
  27. # @(#) 1.48 os2/src/samples/Platform.mak, odsamples, od96os2, odos29712d 3/10/97 14:11:10 [ 3/21/97 17:39:48 ]
  28. #
  29. #--------------------------------------------------------------------------
  30. # characters that can precede a make line:
  31. #    @  suppresses display of the command
  32. #    -  turns off error checking for the command
  33. #    !  executes the command for each dependent file
  34. #
  35. # make macros:
  36. #    $@   the target file    (d:/src/main.cpp)
  37. #    $*   base name             (d:/src/main)
  38. #    $**  dependent files (sources)
  39. #    $?   sources newer than target
  40. #    $<   single source newer than target
  41. #    $$@  current NMAKE target
  42. #    
  43. # macro modifiers - you can modify all of the make macros above this way
  44. #    $(@D) - directory only     (d:/src)
  45. #    $(@F) - file only          (main.cpp)
  46. #    $(@B) - base filename only (main)
  47. #    $(@R) - path, no extension (d:/src/main)
  48. #    $(SOMETHING:a=b) - substitutes changes a's in $(SOMETHING) to b's
  49. #
  50. # shell programming:
  51. #    echo.    - echoes a blank line
  52. #    setlocal - allows you to change env variables during execution of a
  53. #               batch file 
  54. #    endlocal - restores the env variables to their original values
  55. #    for %%variable (or %variable) in (some set) do command:
  56. #    Each %%variable (or %variable) is replaced with each string in (some 
  57. #       set) until the command processes all files.  %% is used within a 
  58. #       batch pgm.
  59. #
  60. #    
  61. #--------------------------------------------------------------------------
  62. #
  63. # Note: This is the platform specific header for the OpenDoc nmake files
  64. #       on OS/2 using the VisualAge compiler
  65.  
  66.  
  67. # Important Note: The compile and link flags in this nmake file are the
  68. #                 basic core set of flags.  If you want to build optimized
  69. #                 code or debug code you will need to set the compiler
  70. #                 specific environment variables.  Here are our suggestions:
  71. #
  72. #                  Optimized build
  73. #                   set ICC = -O+ -Om-
  74. #                   set ILINK = -NOBROWSE
  75. #
  76. #                  Debug build
  77. #                   set ICC = -Ti+ -DDEBUG
  78. #                   set ILINK = -DEBUG
  79.  
  80.  
  81. # Important Note: The nmake logic has the additional capability
  82. #                 of letting you optionally link in your own runtime library.
  83. #                 The default is to dynamically link in the compiler's runtime.
  84. #                 To link in your own runtime, call nmake with the
  85. #                 LocalRuntimeLibrary macro set to your runtime library.
  86. #                 This macro triggers the logic that adjusts the compile and
  87. #                 link flags to use your runtime library.
  88. #            %ODSRC%\src\runtime gives an example of building a local
  89. #          runtime library based off the description in "Creating
  90. #          Your Own Runtime Library DLLs" in the VisualAge C++
  91. #          Programming Guide. After creating iodrt.dll in
  92. #          %ODSRC%\src\runtime, you could build the IBM Samples, having
  93. #          them linked to the local runtime, by issuing the following
  94. #          nmake command:
  95. #             nmake "LocalRuntimeLibrary=%ODSRC%\lib\iodrt.lib %ODSRC%\lib\os2\os2386.lib %CPPMAIN%\lib\CPPOOC3.lib"
  96. #
  97.  
  98.  
  99. #..............................................................................
  100. #            Macros used to re-set environment variables
  101. #..............................................................................
  102.  
  103. # There is a known problem with nmake, where it has problems parsing
  104. # the SET statment when you are setting an environment variable to null.
  105. # So we currently can not set an environment variable equal to null in an
  106. # nmake file.
  107.  
  108. # Whenever the som compiler is used, This becomes the new setting of
  109. # SMINCLUDE.
  110. NmakeSMINCLUDE=.
  111.  
  112.  
  113. # Whenever ilink is used to build a dll, These become the new settings of
  114. # PATH, LIB, and BeginLIBPATH.
  115. NmakePATH = $(CPPMAIN)\BIN;$(CPPMAIN)\SMARTS\SCRIPTS;$(PATH)
  116.  
  117. NmakeLIBPATH=$(ODSRCPATHS:;=\dll;)$(ODPARTPATHS:;=\dll;)$(ODBASEPATHS:;=\dll;)$(SOMBASE)\LIB;$(CPPMAIN)\DLL;$(CPPMAIN)\SAMPLES\TOOLKIT\DLL;
  118.  
  119. NmakeLIB=$(ODSRCPATHS:;=\lib;)$(ODPARTPATHS:;=\lib;)$(ODBASEPATHS:;=\lib;)$(ODSRC)\LIB\OS2;$(ODCFG)\LIB\OS2;$(SOMBASE)\LIB;$(CPPMAIN)\LIB;$(CPPMAIN)\DLL;$(CPPMAIN)\sdk\lib;
  120.  
  121.  
  122. # Whenever we call the resource compiler, This becomes the new setting of
  123. # INCLUDE.
  124. NmakeINCLUDE=.
  125.  
  126. # Whenever a package is built, this is used as the locale
  127. !IF "$(LOCALE)"=="" || "$(LOCALE)"=="C"
  128. NmakeLOCALE=en_US
  129. !ELSE
  130. NmakeLOCALE=$(LOCALE)
  131. !ENDIF
  132.  
  133.  
  134. #..............................................................................
  135. # set the LIB path for building the OpenDoc samples
  136. #..............................................................................
  137. LIB=$(NmakeLIB)
  138. BeginLIBPATH=$(NmakeLIBPATH)
  139.  
  140. #..............................................................................
  141. #            General use Macros
  142. #..............................................................................
  143.  
  144. IncludeDir     = $(ODSRC)\INCLUDE
  145.  
  146. # These are the list of Locales we know are valid
  147. LocaleList = de_DE es_ES en_US fr_FR ja_JP pt_BR zh_CN zh_TW
  148.  
  149.  
  150. SOMDefines     = -D_PLATFORM_OS2_
  151.  
  152. SOMArgs        = -p -c -mchkexcept
  153.  
  154. # Includes are set with -I flags to allow for multiple, different, compilers
  155. # to be installed on your machine.
  156. SOMIncludes    = -I. -I$(ODSRCPATHS:;=\include -I)$(ODPARTPATHS:;=\include -I)$(ODBASEPATHS:;=\include -I)$(SOMBASE)\INCLUDE
  157.  
  158. SOMOptions     = $(SOMArgs) $(SOMDefines) $(SOMIncludes)
  159.  
  160. SOPTS = $(SOMOptions) $(ExtraSOMCompileOptions)
  161.  
  162.  
  163. CompileDefines = -D_PLATFORM_OS2_ -DODDebug=0 -D_NATIVE_EXCEPTIONS_
  164.  
  165. # If nmake was called with a LocalRuntimeLibrary macro set to a local runtime
  166. # library, don't link dynamically to the compiler runtime
  167. ! IF "$(LocalRuntimeLibrary)" != ""
  168. CompileArgs    = -C+ -Gd+ -Gm+ -Gs- -Q+ -Ss+ -Su4 -Ge- -Gn+ $(ICC)
  169. ! ELSE
  170. CompileArgs    = -C+ -Gd+ -Gm+ -Gs- -Q+ -Ss+ -Su4 -Ge- $(ICC)
  171. ! ENDIF
  172.  
  173. # Includes are set with -I flags to allow for multiple, different, compilers
  174. # to be installed on your machine.
  175. CompileIncludes=.;$(ODSRCPATHS:;=\include;)$(ODPARTPATHS:;=\include;)$(ODBASEPATHS:;=\include;)$(SOMBASE)\INCLUDE;$(IncludeDir)\OS2;$(CPPMAIN)\include;$(CPPMAIN)\include\os2;$(CPPMAIN)\inc
  176.  
  177. CompileOptions = $(CompileArgs) $(CompileDefines) 
  178.  
  179. COPTS = $(CompileOptions) $(ExtraCompileOptions)
  180.  
  181. COMPILE = icc
  182.  
  183. ResourceCompiler = $(CPPMAIN)\bin\rc.exe
  184.  
  185.  
  186. # If nmake was called with a LocalRuntimeLibrary macro set to a local runtime
  187. # library, disregard the default libraries
  188. ! IF "$(LocalRuntimeLibrary)" != ""
  189. LinkOptions = /NOE /st:100000 /NOLogo /Se:512 /NOD $(ILINK)
  190. ! ELSE
  191. LinkOptions = /NOE /st:100000 /NOLogo /Se:512 $(ILINK)
  192. ! ENDIF
  193.  
  194. LOPTS = $(LinkOptions) $(ExtraLinkOptions)
  195.  
  196. REMOVE = erase /f
  197.  
  198. COPY = copy
  199.  
  200. # We use the Info-ZIP 32-bit compression code when we create packages.
  201. # It's freely available from CompuServe in the IBMPRO forum and by
  202. # anonymous ftp from the Internet site ftp.uu.net:/pub/archiving/zip/OS2.
  203. # If you decide to use it, this build logic will work after you
  204. # set the NmakeZIP2EXE environment variable to the full path location
  205. # of unzipsfx.exe.
  206. #   If you decide to use any other 32-bit compression code, you will have
  207. # adjust the ZIP and ZIP2EXE macros, and the logic that uses them, accordingly.
  208. #
  209. ZIP = zip -j
  210. ZIP2EXE = copy /b $(NMAKEZIP2EXE)+$(RegMain:.dll=.zip) $(RegMain:.dll=.exe)
  211.  
  212.  
  213. Platform = os2
  214.  
  215. MAKE = nmake
  216.  
  217. # These suffixes are to help promote portable nmake files between platforms.
  218. # When the suffixes change on different platforms, these suffixes are the
  219. # only things that need to change.  All the sample nmake files that use these
  220. # suffix macros, so they are portable between different platforms.
  221. Exp = def
  222. Def = def
  223. Obj = obj
  224. LibSuffix = lib
  225. Locale = locale
  226.  
  227.  
  228. #..............................................................................
  229. #            Default Targets
  230. #..............................................................................
  231. DefaultTarget : Idls Hdrs Libs Dlls
  232.  
  233.  
  234. # Rule to copy the idls to samples
  235. Idls : CheckEnvironmentVariables Idl
  236. !   IF "$(Subdirs)"!=""
  237.         @-FOR %%f IN ($(Subdirs)) DO \
  238.         @$(ODSRC)\bin\NMakSubd %%f Idls $(MAKEFLAGS)
  239. !   ENDIF
  240.  
  241. Idl  : $(IdlTargets)
  242. !   IF "$(IdlTargets)"!=""
  243.     !$(COPY) $** $(IncludeDir)
  244. !   ENDIF
  245.  
  246.  
  247. # Rules to process the headers
  248. Hdrs : CheckEnvironmentVariables Hdr
  249. !   IF "$(Subdirs)"!=""
  250.         @-FOR %%f IN ($(Subdirs)) DO \
  251.         @$(ODSRC)\bin\NMakSubd %%f Hdrs $(MAKEFLAGS)
  252. !   ENDIF
  253.  
  254. Hdr  :: $(MsgTargets)
  255.  
  256. Hdr  :: $(HdrTargets)
  257. !       IF "$(HdrTargets)"!=""
  258.            @FOR %%f IN ($(HdrTargets)) DO $(COPY) %%f $(IncludeDir)
  259. !       ENDIF
  260.  
  261. Hdr  :: $(RcTargets)
  262. !       IF "$(RcTargets)"!=""
  263. #
  264. #        If the version of the resourse compiler that comes with the
  265. #        VisualAge compiler exist, then use it.  Otherwise, use whatever
  266. #        resourse compiler exists in the path
  267. #
  268.         @setlocal
  269.         set INCLUDE=$(CompileIncludes)
  270.         @set PATH=$(CPPMAIN)\bin;$(PATH)
  271.         @IF EXIST $(ResourceCompiler) \
  272.           FOR %%f IN ($(RcTargets)) DO \
  273.          $(ResourceCompiler) -r $(CompileDefines) %%f
  274.         @IF NOT EXIST $(ResourceCompiler) \
  275.           FOR %%f IN ($(RcTargets)) DO \
  276.          rc -r $(CompileDefines) $(CompileIncludes) %%f
  277.         @endlocal
  278. !       ENDIF
  279.  
  280. Hdr  :: CheckForSMNOTC $(IdlTargets:.idl=.xh)
  281.  
  282.  
  283. # Rule to make the libraries
  284. Libs : CheckEnvironmentVariables Lib
  285. !   IF "$(Subdirs)"!=""
  286.         @-FOR %%f IN ($(Subdirs)) DO \
  287.         @$(ODSRC)\bin\NMakSubd %%f Libs $(MAKEFLAGS)
  288. !   ENDIF
  289.  
  290. Lib  : $(LibTargets)
  291.  
  292.  
  293. # Rule to make the dlls
  294. Dlls : CheckEnvironmentVariables Dll
  295. !   IF "$(Subdirs)"!=""
  296.         @-FOR %%f IN ($(Subdirs)) DO \
  297.         @$(ODSRC)\bin\NMakSubd %%f Dlls $(MAKEFLAGS)
  298. !   ENDIF
  299.  
  300. Dll  :: $(DllTargets)
  301.  
  302. Dll  :: $(ODCFG)\od.ir
  303.  
  304.  
  305. #..............................................................................
  306. #            Default build rules and macros
  307. #..............................................................................
  308. .SUFFIXES: .cpp .CPP .c .C .idl .IDL .msg .MSG .ipf .IPF
  309.  
  310. .cpp.obj:
  311.     @echo.
  312.     @setlocal
  313.     set INCLUDE=$(CompileIncludes)
  314.     $(COMPILE) $(COPTS) -Ge- -Fo $@ $< || (( $(REMOVE) $@) && (exit 1))
  315.     @endlocal
  316.  
  317. .c.obj:
  318.     @echo.
  319.     @setlocal
  320.     set INCLUDE=$(CompileIncludes)
  321.     $(COMPILE) $(COPTS) -Ge- -Fo $@ $< || (( $(REMOVE) $@) && (exit 1))
  322.     @endlocal
  323.  
  324. .idl.xh:
  325.     @echo.
  326.         @setlocal
  327.     set SMINCLUDE=$(NmakeSMINCLUDE)
  328.     $(SOMBASE)\bin\sc -sxh -d$(IncludeDir) $(SOPTS) $**
  329. !    IF "$(SMINCLUDE)"!=""
  330.         @set SMINCLUDE=$(SMINCLUDE)
  331. !    ENDIF
  332.         @endlocal
  333.  
  334. .idl.xih:
  335.     @echo.
  336.         @setlocal
  337.         set SMINCLUDE=$(NmakeSMINCLUDE)
  338.     $(SOMBASE)\bin\sc -sxih $(SOPTS) $**
  339. !    IF "$(SMINCLUDE)"!=""
  340.         @set SMINCLUDE=$(SMINCLUDE)
  341. !    ENDIF
  342.         @endlocal
  343.  
  344. .msg.cat:
  345.     @echo.
  346.         runcat $(**R)
  347.  
  348. .ipf.hlp:
  349.     @echo.
  350.     ipfc $** $@
  351.  
  352.  
  353. # Rule to re-register the idl when it has been modified
  354. #
  355. $(ODCFG)\od.ir : $(RegIDL)
  356. !       IF "$(RegIDL)"!=""
  357. !             IF "$(RegClassName)"!=""
  358.              @echo.
  359.              @setlocal
  360.          set BeginLIBPATH=$(NmakeLIBPATH)
  361.                  reg1part $(RegClassName) $(RegIDL:.idl=)
  362.                 @endlocal
  363. !          ELSE
  364.              @echo.
  365.              @echo ERROR: A ClassName has to be identified for the RegIDL.
  366.              @echo     Set the RegClassName macro.
  367.              @echo.
  368. !             ENDIF
  369. !       ENDIF
  370.  
  371.  
  372. # Rules to check the environment variables
  373. #
  374. CheckEnvironmentVariables: CheckForCPPMAIN CheckForODSRC CheckForSMNOTC
  375.  
  376. CheckForCPPMAIN:
  377. !    IFNDEF CPPMAIN
  378.         @echo .........................................
  379.         @echo The OpenDoc nmake files are written to be used with
  380.         @echo the IBM VisualAge compiler.  Since the environment
  381.         @echo variable CPPMAIN is not defined, it appears the
  382.         @echo compiler has not been installed.
  383.         @echo Building the samples can not continue.
  384.         @echo .........................................
  385.         exit 1
  386. !    ENDIF
  387.  
  388. CheckForODSRC:
  389. !    IFNDEF ODSRC
  390.         @echo .........................................
  391.         @echo ODSRC, one of the OpenDoc environment variables, is
  392.         @echo not defined, it appears OpenDoc has not been 
  393.         @echo correctly installed.
  394.         @echo Building the samples can not continue.
  395.         @echo .........................................
  396.         exit 1
  397. !    ENDIF
  398.  
  399. CheckForSMNOTC:
  400. !    IFDEF SMNOTC
  401.         @echo .........................................
  402.         @echo SMNOTC, the environment variable that tells
  403.         @echo the SOM compiler not to generate TypeCode information,
  404.         @echo is currently set on your machine.  
  405.         @echo The OpenDoc samples can not build with this
  406.         @echo environment variable set.  
  407.         @echo Please remove this environment variable.
  408.         @echo Building the samples can not continue.
  409.         @echo .........................................
  410.         exit 1
  411. !    ENDIF
  412.  
  413. CheckForLOCALE:
  414. !    IF "$(LOCALE)"=="" || "$(LOCALE)"=="C"
  415.         @echo .........................................
  416. !        IF "$(LOCALE)"==""
  417.            @echo  The LOCALE environment variable is currently not set.
  418. !        ELSE
  419.            @echo  The LOCALE environment variable is currently set to "C".
  420. !        ENDIF
  421.         @echo  Because of this, the locale of the package will default to
  422.         @echo  en_US.  If you wish to use a differnet locale, you must set
  423.         @echo  the LOCALE environment variable to that locale.
  424.         @echo .........................................
  425.             @echo.
  426. !    ENDIF
  427.  
  428. CheckForNmakeZIP2EXE:
  429. !    IFNDEF NMAKEZIP2EXE
  430.         @echo .........................................
  431.         @echo NmakeZIP2EXE, the environment variable for
  432.         @echo specifying the 32-bit compression code used
  433.         @echo to make packages, is not defined.  This
  434.         @echo environment variable is necessary to build packages.
  435.         @echo   You will need to install some version of
  436.         @echo 32-bit compression code.  We recommend the
  437.         @echo Info-ZIP 32-bit compression code.  It's freely
  438.         @echo available from CompuServe in the IBMPRO forum
  439.         @echo and by anonymous ftp from the Internet site
  440.         @echo ftp.uu.net:/pub/archiving/zip/OS2.
  441.         @echo   After it is installed, set the NmakeZIP2EXE
  442.         @echo to the full path name of unzipsfx.exe.
  443.         @echo   If you use any other 32-bit compression code,
  444.         @echo you will have to edit Platform.mak accordingly.
  445.         @echo   Building the packages can not continue.
  446.         @echo .........................................
  447.         exit 1
  448. !    ENDIF
  449.  
  450.  
  451.  
  452. # ForceRegistrys and ForceRegistry are rules to force the registration
  453. # of a part.  This rule is *not* part of the default target, so it doesn't
  454. # happen automatically.  You have to run this as a separate build step.
  455. #
  456. ForceRegistrys : CheckEnvironmentVariables ForceRegistry
  457. !   IF "$(Subdirs)"!=""
  458.         @-FOR %%f IN ($(Subdirs)) DO \
  459.         @$(ODSRC)\bin\NMakSubd %%f ForceRegistrys $(MAKEFLAGS)
  460. !   ENDIF
  461.  
  462. ForceRegistry : $(RegIDL)
  463. !       IF "$(RegIDL)"!=""
  464. !             IF "$(RegClassName)"!=""
  465.              @echo.
  466.              @setlocal
  467.          set BeginLIBPATH=$(NmakeLIBPATH)
  468.                  reg1part $(RegClassName) $(RegIDL:.idl=)
  469.                 @endlocal
  470. !          ELSE
  471.              @echo.
  472.              @echo ERROR: A ClassName has to be identified for the RegIDL.
  473.              @echo     Set the RegClassName macro.
  474.              @echo.
  475. !             ENDIF
  476. !       ENDIF
  477.  
  478.  
  479. # Pkgs, Pkg, $(ODSRC)\pkg\$(NmakeLOCALE)\$(RegMain:.dll=.odz), and
  480. # $(RegMain:.dll=.odt) are rules to make a part to be installed.
  481. # These rules are *not* part of the default target, so it doesn't happen
  482. # automatically.  You have to run this as a separate build step.
  483. #
  484. Pkgs : CheckEnvironmentVariables Pkg
  485. !   IF "$(Subdirs)"!=""
  486.         @-FOR %%f IN ($(Subdirs)) DO \
  487.         @$(ODSRC)\bin\NMakSubd %%f Pkgs $(MAKEFLAGS)
  488. !   ENDIF
  489.  
  490.  
  491. !IF "$(RegMain)"!=""
  492.  
  493. Pkg  : CheckForNmakeZIP2EXE CheckForLOCALE $(ODSRC)\pkg\$(NmakeLOCALE)\$(RegMain:.dll=.odz)
  494. #
  495. #     The package for the native local was built as the source to this
  496. #     target.  Now try to build the packages for the other locales.
  497. #
  498.     @--FOR %%g IN ($(LocaleList)) DO \
  499.         @IF NOT "%%g" == "$(NmakeLOCALE)" \
  500.         @$(MAKE) /nologo "NmakeLOCALE = %%g" BuildPkgForSingleLocale
  501.  
  502.  
  503. BuildPkgForSingleLocale :
  504.     @echo.
  505. !       IF "$(FilesCats)"!="" || "$(FilesHelps)"!=""
  506.             @FOR %%f IN ($(FilesCats) $(FilesHelps)) DO \
  507.                 @IF NOT EXIST $(ODSRC)\locale\$(NmakeLOCALE)\%%f \
  508.                         ( (echo ERROR:  $(ODSRC)\locale\$(NmakeLOCALE)\%%f does not exist.) && \
  509.             (echo Package can not be built.) && (echo.) && \
  510.              exit ) 
  511. !       ENDIF
  512.     @$(MAKE) /nologo "NmakeLOCALE = $(NmakeLOCALE)" $(ODSRC)\pkg\$(NmakeLOCALE)\$(RegMain:.dll=.odz)
  513.  
  514.  
  515. FilesDefs = $(FilesLibs:.lib=.def)
  516.  
  517. $(ODSRC)\pkg\$(NmakeLOCALE)\$(RegMain:.dll=.odz) : CleanPkgParts {$(ODSRC)\dll}$(RegMain) $(RegMain:.dll=.odt)
  518.         @echo.
  519. !       IF "$(FilesDlls)"!=""
  520.             @FOR %%f IN ($(FilesDlls)) DO \
  521.                 @IF NOT EXIST $(ODSRC)\dll\%%f \
  522.                         ( (echo ERROR:  $(ODSRC)\dll\%%f does not exist.) && \
  523.             (echo Package can not be built.) && (echo.) && \
  524.              exit 1)
  525. !       ENDIF
  526. !       IF "$(FilesIncs)"!=""
  527.             @FOR %%f IN ($(FilesIncs)) DO \
  528.                 @IF NOT EXIST $(ODSRC)\include\%%f \
  529.                         ( (echo ERROR:  $(ODSRC)\include\%%f does not exist.) && \
  530.             (echo Package can not be built.) && (echo.) && \
  531.              exit 1)
  532. !       ENDIF
  533. !       IF "$(FilesLibs)"!=""
  534.             @FOR %%f IN ($(FilesLibs) $(FilesDefs)) DO \
  535.                 @IF NOT EXIST $(ODSRC)\lib\%%f \
  536.                         ( (echo ERROR:  $(ODSRC)\lib\%%f does not exist.) && \
  537.             (echo Package can not be built.) && (echo.) && \
  538.              exit 1)
  539. !       ENDIF
  540. !       IF "$(FilesCats)"!="" || "$(FilesHelps)"!=""
  541.             @FOR %%f IN ($(FilesCats) $(FilesHelps)) DO \
  542.                 @IF NOT EXIST $(ODSRC)\locale\$(NmakeLOCALE)\%%f \
  543.                         ( (echo ERROR:  $(ODSRC)\locale\$(NmakeLOCALE)\%%f does not exist.) && \
  544.             (echo Package can not be built.) && (echo.) && \
  545.              exit 1)
  546. !       ENDIF
  547. !       IF "$(FilesStationery)"!=""
  548.             @FOR %%f IN ($(FilesStationery)) DO \
  549.                 @IF NOT EXIST $(ODSRC)\work\%%f \
  550.                         ( (echo ERROR:  $(ODSRC)\work\%%f does not exist.) && \
  551.             (echo Package can not be built.) && (echo.) && \
  552.              exit 1)
  553. !       ENDIF
  554.         @echo Building: $@
  555.     echo $(RegMain:.dll=.odt) > parts.lst
  556.         $(ZIP) $(RegMain:.dll=.zip) parts.lst $(RegMain:.dll=.odt)
  557. !       IF "$(FilesDlls)"!=""
  558.             @FOR %%f IN ($(FilesDlls)) DO \
  559.                 $(ZIP) $(RegMain:.dll=.zip) $(ODSRC)\dll\%%f
  560. !       ENDIF
  561. !       IF "$(FilesIncs)"!=""
  562.             @FOR %%f IN ($(FilesIncs)) DO \
  563.                 $(ZIP) $(RegMain:.dll=.zip) $(ODSRC)\include\%%f
  564. !       ENDIF
  565. !       IF "$(FilesLibs)"!=""
  566.             @FOR %%f IN ($(FilesLibs) $(FilesDefs)) DO \
  567.                 $(ZIP) $(RegMain:.dll=.zip) $(ODSRC)\lib\%%f
  568. !       ENDIF
  569. !       IF "$(FilesCats)"!="" || "$(FilesHelps)"!=""
  570.             @FOR %%f IN ($(FilesCats) $(FilesHelps)) DO \
  571.                 $(ZIP) $(RegMain:.dll=.zip) $(ODSRC)\locale\$(NmakeLOCALE)\%%f
  572. !       ENDIF
  573. !       IF "$(FilesStationery)"!=""
  574.             @FOR %%f IN ($(FilesStationery)) DO \
  575.                 $(ZIP) $(RegMain:.dll=.zip) $(ODSRC)\work\%%f
  576. !       ENDIF
  577.         $(ZIP2EXE)
  578.         $(REMOVE) $(RegMain:.dll=.zip)
  579.     IF EXIST $(ODSRC)\pkg\$(NmakeLOCALE)\$(RegMain:.dll=.odz) $(REMOVE) $(ODSRC)\pkg\$(NmakeLOCALE)\$(RegMain:.dll=.odz)
  580.         $(COPY) $(RegMain:.dll=.exe) $(ODSRC)\pkg\$(NmakeLOCALE)\$(RegMain:.dll=.odz)
  581.         $(REMOVE) $(RegMain:.dll=.exe)
  582.  
  583.  
  584. $(RegMain:.dll=.odt) :
  585.         @echo.
  586.         @echo Building: $@
  587.         echo IODPartPlatform=$(Platform) > $@
  588.         echo IODPartLocale=$(NmakeLOCALE) >> $@
  589.         echo IODPartFilesDlls=$(FilesDlls: =,) >> $@
  590.         echo IODPartFilesIncs=$(FilesIncs: =,) >> $@
  591.  
  592. !    IF "$(FilesLibs)"!=""
  593.         echo IODPartFilesLibs=$(FilesLibs: =,),$(FilesDefs: =,) >> $@
  594. !    ELSE
  595.         echo IODPartFilesLibs= >> $@
  596. !    ENDIF
  597.  
  598.         echo IODPartFilesCats=$(FilesCats: =,) >> $@
  599.         echo IODPartFilesHelps=$(FilesHelps: =,) >> $@
  600.         echo IODPartFilesStationery=$(FilesStationery: =,) >> $@
  601.         echo IODPartRegMain=$(RegMain) >> $@
  602.         echo IODPartRegIDL=$(RegIDL: =,) >> $@
  603.         echo IODPartRegClassName=$(RegClassName) >> $@
  604.         echo IODPartRegKind=$(RegKind) >> $@
  605.  
  606. !ELSE
  607. Pkg  :
  608.         @echo No package to build.
  609. !ENDIF
  610.  
  611.  
  612.  
  613. #.............................................................................
  614. #                       Macros with associated rules
  615. #.............................................................................
  616.  
  617.  
  618. #
  619. # The BuildCopyRule requires 2 macros be set:
  620. #       Target = $@
  621. #       Sources = $**
  622. #
  623. BuildCopyRule :
  624.         $(COPY) $(Sources) $(Target:/=\)
  625.  
  626. # The following macro simplifies the recursive call to the BuildCopyRule
  627. BuildCopy = $(MAKE) /nologo /$(MAKEFLAGS) "Sources = $**" "Target = $@" BuildCopyRule
  628.  
  629.  
  630. #
  631. # The BuildDefRule requires 3 macros be set:
  632. #       Target = $@
  633. #       BaseNamePartOfTarget = $(@B)
  634. #       Sources = $**
  635. #
  636. BuildDefRule :
  637.         @echo.
  638.         @echo Building: $(Target)
  639.         @echo LIBRARY $(BaseNamePartOfTarget) INITINSTANCE TERMINSTANCE > $(Target)
  640.         @echo DESCRIPTION '$(BaseNamePartOfTarget).dll' >> $(Target)
  641.         @echo DATA MULTIPLE NONSHARED LOADONCALL >> $(Target)
  642.         @echo EXPORTS >> $(Target)
  643.         @FOR %%f IN ($(Sources)) DO cppfilt /B /P /Q /S %%f >> $(Target)
  644.     @echo Leaving BuildDefRule
  645.  
  646. # The following macro simplifies the recursive call to the BuildDefRule
  647. BuildDef = $(MAKE) /nologo /$(MAKEFLAGS) "Sources = $**" "Target = $@" "BaseNamePartOfTarget = $(@B)" BuildDefRule
  648.  
  649.  
  650. #
  651. # The BuildLibRule requires 2 macros be set:
  652. #       Target = $@
  653. #       Sources = $**
  654. #
  655. BuildLibRule :
  656.         @echo.
  657.         @echo Building: $(Target)
  658.     implib /noignorecase /nologo $(Target:/=\) $(Target:.lib=.def)
  659.     ilib /nobrowse /noext /nobackup /nologo /convformat $(Target:/=\);
  660.     @echo Leaving BuildLibRule
  661.     @echo.
  662.  
  663. # The following macro simplifies the recursive call to the BuildLibRule
  664. BuildLib = $(MAKE) /nologo /$(MAKEFLAGS) "Sources = $**" "Target = $@" BuildLibRule
  665.  
  666.  
  667. #
  668. # The BuildDllRule requires 2 macros be set:
  669. #       Target = $@
  670. #       Sources = $**
  671. # In addition, there is 1 optional macro:
  672. #       RecFile = the name of the resource files to be bound to the dll
  673. #
  674. BuildDllRule :
  675.         @echo.
  676.         @echo Building: $(Target)
  677.         @setlocal
  678.         set PATH=$(NmakePATH)
  679.     set LIB=$(NmakeLIB);
  680.     set BeginLIBPATH=$(NmakeLIBPATH)
  681.         @echo ilink $(LOPTS) /DLL /OUT:$(Target)
  682.     @FOR %%f IN ($(Sources:/=\) $(LocalRuntimeLibrary:/=\)) DO @echo     %%f
  683.         @ilink $(LOPTS) /DLL /OUT:$(Target) @<<
  684.  $(Sources) $(LocalRuntimeLibrary)
  685. <<
  686. !       IF "$(RecFile)"!=""
  687.             @echo.
  688.         @-IF EXIST $(ResourceCompiler) \
  689.                FOR %%f IN ($(RecFile)) DO \
  690.               $(ResourceCompiler) -p %%f $(Target)
  691.         @-IF NOT EXIST $(ResourceCompiler) \
  692.                FOR %%f IN ($(RecFile)) DO \
  693.               rc -p %%f $(Target)
  694. !       ENDIF
  695.         @set PATH=$(PATH)
  696.     @set LIB=$(LIB)
  697.         @endlocal
  698.     @echo Leaving BuildDllRule
  699.  
  700. # The following macros simplify the recursive call to the BuildDllRule
  701. BuildDll = $(MAKE) /nologo /$(MAKEFLAGS) "Sources = $**" "Target = $@" "LocalRuntimeLibrary=$(LocalRuntimeLibrary)" BuildDllRule
  702.  
  703. BuildDllWithRes = $(MAKE) /nologo /$(MAKEFLAGS) "Sources = $**" "Target = $@" "LocalRuntimeLibrary=$(LocalRuntimeLibrary)"
  704.  
  705.  
  706.  
  707.  
  708. #..............................................................................
  709. #                       clean up rules
  710. #..............................................................................
  711.  
  712.  
  713. Cleans : Clean
  714. !   IF "$(Subdirs)"!=""
  715.         @-FOR %%f IN ($(Subdirs)) DO \
  716.         @$(ODSRC)\bin\NMakSubd %%f Cleans $(MAKEFLAGS)
  717. !   ENDIF
  718.  
  719. Clean : CleanHdr CleanIdl CleanLib CleanDll CleanPkg
  720.  
  721.  
  722. CleanHdrs : CleanHdr
  723. !   IF "$(Subdirs)"!=""
  724.         @-FOR %%f IN ($(Subdirs)) DO \
  725.         @$(ODSRC)\bin\NMakSubd %%f CleanHdrs $(MAKEFLAGS)
  726. !   ENDIF
  727.  
  728. CleanHdr : CleanMsg
  729. !       IF "$(HdrTargets)"!=""
  730.                 @FOR %%f IN ($(HdrTargets)) DO IF EXIST $(IncludeDir)\%%f $(REMOVE) $(IncludeDir)\%%f
  731. !       ENDIF
  732. !       IF "$(IdlTargets)"!=""
  733.                 @FOR %%f IN ($(IdlTargets:.idl=.xh)) DO IF EXIST $(IncludeDir)\%%f $(REMOVE) $(IncludeDir)\%%f
  734. !       ENDIF
  735. !       IF "$(RcTargets)"!=""
  736.                 @FOR %%f IN ($(RcTargets:.rc=.res)) DO IF EXIST %%f $(REMOVE) %%f
  737. !       ENDIF
  738.  
  739.  
  740. CleanMsg : $(MsgTargets)
  741. !       IF "$(MsgTargets)"!=""
  742.                 !IF EXIST $(**F) $(REMOVE) $(**F)
  743.                 !IF EXIST $(**B).h $(REMOVE) $(**B).h
  744.                 @FOR %%f IN ($(MsgTargets:/=\)) DO IF EXIST %%f $(REMOVE) %%f
  745. !       ENDIF
  746.  
  747.  
  748. CleanIdls : CleanIdl
  749. !   IF "$(Subdirs)"!=""
  750.         @-FOR %%f IN ($(Subdirs)) DO \
  751.         @$(ODSRC)\bin\NMakSubd %%f CleanIdls $(MAKEFLAGS)
  752. !   ENDIF
  753.  
  754. CleanIdl  : $(IdlTargets)
  755. !       IF "$(IdlTargets)"!=""
  756.                 !IF EXIST $(IncludeDir)\$** $(REMOVE) $(IncludeDir)\$**
  757. !       ENDIF
  758.  
  759.  
  760. OS2LibTargets = $(LibTargets:/=\)
  761.  
  762. CleanLibs : CleanLib
  763. !   IF "$(Subdirs)"!=""
  764.         @-FOR %%f IN ($(Subdirs)) DO \
  765.         @$(ODSRC)\bin\NMakSubd %%f CleanLibs $(MAKEFLAGS)
  766. !   ENDIF
  767.  
  768. CleanLib :
  769. !   IF "$(OS2LibTargets)"!=""
  770.         IF EXIST *.obj $(REMOVE) *.obj
  771.         IF EXIST *.xih $(REMOVE) *.xih
  772.         @FOR %%f IN ($(OS2LibTargets)) DO IF EXIST %%f $(REMOVE) %%f
  773.         @FOR %%f IN ($(OS2LibTargets:.lib=.def)) DO IF EXIST %%f $(REMOVE) %%f
  774. !   ENDIF
  775.  
  776.  
  777. CleanDlls : CleanDll
  778. !   IF "$(Subdirs)"!=""
  779.         @-FOR %%f IN ($(Subdirs)) DO \
  780.         @$(ODSRC)\bin\NMakSubd %%f CleanDlls $(MAKEFLAGS)
  781. !   ENDIF
  782.  
  783. CleanDll:
  784. !   IF "$(DllTargets)"!=""
  785.         @FOR %%f IN ($(DllTargets:/=\)) DO IF EXIST %%f $(REMOVE) %%f
  786. !   ENDIF
  787.  
  788.  
  789. CleanPkgs : CleanPkg
  790. !   IF "$(Subdirs)"!=""
  791.         @-FOR %%f IN ($(Subdirs)) DO \
  792.         @$(ODSRC)\bin\NMakSubd %%f CleanPkgs $(MAKEFLAGS)
  793. !   ENDIF
  794.  
  795. CleanPkg: CleanPkgParts
  796. !   IF "$(RegMain)"!=""
  797.     @FOR %%f IN ($(LocaleList)) DO \
  798.         IF EXIST $(ODSRC)\pkg\%%f\$(RegMain:.dll=.odz) $(REMOVE) $(ODSRC)\pkg\%%f\$(RegMain:.dll=.odz)
  799. !   ENDIF
  800.  
  801. CleanPkgParts:
  802. !   IF "$(RegMain)"!=""
  803.     IF EXIST $(RegMain:.dll=.odt) $(REMOVE) $(RegMain:.dll=.odt)
  804.     IF EXIST $(RegMain:.dll=.ZIP) $(REMOVE) $(RegMain:.dll=.ZIP)
  805.     IF EXIST $(RegMain:.dll=.EXE) $(REMOVE) $(RegMain:.dll=.EXE)
  806.     IF EXIST parts.lst $(REMOVE) parts.lst
  807. !   ENDIF
  808.  
  809.  
  810. # end of file
  811.