Hello,
we are facing some issues with our GNU make based build (running on Windows 10). The main issue is that it inexplicably runs extremely slow on our Jenkins build client but only when it runs in a Jenkins context. Not sure if this problem will resolve when we move to shake, but moving on doesn't seem to be the worst idea anyways.
In the past days I tried to educate myself on build systems to move on from make. A lot of the build systems seem to move to magic (my opinion) and "just work" for specific targets and compilers. The thing I'm seeing critically is "How do I get it to work with my compiler and my static code analysis tool and other things?" because we are working with small embedded systems and our toolchain isn't very well supported in the open source community. So I was focusing more on build systems which require to write the rules as default (because I hope that the language would be easier if that's the main feature). A reddit post pointed me to Build systems à la carte, which is how I ended up here.
I was also really considering tup, but it looks like it isn't actively developed anymore, which is sad. The automatic dependency detection (although it sounds a bit whacky with the injection) is a feature which got me interested.
Let me explain a bit on how things work for us:
We have a codebase which contains a lot of software components (a bit like libraries, but they don't get linked as a lib) and software units, which linked together with the software components form a functional executable. In the last step we can combine two units to form a software segment - usually a boot part and a main part. The combination is done with the help of some batch scripts which is working fine as it is.
The way a software unit it built looks like this: we have (or should have) a makefile which contains all the rules which work universally across our range of units. For a specific unit we edit the list of directories containing the source to build the unit. Each unit can have different flags for the compiler and of course has a unique name to it. We have the ability to build either debug or release builds with different compiler and linker flags and to build everything (make all). Debug and Release get placed in different subdirectories in a binary directory for that unit.
During our build we can have different static code analysis tools running in conjunction with the compiler (currently they run sequentially, first compile then lint in one rule) generating additional output files in Lint-directories.
One of the evil quirks we have to use is a tool to format the output of our compiler (IAR Embedded Workbench) to give output which is understandable by Visual Studio (2013 for that matter). For that we use a bash shell to get the ability to pipe the output in a format tool. A similar approach is done for the linter, the output is written to a file (which is needed to have post-build) and then the relevant messages are filtered to the console output using gawk.
The build takes quite a while even though our projects are rather small. For example a complete build (debug and release with the linter running on the release build) where the boot part is around 70 files to compile and the main part is around 250 files it takes around 6 minutes to complete on my machine using -j8 (I have a small i7-7500U (dual core, 4 threads) but it doesn't use 100 % CPU with that setting...). Just for the fun of mentioning it, the same build takes 3 hours and 30 minutes on our Jenkins which is a way more capable machine.
Question time (note: no one has Haskell knowledge in my company, so that is a hurdle to take):
1) Is it possible to have build.exe which will read from configuration files a list of source directories and compiler flags to build different software units without each unit having an own build.exe?
So we have a 'BootPart/BuildBootPart.Config' and a 'MainPart/BuildMainPart.Config' and then can call 'Software/BootPart/> Build.exe -f BuildBootPart.Config all' or something similar to that.
2) I think I already read this somewhere, but having a release, debug and all target should be possible, as well as passing an option like DONT_LINT to prevent the linter from running?
3) Is it possible to capture the command output and manipulate it directly in the build.exe to format it in a way to make it understandable for Visual Studio (with the help of regular expressions usually)? This would remove the dependency on a Unix shell under Windows and reduce the number of processes needed to spawn and speed up everything (I think). Same for the linter.
4) Does the build.exe have any dependencies? We'd like to distribute the build system along with the source for the developers without having to install anything (compiler is an exception to that rule).
5) As a starting point I guess I should go have a look at shake-language-c and start from there?
This is a rather lengthy post, thanks to anyone reading it and for any answer or suggestion in advance.
Bernhard