If makefile changes, make rebuilds all targets right?
But how to tell make that if after makefile changed, it shall run make clean
and then make
?
Or how to instruct make to run some other command in that situation? Do I have to write a special kind of target?
Crude but effective (I can't think of anything more elegant):
include marker
marker: Makefile
@touch $@
$(MAKE) clean
$(MAKE)
You could try this:
all: Makefile.uptodate yourMainTarget
Makefile.uptodate: Makefile
make clean
touch Makefile.uptodate
I'm not a make
expert so I don't know if that's a horrible hack, but it worked in my limited tests ;-)
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