On Thu, Nov 27, 2008 at 1:48 PM, Tao T <[EMAIL PROTECTED]> wrote: > > actually it still relate my last question. My original code is like this: > target: $(depfile) > BUILDUNITS := $(shell $(foreach unit,$(ALL_UNITS),cd > $(REPOSITORY_ROOT)/units/$(unit)/source/sc/beh && $(MAKE) $(MAKECMDGOALS) > BUILD_TYPE=$(BUILD_TYPE) 1>&2;)) > -include $(depfile) > I need jump into the sub_make before $(depfile). This code can fulfill it. > However, it can not stop asap when a error happens. > Then I have two approach: > 1. keep the shell function try add some error detector. > 2. to get rid of the shell function. > > For the 1. way ,as so many nice guys suggested I tried so many methods: "set > -e" "exit &&?" "&& true" It seems all does not work. The only work method is > touch a error_flag, However, It also has some delay in exit make. the parent > makefile can not recognize the error_flag immediately. I dont know why.the > command is: > ifneq (,$(wildcard error_flag)) > BUILDUNITS := $(shell rm -f error_flag) > $(error Something bad happened.) > endif > Do you have some more suggestion for this part? Thanks > > For the 2. way the problem is how can I run the sub makefile when the > reading process of parent makefile.Beacuse the $(depfile) need some file > generate in sub make. If I can not run the sub makefile first, it will cause > error. I think in my original code "BUILDUNITS :=&(shell )" can achieve this > require .I don't know whether you can get my point. I hope I also could get > some suggestion here for this part. > > thank in advance > Tao
http://www.gnu.org/software/make/manual/make.html#Secondary-Expansion ? If you instead clearly define the problem that you're trying to solve, we can suggest some decent solutions to your problems than embedding all of the error checking in Makefile's. Thanks, -Garrett _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
