Tapatalk

Is there a way to use custom makefile, color console output, break compilation?

Is there a way to use custom makefile, color console output, break compilation?

1
NewbieNewbie
1

    Mar 25, 2015#1

    Hi!

    UEStudio looks very good, I would like to buy it, but when I'm testing I found some issues which I can't resolve:

    1. Is there a way to use custom makefile? I have big project with complex makefile and I prefer use this.
    2. Is it possible to color console output? I'm dealing with templates, and uniform wall of text is unreadable.
    3. Can we break compilation?

    All these "features" are included in Notepad++. How can I achieve them in UEStudio?

    6,688587
    Grand MasterGrand Master
    6,688587

      Re: Is there a way to use custom makefile?

      Mar 27, 2015#2

      Well, as you have your own makefile, you do not really use the capabilities of UEStudio for creating a makefile for all files of a project according to selected compiler and the editable configuration for this compiler.

      So you can make the build or rebuild simply by
      • creating 1 or more project tools via Advanced - Project Tool Configuration,
      • assign the project tools to hotkeys you like at Advanced - Configuration - Key Mapping (commands AdvancedProjectToolx) and
      • add them to a customized toolbar for a quick execution by key or mouse click via right clicking on a toolbar, left clicking on context menu item Customize Toolbar, and adding User Project Tool x to an existing toolbar or a new toolbar.
      Before customization of a toolbar I suggest to use View - Layouts - Layouts and use Save current state as to store entire current layout with a custom name which is in future never updated automatically on first start of UEStudio after an upgrade (which of course means new commands of new UEStudio must be also added manually to menu/toolbars of a custom layout after upgrade).

      But after playing around with compiler configuration I can offer also an alternate solution for using a predefined makefile instead of a makefile created by UEStudio and use nevertheless the built-in commands for build and rebuild.
      1. Open the UEStudio project you have already configured for your project.
      2. Open Build - Select Compiler.
      3. Select right compiler and configuration (application, library, ...) if not already done.
        Well, in your case with a predefined makefile the configuration does not really matter as the makefile defines what is build and how. So also all the compiler options do not matter, except on using command compile to just compile a single file.
      4. Click on button Edit configuration.
      5. Click on button Make configuration local (save in project directory).
        Hint: Pressing key F1 opens the help page for the Select Compiler dialog with the possibility to edit the configuration. On this help page there are links to other help pages explaining the various groups in configuration (not too deeply).
      6. Of interest here is the group [General] as there can be configured a different make tool than mymake.exe in program files directory of UEStudio.
      7. Insert a line with
        MakeTool = MyMakeTool.bat
      8. Click on buttons Save configuration and OK.
      So far so good.

      But what should MyMakeTool.bat contain and why is it specified without full path?

      As I have never tried this before I needed one to find out an answer on that question and the others below and write this post.

      I have the batch file first specified with full path on my trials. But this resulted always on execution of a build in the error message

      Cannot find make utility 'C:\Temp\MyMakeTool.bat'. Built-in make utility will be used

      output in the output window of UEStudio. As you can imagine, I was astonished to see that message as the file was definitely in this directory. I found out with free tool Process Monitor of Sysinternals that UEStudio does not even try to access this file.

      Therefore I had the idea to specify the batch file without path in the compiler configuration. This time I could see in log of Process Monitor that UEStudio tries to find the batch file first in directory of project set in Project - Project Settings for Project directory as this is always the current working directory on starting a compile, build or rebuild, and next in all directories specified in environment variable PATH.

      So I knew now where I have to put MyMakeTool.bat. I put it into the project directory which is for my project a subdirectory UEStudio in real project directory as I don't like it if IDE files and all the object files are mixed with the source and header files of the project.

      But which parameters does UEStudio pass to the make tool on build and rebuild?

      This was easy to find out as I needed just to add into the batch file following commands:

      Code: Select all

      @echo off
      echo Make tool parameters: %*
      On execution of a build I could see now in output window

      /f ProjectName.mak ALL

      and on execution of a rebuild

      /f ProjectName.mak CLEAN ALL

      Okay, I thought now that I know which command is necessary to use a fixed make file with mymake of UEStudio. I just need to replace second parameter and use in batch file just the single line

      Code: Select all

      @"%ProgramFiles(x86)%\IDM Computer Solutions\UEStudio\mymake.exe" /f "Custom makefile with full path" %3 %4
      or use

      Code: Select all

      @echo off
      copy /Y "Custom makefile with full path" "%~2">nul
      "%ProgramFiles(x86)%\IDM Computer Solutions\UEStudio\mymake.exe" %*
      But to my surprise this resulted in two error messages on execution of a build:

      don't know how to make '/f'
      don't know how to make 'hex2chex.mak'


      So it was obviously that UEStudio does not call mymake.exe with those parameters by default. It does this only on running a configured other make tool.

      You most likely use your own make tool in the batch file. But I wanted to know how ProjectName.mak is passed to mymake.exe by UEStudio. I executed mymake.exe from command line and indeed it does not support any parameters to specify the makefile to use. So it was clear for me that the file name of the makefile must be passed via environment variable.

      I added to my batch file now additionally the command set and executed again a build. Comparing the list of environment variables in output window of UEStudio with the output of set executed in a command prompt window showed my what UEStudio defines before running a build or rebuild for my small test project using DJGPP compiler.

      Code: Select all

      #UE#FNI#=
      CTAGSDEFEXT=h
      DJGPP=C:\Compiler\DJGPP\DJGPP.ENV
      INCLUDE=C:\Compiler\DJGPP\include
      LIB=C:\Compiler\DJGPP\Lib
      MYMAKESTOPAT=3
      Path=C:\Compiler\DJGPP\BIN;C:\Program Files (x86)\IDM Computer Solutions\UEStudio\;%PATH%
      UeApp=UEStudio
      UEHELPATH=C:\Program Files (x86)\IDM Computer Solutions\UEStudio.chm
      UESDlgAct=|1C0374|20039C|1D0364|140548
      UESMAKEFILE=ProjectName.mak
      UESMMTO=0
      UESMode=Release
      UESNOCMD=0
      uespawnAct=
      uespawnDbg=
      uespawnPrj=ProjectDirectoryPath\ProjectName.prj
      UESPropEffect=
      UESUSF=tag4E871509%d
      It is easy to see that environment variable UESMAKEFILE is used to pass the name of the make file from UEStudio to mymake and just %3 %4 must be passed as parameter.

      So to use a custom makefile with mymake of UEStudio the batch file needs to contain either

      Code: Select all

      @echo off
      copy /Y "Custom makefile with full path" "%~2">nul
      "%ProgramFiles(x86)%\IDM Computer Solutions\UEStudio\mymake.exe" %3 %4
      or even better

      Code: Select all

      @echo off
      set "UESMAKEFILE=Custom makefile with full path"
      mymake.exe %3 %4
      You can of course specify in the batch file a different make tool instead of using mymake of UEStudio.

      By looking on environment variable PATH really used during build/rebuild I understood now also why the developers of UEStudio expect the name of the make tool without full path. A custom make tool is usually in the same directory as the used compiler. The directory path to the binaries of the compiler is the first directory in environment variable PATH on build/rebuild. So there is no need to specify the make tool with full path especially if the project should work independent on environment of used computer, i.e. in which directory the compiler and its tools are installed.

        Re: Is it possible to color console output?

        Mar 27, 2015#3

        It is possible at View - Themes - Manage Themes to define background and foreground color for the views.

        But with the exception of SSH/Telnet console window supporting ESC sequences depending on the Terminal settings defined in SSH/Telnet account, none of the views supports syntax highlighting based on customizable rules for contents displayed in the view up to currently latest UES v15.00.0.1023.

        I never missed a colorized output window view in UES/UE. The reason is quite simple. I never search with my eyes for warnings and errors in output window (or other lines starting with a file name and line number). That is inefficient as there are the commands Next Message and Previous Message in context menu of the output window (right clicking on output window) which finds next warning or error message automatically.

        And even better, the output window commands Next Message and Previous Message can be executed with input focus currently set in a document window by hotkey. There is no need to move my right hand from keyboard to mouse, right click in output window and execute the wanted command from context menu, or even less efficient, scroll output window with mouse to find with my eyes the next warning or error message and double click on it.

        The keys for the commands OutPreviousMessage and OutNextMessage can be customized using at Advanced - Configuration - Key Mapping.

        So all I need to do after a not successful build or rebuild is pressing Ctrl+Shift+Down to let UEStudio
        • find next warning or error message in output window,
        • display and highlight this line in output window,
        • open the file with the contents responsible for the warning/error or switch active file to this file in case of being already opened,
        • and set caret (text marker) to the line in this file so that I can immediately edit this line and correct code.
        Once code producing a warning or line is corrected, I hit Ctrl+Shift+Down and find myself on next line to correct.

        This most efficient method may not work in all use cases, but for my development it is a big time saver.

        And if Next Message and Previous Message do not make a good job for a specific environment or output window content, it is possible to write an UE/UES script which takes output window content, analyze or filter it, and writes back to output window the information really interested in reformatted for easy reading. As scripts can be executed also with a hotkey or chord, this is another possibility to get in output window only the information of interest after a build/rebuild in a format easy to read and process.

        And last idea I currently have to get in output window just the lines of interest in a format easily being read and processed is using a filter application which filters the output of make tool respectively compilers, linkers, ... already during compile/build/rebuild task so that UEStudio captures to output window only the information of interest. I used this method years ago for an old compiler producing output with unimportant messages which could not be disabled via command line switches and with warning/error messages output in a format which UES could not interpret correct. The source code of this console filter application written in C has only 83 lines. So you can imagine that it was not really difficult to code this little filter application.

          Re: Can we break compilation?

          Mar 27, 2015#4

          In the Build toolbar there is among the commands Compile (for just compiling current file without building entire project and linking it), Build and Rebuild All also the command Stop Build.

          I have never used this command for my projects and therefore have not notice before that this command is not available in the key mapping configuration dialog. There are many Build... commands in key mapping configuration dialog, but Stop Build with an expected internal name BuildStop is not in the list.
          Best regards from an UC/UE/UES for Windows user from Austria