On Fri, Dec 4, 2009 at 4:03 PM, Jiří Paleček <[email protected]> wrote:
> On Fri, 04 Dec 2009 20:13:11 +0100, Mike Frysinger <[email protected]>
> wrote:
>
>> On Friday 04 December 2009 12:04:06 Jiri Palecek wrote:
>>> -.PHONY: $(RECURSIVE_TARGETS) $(addprefix trunk-,$(RECURSIVE_TARGETS))
>>> +.PHONY: $(RECURSIVE_TARGETS) $(addprefix trunk-,$(RECURSIVE_TARGETS))
>>>  $(foreach tgt,$(RECURSIVE_TARGETS),$(addprefix
>>>  trunk-subdir-$(tgt)--,$(SUBDIRS)))
>>
>> these foreach look like an overly complicated form of $(patsubst):
>>       $(patsubst %,moo_%,$(DIRS))
>
> It may look like it, but they aren't. What you've written is a simple
> addprefix, while the foreach does some for of cartesian product
> ($(TARGETS)x$(DIRS)).

1. I checked in the fixes for the autotools targets after verifying
them (thank you btw!).
2. Inline mkdirs are bad, because mkdir's can fail or cause failures
over NFS due to excessive I/O, which is why I quickly removed the test
-d || mkdir -p logic in the 2nd major draft of the makefile
infrastructure.
3. Although your idea for fixing the lack of recursive make'ing is
good, what about this instead?

#
# A canned set of operations for leaf makes. This creates a series of
targets, like:
#
# $(subdir)-all $(subdir)-clean $(subdir)-install:
#
# 1 - Recursive targets to act upon.
# 2 - the subdirectory to do the leaf_make on.
#
define generate_dir_dep
ifndef __$(1)_dir_dep__
__$(1)_dir_dep__ = 1
$(1):
        mkdir -p "$$@"
endif
endif

define leaf_make
$$(foreach recursive_target,$(1),$$(addprefix
$(2)-$$(recursive_target))): $(1)-%: $(2)
      $(MAKE) -C $* -f ""$(abs_srcdir)/$$*/Makefile" $$(patsubst $(1)-%,%,$$@)
endef
$(foreach subdir $(SUBDIRS),$(eval $(call generate_dir_dep,$(subdir))))
$(foreach subdir,$(SUBDIRS),$(eval $(call leaf_make
$(RECURSIVE_TARGETS),$(subdir))

Ultimately I suppose, it's another means to a similar end. It's just a
bit more discrete as to what's going on in the operation... if this is
a good idea, I'll modify functions.mk to match this. $(abspath) //
$(realpath) junk is already a PITA, so it might be a good idea just to
remove it in favor of keeping things as-is.

Thanks,
-Garrett

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to