I have set of targets, that should be executed according to some order requirements. There is correct order:
wake
fuse
flash
eep
verify
lock
Some of those targets are grouped as another (phony) empty targets:
.PHONY: wake
full: fuse flash eep lock
Unfortunately, when i call make full --dry-run
i see that make
tries to execute rules in incorrect order: wake flash eep lock fuse
. Therefore i get incorrect results (erased-out MCU).
I've tried to add some order-only prerequisites. Here is skeleton of my Makefile with those:
.PHONY: wake
wake:
<...>
.PHONY: flash
flash: build/main.hex | fuse
<...>
.PHONY: eep
eep: build/main.eep.hex | fuse flash
<...>
.PHONY: verify
verify: build/main.hex | fuse flash eep
<...>
.PHONY: fuse
fuse: | wake
<...>
.PHONY: lock
lock: | fuse flash eep
<...>
build/main.hex: <some files here>
<...>
Now make full
works fine, but PHONY order-only target's rules are executed even when i try to execute some specific rule. For example:
make eep
results in execution of wake fuse flash eep
.
I don't want to waste time for full flashing while i need only to write new eep image.
Seems like so-called "order-only prerequisites" are treated like regular prerequisites.
How can i force "order-only prerequisites" to work like real order-only requirements? Is there more elegant solution?