The idea is that a project has a single file with __DATE__
and __TIME__
in it. It might be cool to have it recompiled without explicitly changing its modification date.
edit: $(shell touch -c ..) might be a good solution if only clumsy.
The standard idiom is to have the object file (not the source file!) depend on a target which doesn't exist and has no rules or dependencies (this target is conventionally called FORCE), like this
always-recompile.o: FORCE
FORCE:
This will break if a file named "FORCE" gets created somehow, though. With GNU make you can instead use the special target .PHONY, which doesn't have this limitation, but does require you to have an explicit rule to rebuild that file:
always-recompile.o:
$(CC) $(CFLAGS) -c -o always-recompile.o always-recompile.c
.PHONY: always-recompile.o
See http://www.gnu.org/software/make/manual/html_node/Phony-Targets.html for more details.
One way to do this is to delete the corresponding object file (.o
or .obj
) before running make
. This will trigger a recompile (and relink) without changing the source file modification date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With