Received: by taz.hyperreal.com (8.8.4/V2.0) id CAA29532; Fri, 21 Mar 1997 02:44:19 -0800 (PST) Received: from paris.ics.uci.edu by taz.hyperreal.com (8.8.4/V2.0) with SMTP id CAA29524; Fri, 21 Mar 1997 02:44:15 -0800 (PST) Received: from kiwi.ics.uci.edu by paris.ics.uci.edu id aa20619; 21 Mar 97 2:39 PST To: new-httpd@hyperreal.com Subject: Re: [PATCH] "make clean" bombs if no subdirectory modules are used In-reply-to: Your message of "Fri, 21 Mar 1997 05:28:07 EST." <333262B7.6201DD56@topsail.org> Date: Fri, 21 Mar 1997 02:39:14 -0800 From: "Roy T. Fielding" Message-ID: <9703210239.aa20619@paris.ics.uci.edu> Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com In message <333262B7.6201DD56@topsail.org>, Chuck Murcko writes: >What I have here is the generic BSD make. It looks like the %.build is >expanding OK, just that the target seems to be an orphan. It looks like >a .SUFFIX problem. > >What if you just do this? > >clean: > (if [ "$(MODULES)" != "" ]; then\ > for dir in $(MODULES); do \ > cd $$dir; $(MAKE) clean; \ > cd ..; \ > done \ > fi) > >and you can do the same for the default target if that's also a problem >when $(MODULES) is empty. That's what I tried to do first -- it doesn't work because the shell interprets the entire command and pukes on the "unexpected ;" before it executes the if. Here is another version that may be more portable with old makes. .....Roy Index: Configure =================================================================== RCS file: /export/home/cvs/apache/src/Configure,v retrieving revision 1.82 diff -c -r1.82 Configure *** Configure 1997/03/18 10:23:53 1.82 --- Configure 1997/03/21 10:35:24 *************** *** 590,609 **** awk >> modules/Makefile < $tmpfile '\ BEGIN {printf "MODULES="} \ ! ($3 ~ /modules\//) {split ($3, pp, "/"); printf "%s ", pp[2]} \ END {printf "\n"}' cat << EOF >> modules/Makefile ! default: ! (for dir in \$(MODULES); do \\ ! cd \$\$dir; \\ ! \$(MAKE) CC=\$(CC) AUX_CFLAGS='\$(MOD_CFLAGS)' RANLIB='\$(RANLIB)'; \\ ! cd ..; \\ ! done) ! ! clean: ! (for dir in \$(MODULES); do \\ ! cd \$\$dir; \$(MAKE) clean; \\ ! cd ..; \\ ! done) EOF --- 590,616 ---- awk >> modules/Makefile < $tmpfile '\ BEGIN {printf "MODULES="} \ ! ($3 ~ /modules\//) {split ($3, pp, "/"); printf "%s.build ", pp[2]} \ END {printf "\n"}' + + awk >> modules/Makefile < $tmpfile '\ + BEGIN {printf "CLEANERS="} \ + ($3 ~ /modules\//) {split ($3, pp, "/"); printf "%s.clean ", pp[2]} \ + END {printf "\n"}' + cat << EOF >> modules/Makefile ! default: \$(MODULES) ! @echo "done building module subdirectories" ! ! clean: \$(CLEANERS) ! @echo "done cleaning module subdirectories" ! ! .SUFFIXES: .build .clean ! ! \$(MODULES): ! (cd \$*; \$(MAKE) CC=\$(CC) AUX_CFLAGS='\$(MOD_CFLAGS)' RANLIB='\$(RANLIB)') ! ! \$(CLEANERS): ! (cd \$*; \$(MAKE) clean) EOF