3 ms·
Some years ago I designed a Makefile-based build system [1] that uses many GNU Make features. If you write Makefiles on that level, you quickly notice that GNU
by vog 13y ago
Some years ago I designed a Makefile-based build system [1] that uses many GNU Make features. If you write Makefiles on that level, you quickly notice that GNU Make's internal structure resembles Lisp quite a lot [2], e.g. you write $(filter xx,yy) which is very close to (filter xx yy). Also, you have other Lisp-like stuff like quoting, eval, and so on. Sometimes GNU Make really felt almost like Lisp, but with a slightly more cumbersome syntax and evaluation model.
So I often asked myself why they don't use Lisp directly. Now they almost do, which I find very consequent.
[1] http://mxe.cc/ http://mxe.cc/
[2] https://github.com/mxe/mxe/blob/master/Makefile https://github.com/mxe/mxe/blob/master/Makefile
- mzs 13y agoThat's funny, I see what you are talking about, but I had a moment like that with make, but instead likened it to prolog instead in my head one evening!
- mturmon 13y agoI think Prolog is a much better analogy than Lisp. Like Prolog, the Makefile declares relationships, which go into a rule database, and then when you need to make something, the runtime scans the rules looking for what matches. This will imply other dependencies, which are satisfied recursively.
- opk 13y agoThere are two separate stages with GNU make. The first is very lisp like with the functions like $(filter) and you use it to create all the rules for the second, more prolog like, stage. A simple Makefile would do nothing for the first stage because it'd all be static text instead of function calls.
- vog 13y agoNot only that. In the above mentioned MXE project, the $(...) functions also play a vital role on the "second stage": They create a huge, automatic set of rules and actions, based on a higher-level description that is given for each package via a bunch Make variables (some of which are multiline and contain actual commands for that package).