NAICNO / Jobanalyzer

Easy to use resource usage report
MIT License
0 stars 1 forks source link

`go build` will change the mtime of the program even if no programs have changed #641

Closed lars-t-hansen closed 3 weeks ago

lars-t-hansen commented 3 weeks ago

A thing I don't like with my current Makefile setup is that make build traverses the subdirectories and then it runs go build everywhere, and this should really only do something if the dependencies have changed, but it actually runs the linker or at least touches the executable, so this updates the mtime of every program. To do better, the makefiles need to have the actual dependencies of the inputs (usually go.mod *.go */*.go ../go-utils/*/*.go though in some cases there are no subdirs and sometimes there may be more things).

What might work here is for go-rules.mk to take a variable SRCDEPS that is a list of dependencies and will make build depend on those.

Might update SUBDIRS to always name all subdirs where relevant, since go test will run go vet even if there are no tests, and this is a boon.