home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / uudbz003.zip / dbzMake.Cmd < prev    next >
OS/2 REXX Batch file  |  1997-08-10  |  2KB  |  91 lines

  1. /* Rexx */
  2. /* dbzMake.Cmd -- Make sure you are in the correct directory, */
  3. /* then make sure that library and include paths are setup. */
  4. /*If not, then call dbz_mksetup.cmd.  Finally, run dmake. */
  5.  
  6. parse arg opts
  7.  
  8. rc = SysFileTree('.\lib', 'libDir', 'OD')
  9. if rc \= 0 then
  10.     signal NoMemory
  11. if libDir.0 \= 1 then
  12.     signal WrongDirectory
  13.  
  14. rc = SysFileTree('.\news', 'newsDir', 'OD')
  15. if rc \= 0 then
  16.     signal NoMemory
  17. if newsDir.0 \= 1 then
  18.     signal WrongDirectory
  19.  
  20. needSetup = 0
  21. libPath = value('LIBRARY_PATH',, 'OS2ENVIRONMENT')
  22. incPath = value('C_INCLUDE_PATH',, 'OS2ENVIRONMENT')
  23. libDir.1 = Translate(libDir.1, '/', '\')
  24. newsDir.1 = Translate(newsDir.1, '/', '\')
  25.  
  26. rc = Pos(libDir.1, libPath)
  27. if rc = 0 then
  28.     needSetup = 1
  29.  
  30. rc = Pos(libDir.1, incPath)
  31. if rc = 0 then
  32.     needSetup = 1
  33.  
  34. rc = Pos(newsDir.1, libPath)
  35. if rc = 0 then
  36.     needSetup = 1
  37.  
  38. rc = Pos(newsDir.1, incPath)
  39. if rc = 0 then
  40.     needSetup = 1
  41.  
  42. if needSetup = 1 then
  43. do
  44.     /* Make sure there is a semi-colon on the end first. */
  45.     /* Do not assume that merely because one of the variables */
  46.     /* does not end with a semi-colon, that the other does not */
  47.     /* as well. */
  48.     lastSemi = LastPos(';', libPath)
  49.     strLength = Length(libPath)
  50.     if lastSemi < strLength then
  51.     do
  52.         libPath = libPath||';'
  53.         libPath = value('LIBRARY_PATH',libPath, 'OS2ENVIRONMENT')
  54.     end
  55.  
  56.     lastSemi = LastPos(';', incPath)
  57.     strLength = Length(incPath)
  58.     if lastSemi < strLength then
  59.     do
  60.         incPath = incPath||';'
  61.         incPath = value('C_INCLUDE_PATH',incPath, 'OS2ENVIRONMENT')
  62.     end
  63.  
  64.     /* Add semi-colon to the end to make this easier */
  65.     call dbz_mksetup libDir.1||';'||newsDir.1||';'
  66.  
  67. end /* if needSetup = 1 */
  68.  
  69. parse upper var opts stuff
  70. rc = Pos("PACKAGE", stuff)
  71. if rc \= 0 then
  72. do
  73. /*   'dmake clean -f Makefile.dbz' */
  74.    Call MakeDiffs
  75. end
  76. 'dmake' opts '-f Makefile.dbz'
  77. /* Return whatever dmake returns */
  78. exit rc
  79. /* End of main program */
  80.  
  81. NoMemory:
  82. say "SysFileTree() error, not enough memory?"
  83. exit 1
  84.  
  85. WrongDirectory:
  86. say "Cannot find specified directory."
  87. say "Be sure to run this from the same directory"
  88. say "that the makefile is in."
  89. exit 2
  90.  
  91.