/* This macro provides a simple build function */
arg cmd parm

select

   /* initialize menus and action keys */
   when "I" = cmd then do
      'SET ACTIONBAR.~Options.B~uild.~Directory... BUILD D'
      'SET ACTIONBAR.~Options.B~uild.~Command... BUILD C'
      'SET ACTIONBAR.~Actions.~Build\tCtrl+B ;SAVEALL PROMPT MACRO BUILD B'
      'SET ACTION.C-B ;SAVEALL PROMPT MACRO BUILD B'
   end

   when "D" = cmd then do
      'SET LINEREAD.TITLE Build Directory'
      'SET LINEREAD.PROMPT Enter build directory'
      'EXTRACT GLOBAL.BUILD.DIR INTO BUILDDIR'
      'LINEREAD 256' builddir
      'EXTRACT LASTKEY'
      if lastkey = "ENTER" then do
         'EXTRACT LASTLINE'
         'SET GLOBAL.BUILD.DIR 'lastline
      end
   end

   when "C" = cmd then do
      'SET LINEREAD.TITLE Build Command'
      'SET LINEREAD.PROMPT Enter build command'
      'EXTRACT GLOBAL.BUILD.CMD INTO BUILDCMD'
      'LINEREAD 256' buildcmd
      'EXTRACT LASTKEY'
      if lastkey = "ENTER" then do
         'EXTRACT LASTLINE'
         'SET GLOBAL.BUILD.CMD 'lastline
      end
   end

   when "B" = cmd then do
      'LX "OS/2 command shell" /dt SHL'
      'EXTRACT GLOBAL.BUILD.DIR INTO BUILDDIR'
      if builddir \= '' then do
         if (substr(builddir,2,1) = ":") then
            'CMD E 'substr(builddir,1,2)
         'CMD E CD 'builddir
      end

      'EXTRACT GLOBAL.BUILD.CMD INTO BUILDCMD'
      if buildcmd \= '' then do
         'CMD E 'buildcmd
      end
   end
end

