Sunday, April 18, 2010

A bit of fun with tmk

Yesterday I setup tmk to understand how to include files, by using a simple pre processing directive, making the syntax for tmk fairly simple:


variable = value

rule lhs -> rule rhs:
        command directive! word arguments


Where variable expansions and file name globbing is widely used as part of the design, while keeping the recipe parsing code fairly trivial. I designed it this way, both to be familiar with Make (although lhs/rhs are reversed), fairly obvious at a glance, and to be easy to implement. Now tmk also understands the concept of a (pre) processing directive. Since directive! is used within rules, the processing directives use the inverse, i.e. !directive. I believe that makes a better distinction then using a different symbol, especially since you can not use a command directive everywhere a processing directive is permitted. Right now there is only one directive, !include which slurps up it's argument list as the name of a recipe file to include within the current, before continuing of course. Some form of conditional will probably be added later on; even though the rule syntax gives a way to define certain looping behaviour.

Today's goal is to basically implement the concept of if the outputs (lhs) are more up to date then the inputs (rhs), the rule can be skipped. I don't expect that to take to long, since most of it is just screwing with the rule expansions in order to properly stat the files. If I can get it done expeditiously, I'll also have time to setup a few late binding `special` variables that will be useful, in proper Make fashion lol.

At which point, tmk will be effectively as good as a generic make implementation; and I can work on the parts that need to follow on. Namely the parallel support and portability aspects. The latter of course, being the main reason why CMake, SCons, and most every other such tool I've tried, has been rejected as more trouble then it's worth.

No comments:

Post a Comment