I appreciate makefiles and make in all their glory, but I wonder if there isn't a more intuitive way to maintain my c/c++ builds.
Has anyone tried replacing their makefiles with ruby scripts to allow for complex and adaptive builds without sacrificing readability? Are there gems that make this easier?
Take a look at Rake, a make replacement written in Ruby. It's basically a small domain specific language, geared towards typical make
-like tasks, with the possibility of writing normal ruby code in the Rakefile
.
This is a very old idea and has been tried with many scripting languages. SRC Modula-3 shipped with a language called "Quake" in which all the m3makefile
s for the project were written. The challenge is to provide something approaching the succinctness and transparency of a Makefile while allowing much more expressive power. Rake has a ways to go before it approaches the simplicity and clarity of make or quake, but it is eminently usable. I think some readability is sacrificed relative to a tool like Plan 9's mk, but Rake is far more readable than the more baroque uses of Gnu Make.
I have converted large, multiple and complex C projects using Rake, and a few small Java ones.
And I will never go back to makefiles! The rakefiles to my eyes are far more readable than either makefiles or ant.
Rake and ruby do have their own set of problems, the main one being decent documentation, and it will still take some learning and experience to craft decent build systems unless you are very handy with Ruby.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With