timbertson / gup

A better make, inspired by djb's redo.
GNU Lesser General Public License v2.1
51 stars 5 forks source link

Source files: any way to opt into hashing? #15

Closed b11z closed 6 years ago

b11z commented 6 years ago

It looks like gup --contents is the way to hash a target output, but is there any way to ask that source files get hashed? I.e. if I have a non-built dependencies, they are always recorded by timestamp and not content hash, as far as I could see.

timbertson commented 6 years ago

Yeah, this is a confusing part of the orignal redo design. Sources are always just timestamp based. It's simple, and I don't know how you'd specify something different for a source since the only files gup has are "this is how you build a target".

A common solution is to make a phony target which represents "file a's contents has changed", like so:

# b.gup:
gup -u a.stamp
# use a in your actual build
# a.stamp.gup:
gup -u a
gup --contents a

This way, changing a causes a.stamp to get built, but since that target uses --contents a, it isn't considered changed, so b won't be rebuilt.