[Q] Immediately exiting (with return code zero) from Makefile?

From: Yongjik Kim (kimy_at_cs.unc.edu)
Date: 01/26/04


Date: 25 Jan 2004 20:22:27 -0800

Hi,

 How can I write Makefile so that, if some condition is satisfied,
it aborts processing immediately --- with a return code ZERO?

 -----
 The situation is like this: my team is developing a software that has
several modules. So, a Makefile at the root directory compiles each
module by calling its own Makefile:

all: (blah blah...)
    @for i in $(SRC_DIRS); do \
    if [ -e $$i/Makefile ]; then \
        cd $$i; make all; \
        cd ..; \
    fi \
    done;

 For some reasons, not everybody sees every module. So, if I don't
have a copy of module M, then the root Makefile won't call M/Makefile.
(Instead, the author of module M supplies a compiled library file.)

 However, I have a read-only copy of module M1, whose compilation
depends on another module M2, which I don't have.

 The net effect is that the root Makefile will invoke M1/Makefile,
and fails. I'd like to change M1/Makefile so that it quits immediately
if M2/Makefile does not exist, with return code zero, so that the root
Makefile continues processing (thinking that everything is OK).

 Simply erasing M1/Makefile (or writing a dummy Makefile) is not an option,
because the code is shared via CVS. (So, that would make the author of M1
rather unhappy.)

 Thanks in advance,
 - Yongjik



Relevant Pages