cancel
Showing results for 
Search instead for 
Did you mean: 

Create a "hash" of all source files as a pre-build step?

Andrew Neil
Super User

Follow-on from Is it possible in STM32CubeIDE to set a compiler dependency on ALL sources?

Specifically, this post:

I guess you could do some sort of hash of all the source code?

This wouldn't stop the version.c file getting rebuilt every time, but it would let you see whether the rest of the code actually changed or not.

Or you could take it further: save the hash in a file somewhere, and only do the touch when the hash has changed?

Any suggestions on how to do this "hash" as a pre-build step? Is there anything included within the CubeIDE build stuff that would do this?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
1 REPLY 1
Pavel A.
Super User

For hashing files: the busybox bundled with CubeIDE has md5sum, sha256sum and so on.

The question is, how to get the list of c & h files from the Eclipse project. If the project uses "external builder", Eclipse will create makefiles, where you can find the dependencies. Also, you can add custom make targets to do something. Internal builder doesn't expose makefiles. Custom make targets can be added - but they don't seem to work.