The classic way to do it is:
version.o: .FORCE
.FORCE:
(and you might add .PHONY: .FORCE
). The file ‘.FORCE’ is presumed not to exist, so it is always ‘created’, so version.o
is always out of date w.r.t it, so version.o
is always compiled.
I’m not sure that making version.o
into a phony file is correct; it is actually a real file, not a phony one.