This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH] tools top level makefile cleanup

On Wednesday 23 March 2005 12:01, Adam Heath wrote:
> install: $(patsubst %,install.%,$(SUBDIRS))
> $(patsubst %,install.%,$(SUBDIRS)): install.%: CMD := install
> all: $(patsubst %,all.%,$(SUBDIRS))
> $(patsubst %,all.%,$(SUBDIRS)): all.%: CMD := all
> $(foreach cmd,all install,$(patsubst %,$(cmd).%,$(SUBDIRS))):
>  $(MAKE) -C $* $(CMD)

The following is working for me and I think easier to read than the above:
CLEANDIRS := $(addprefix _clean_,$(SUBDIRS))


all: $(SUBDIRS)
clean: $(CLEANDIRS)

 $(MAKE) -C $(patsubst _clean_%,%,$@) clean

 $(MAKE) -C $@

Well, I guess it's not very dissimilar after all.

But I really don't like that for every command to recurse with (e.g. clean), 
you must add more hackery to the Makefile. Your snippet has the same problem 
(let's add "clean"...), and it seems all the Makefiles have all the issues 
discussed in different places.

Is there really no better way to solve this problem?

Hollis Blanchard
IBM Linux Technology Center

This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content.  Register
by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click
Xen-devel mailing list