Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make: only build something if the source's md5 checksum was changed

Tags:

makefile

Is it possible to tell make to only build a target if it's sources md5 checksum has changed (instead of the edit time)?

I'm using make to compile my .tex files and I need to prevent it from building everything twice all the time.

I've tried using Scons, but I feel this isn't adaptable to other needs I have.

like image 609
romeovs Avatar asked Jan 11 '12 14:01

romeovs


People also ask

How do I change MD5 checksum?

Could it be changed? No. You can not change md5sum of a file as long as the contents of the files are same. And that is the sole purpose of it.

When a file is altered does its MD5 hash value changes explain?

The contents of a file are processed through a cryptographic algorithm, and a unique numerical value – the hash value - is produced that identifies the contents of the file. If the contents are modified in any way, the value of the hash will also change significantly.

What happens if MD5 checksum doesn't match?

If the checksum matches, the files are identical. If not, there's a problem—perhaps the file is corrupted, or you're just comparing two different files. If you downloaded a copy of the file and its checksum doesn't match what you expect, try downloading the file again.

Can you spoof checksum?

In checksum spoofing an adversary modifies the message body and then modifies the corresponding checksum so that the recipient's checksum calculation will match the checksum (created by the adversary) in the message.


1 Answers

No, this is not supported by Make — as you've found out, support for this feature is one of the reasons why tools like Scons exist.

I found a manual recipe for GNU make, though. Maybe you can use that as a work around.

like image 149
Martin Geisler Avatar answered Sep 29 '22 15:09

Martin Geisler