home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / samples / sam03l / build03d.cm_ / BUILD03D.CMD
Encoding:
Text File  |  1992-04-01  |  8.1 KB  |  144 lines

  1. @echo off
  2. cls
  3. ECHO ***************************************************************************
  4. ECHO * SAMPLE PROGRAM: SAMPLE03 - dynamically linked                           *
  5. ECHO *                                                                         *
  6. ECHO * COPYRIGHT:                                                              *
  7. ECHO * ----------                                                              *
  8. ECHO * Copyright (C) International Business Machines Corp., 1991, 1992.        *
  9. ECHO *                                                                         *
  10. ECHO * STATUS: VERSION 1, RELEASE 0, MODIFICATION 0                            *
  11. ECHO *                                                                         *
  12. ECHO * DISCLAIMER OF WARRANTIES:                                               *
  13. ECHO * -------------------------                                               *
  14. ECHO * The following [enclosed] code is sample code created by IBM             *
  15. ECHO * Corporation.  This sample code is not part of any standard IBM product  *
  16. ECHO * and is provided to you solely for the purpose of assisting you in the   *
  17. ECHO * development of your applications.  The code is provided "AS IS",        *
  18. ECHO * without warranty of any kind.  IBM shall not be liable for any damages  *
  19. ECHO * arising out of your use of the sample code, even if they have been      *
  20. ECHO * advised of the possibility of such damages.                             *
  21. ECHO *                                                                         *
  22. ECHO * ----------------------------------------------------------------------- *
  23. ECHO *                                                                         *
  24. ECHO *  Routine to demonstrate a global DLL using shared memory.               *
  25. ECHO *                                                                         *
  26. ECHO *  File list:                                                             *
  27. ECHO *                                                                         *
  28. ECHO *   SAMPLE03.C    - source code to create the DLL                         *
  29. ECHO *   INITTERM.C    - source code for DLL initialization/termination        *
  30. ECHO *   SAMPLE03.H    - header file for this sample                           *
  31. ECHO *   SAMPLE03.DEF  - module definition file for the DLL                    *
  32. ECHO *   MAIN03.C      - source code to create the EXE                         *
  33. ECHO *   MAIN03.DEF    - module definition file for the EXE                    *
  34. ECHO *   BUILD03D.CMD  - command file to build SAMPLE03 dynamically linked     *
  35. ECHO ***************************************************************************
  36. PAUSE
  37. SETLOCAL
  38. ECHO ************************************************************************
  39. ECHO Call CSETENV.CMD to set up the IBM C Set/2 environment
  40. ECHO ************************************************************************
  41. :ENV
  42. IF NOT EXIST ..\..\BIN\CSETENV.CMD GOTO ERROR1
  43. CALL ..\..\BIN\CSETENV.CMD
  44. GOTO CHECK
  45. :ERROR1
  46. ECHO ERROR:  Failed to locate CSETENV.CMD command file
  47. ECHO REMEDY: Verify that CSETENV.CMD is in the \BIN directory and try again
  48. PAUSE
  49. GOTO END
  50. :CHECK
  51. ECHO ************************************************************************
  52. ECHO Check that all required files exist
  53. ECHO ************************************************************************
  54. IF NOT EXIST ..\..\LIB\DDE4SBSI.LIB GOTO ERROR2
  55. IF NOT EXIST ..\..\DLL\DDE4SBS.DLL GOTO ERROR2
  56. GOTO COMPINIT
  57. :ERROR2
  58. ECHO ERROR:  One or more libraries are missing
  59. ECHO REMEDY: Make sure that you have installed the correct libraries
  60. ECHO         and try again
  61. PAUSE
  62. GOTO END
  63. :COMPINIT
  64. ECHO ***************************************************************************
  65. ECHO * Compiling DLL Initialization/Termination source                         *
  66. ECHO *                                                                         *
  67. ECHO * icc /c /O+ /Ge- /Gd+ INITTERM.C                                         *
  68. ECHO *                                                                         *
  69. ECHO * compiler options:                                                       *
  70. ECHO *                                                                         *
  71. ECHO *   /c    :  do not invoke the linker                                     *
  72. ECHO *   /O+   :  generate optimized code                                      *
  73. ECHO *   /Ge-  :  build a .DLL file                                            *
  74. ECHO *   /Gd+  :  dynamically link the C runtime functions                     *
  75. ECHO *                                                                         *
  76. ECHO ***************************************************************************
  77. icc /c /O+ /Ge- /Gd+ INITTERM.C
  78. IF NOT ERRORLEVEL 1 GOTO BUILDDLL
  79. ECHO ERROR:  Failed to compile INITTERM.C
  80. ECHO REMEDY: Make sure that you have installed the correct components
  81. ECHO         and try again
  82. PAUSE
  83. GOTO END
  84. :BUILDDLL
  85. ECHO ***************************************************************************
  86. ECHO * Building DLL                                                            *
  87. ECHO *                                                                         *
  88. ECHO * icc /O+ /Ge- /Gd+ /B"/NOE" SAMPLE03.C INITTERM SAMPLE03.DEF             *
  89. ECHO *                                                                         *
  90. ECHO * compiler options:                                                       *
  91. ECHO *                                                                         *
  92. ECHO *   /c       :  do not invoke the linker                                  *
  93. ECHO *   /O+      :  generate optimized code                                   *
  94. ECHO *   /Ge-     :  build a .DLL file                                         *
  95. ECHO *   /Gd+     :  dynamically link the C runtime functions                  *
  96. ECHO *   /B"/NOE" :  pass /NOE option to linker                                *
  97. ECHO *                                                                         *
  98. ECHO ***************************************************************************
  99. icc /O+ /Ge- /Gd+ /B"/NOE" SAMPLE03.C INITTERM SAMPLE03.DEF
  100. IF NOT ERRORLEVEL 1 GOTO BUILDEXE
  101. ECHO ERROR:  Failed to compile and/or link SAMPLE03.C
  102. ECHO REMEDY: Make sure that you have installed the correct components
  103. ECHO         and try again
  104. PAUSE
  105. GOTO END
  106. :BUILDEXE
  107. ECHO ***************************************************************************
  108. ECHO * Building EXE                                                            *
  109. ECHO *                                                                         *
  110. ECHO * icc /O+ /Gd+ MAIN03.C MAIN03.DEF                                        *
  111. ECHO *                                                                         *
  112. ECHO * compiler options:                                                       *
  113. ECHO *                                                                         *
  114. ECHO *   /O+   :  generate optimized code                                      *
  115. ECHO *   /Gd+  :  dynamically link the C runtime functions                     *
  116. ECHO *                                                                         *
  117. ECHO ***************************************************************************
  118. icc /O+ /Gd+ MAIN03.C MAIN03.DEF
  119. IF NOT ERRORLEVEL 1 GOTO RUN
  120. ECHO ERROR:  Failed to compile and/or link MAIN03.C
  121. ECHO REMEDY: Make sure that you have installed the correct components
  122. ECHO         and try again
  123. PAUSE
  124. GOTO END
  125. :RUN
  126. COPY SAMPLE03.DLL ..\..\DLL > NUL:
  127. ECHO ************************************************************************
  128. ECHO Running MAIN03.EXE
  129. ECHO ************************************************************************
  130. MAIN03
  131. PAUSE
  132. ECHO ************************************************************************
  133. REM Clean up files and environment
  134. ECHO ************************************************************************
  135. :CLEANUP
  136. IF EXIST ..\..\DLL\SAMPLE03.DLL ERASE ..\..\DLL\SAMPLE03.DLL
  137. IF EXIST SAMPLE03.DLL ERASE SAMPLE03.DLL
  138. IF EXIST INITTERM.OBJ ERASE INITTERM.OBJ
  139. IF EXIST SAMPLE03.OBJ ERASE SAMPLE03.OBJ
  140. IF EXIST MAIN03.EXE ERASE MAIN03.EXE
  141. IF EXIST MAIN03.OBJ ERASE MAIN03.OBJ
  142. :END
  143. endlocal
  144.