[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: for sub in $(SUBMAKES); but $(SUBMAKES) is empty
From: |
Paul D. Smith |
Subject: |
Re: for sub in $(SUBMAKES); but $(SUBMAKES) is empty |
Date: |
Fri, 17 Sep 2004 12:49:03 -0400 |
%% address@hidden (Alexander Farber) writes:
af> thanks for your help! But aside from the discussion about the
af> recursive makefiles (I really don't have a choice at the moment
af> and have to use them ), is this below supposed to work or not?
This is not a make question; this is a shell question.
Technically, according to the POSIX specs for the behavior of the shell,
the syntax "for i in ; do" is illegal; there must be at least one word
after the "in" and before the end of statement terminator (newline or
";").
So, this:
af> linux72:afarber {331} cat Makefile
af> SUBMAKES=
af> all:
af> for i in $(SUBMAKES); do \
af> echo $$i; \
af> done
may work on some shells but is not portable and not compliant with the
POSIX standard.
But again, this is a shell question not a make question.
af> Do I really have to modify my makefiles to contain:
af> all clean: $(SUBMAKES)
af> test -z "$(SUBMAKES)" || for sub in "$(SUBMAKES)"; do \
af> $(MAKE) -f $$sub $@; \
af> done
af> This feels so awkward to me. How do others deal with this?
"Others" don't use this model at all. I much prefer to use make targets
to handle subdirectories; the disadvantages of using a loop like this
are many and serious (IMO). There is a discussion of this in the GNU
make manual, section on "Phony Targets".
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist