help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using define to generate dynamic install targets


From: Garrett Cooper
Subject: Using define to generate dynamic install targets
Date: Sat, 25 Jul 2009 12:24:41 -0700

Hi make folks,

    I'm working revising the Makefiles for LTP and I am running into a
bit of a technical snaggle. When I'm trying to define a generic eval
target, like so (lines 69-75):

define generate_install_rule
$$(dir $$(1)):
        mkdir -p $$@

$$(1): $$(dir $$(1))
        install -m $$(INSTALL_MODE) "$$(2)/$$(@F)" "$$@"
endef

     It seems like it should work. It doesn't however called from my
eval / call below (lines 154-156), as well as an adhoc rule I wrote.
The former code can be found here:

# XXX (garrcoop): Doesn't work [now]. See generate_install_rule for more
# details.
#$$(foreach install_file,$$(eval $$(call
generate_install_rule,$$(install_file))),$$(INSTALL_FILES))

    Thus, every time I call that, as opposed to this less flexible logic:

$$(INSTALL_FILES): %: | $$(INSTALL_DEPS) $$(builddir)/$$(@F)
        install -m $$(INSTALL_MODE) $$(builddir)/$$(@F) $$@

    $(1) evaluates to an empty value in generate_install_rule. I'm not
sure what I possibly could be doing wrong, other than using := instead
of = -- could someone illuminate this problem for me?
    For reference, the CVS version of the file is available at:
<http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/include/mk/master_rules.mk?revision=1.1.2.7&view=markup&pathrev=makefile_infra_rework>.

Thanks!
-Garrett




reply via email to

[Prev in Thread] Current Thread [Next in Thread]