If you'd like to see lua+tup in action, here's a little embedded project that uses this combination.

https://github.com/DISTORTEC/distortos

Unfortunately it's meant for microcontrollers, so if you'd like to actually build it you will need an arm-none-eabi- toolchain (there's a link in README.md).

One thing that lua has and original tup parser doesn't is the "getrelativedir" function, which allows to build input tree into an identical output tree, but placed in a subdirectory. Well, you could do the same with original parser, but you'd have to state full output path in each rule, while in lua you just use this new function and everything "just works". This ability is used in the project linked above.

Another interesting thing is the ability to open any file read-only and generate rules from that - it's like run-script, but without need for additional files in different language. This is demonstrated - for example - in tup's testcases - https://github.com/gittup/tup/blob/master/test/t2157-lua-open-file.sh

It's true that lua's syntax is not as simple as original tup parser's syntax, but lua is really powerful (; There are many seemingly trivial tasks that cannot be accomplished with tup's parser, but using lua it's really simple - imagine every use case for patsubst() from Makefiles, like appending "-I" in front of every string with include directory or "-D" in front of every macro definition - this cannot be done in tup's parser (at least I haven't found a way to do that). There are many uses for such operation - imagine you have to write your build description so that it works on both gcc and any-other-compiler-that-has-completely-different-flags. So for one configuration you have "-Idirectory -Dmacro" and for other `/include="directory" /define="macro"`. If you'd like to only give "directory" and "macro" (without any prefixes/suffixes) to some variables and parse that later depending on the configuration, this cannot be done without lua (or I don't know how, but I'm pretty certain this cannot be done) or runscript.

Regards,
FCh

--
--
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- You received this message because you are subscribed to the Google Groups "tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to