Let's say that I have 2 targets:
test:
# ...
@$(MAKE) dosomething
@echo test
# ...
dosomething:
# ...
@if [ -z "$(SOMETHING)" ]; then exit 0; fi
@echo dosomething
# ...
I would like echo test to execute even if $(SOMETHING) is empty and echo dosomething only if $(SOMETHING) is not empty (which doesn't work with the example, it's still executed).
exit 0 of course doesn't work here since make ignores non-negative exit in subshells used to execute instructions.
Is there any other way to skip the rest of the target without breaking further execution of test target? I could make the rest a single long instruction of else but wondering if there's a different command I'm maybe missing.