Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have you replaced makefiles with ruby scripts?

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?

like image 372
thebretness Avatar asked Feb 20 '10 21:02

thebretness


3 Answers

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.

like image 186
Jakob Borg Avatar answered Oct 14 '22 16:10

Jakob Borg


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 m3makefiles 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.

like image 25
Norman Ramsey Avatar answered Oct 14 '22 16:10

Norman Ramsey


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.

like image 35
Jim Avatar answered Oct 14 '22 16:10

Jim