Version 1 of smake musings

Updated 2003-11-21 03:38:07

2003-11-30 VI I just love smake. Mostly because I have tclsh across all the platforms I work on. I thought there was something called "Jam", but couldn't find it. In any case I like the simple smake to the more complex (and more capable) bras.

Some notes about smake follow. I have also emailed the author.

  • The documentation describes "uptarget". The command is really "upTarget", note the uppercase T
  • In the code after the depend, the variable "target" is the current target being worked on.
  • If a target doesn't exist and if all the dependencies are up-to-date, then smake doesn't run the rule, which is counterintuitive, more on this below.

When a target doesn't exist but all the dependencies are up-to-date, smake doesn't run the rule, which is counter-intuitive. e.g.

   target a {
     depend {b.o c.o} {
        link a [list b.o c.o] 
     }
   }

Here you would expect that if a doesn't exist, but b.o and c.o are up-to-date, then the link will run. That doesn't seem to happen for me (I could be just using it wrong). In any case, to fix this here's what I added:

Just before this:

    if {$update} {
        uplevel 1 $op
        uplevel 1 {set targetUpdate 1}
    }

in the proc "depend", I added this:

    if !$update {
        set thistarget [lindex $SmakeTargetPath end]
        if ![file exists $thistarget] {
            dputs 3 "Target $thistarget hasn't been made yet, update"
            set update 1
        }
    }

Hope this helps someone! --- 2003-11-30 VI : A possible cleaner way to do the set thistarget is to do it like this:

    if !$update {
        upvar target thistarget
        if ![file exists $thistarget] {
            dputs 3 "Target $thistarget hasn't been made yet, update"
            set update 1
        }
    }