help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

function help


From: Martin McCann
Subject: function help
Date: Sun, 8 Jun 2003 14:15:50 +0000
User-agent: KMail/1.5

Hi there, 

        I am trying to create a system of make files for my project, so as to 
make 
adding extra elements to the system is as easy as possible. I have created a 
make file called do_subdirs.mk which has the following - 

# ---- do_subdirs.mk --- 
subdirs:
        $(foreach SUBDIR, $(SUBDIRS), $(MAKE) -C $(SUBDIR);)

# --- eof ---

        So to have a makefile enter a list of sub directories I just need - 

# ----

SUBDIRS = dir1 dir2 dir3 dir4 
include ../mk/do_subdirs.mk 

# ----


This all works, which is nice. The one problem being that the macro expands to 

        make -C dir1; make -C dir2; make -C dir3; make -C dir4; 

so if one of the makes fails, it doesn't fail the entire make (I assume to 
only takes the return code from the left/right most make). So my question is, 
how do I achieve the same but have the make fail if any make fails. I know I 
could achieve it with a shell script, but I'd rather avoid it if possible. 

Cheers, 
Martin McCann 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]