bug-make
[Top][All Lists]
Advanced

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

[bug #30370] add a shorthand syntax for foreach-eval-call


From: Olexiy Buyanskyy
Subject: [bug #30370] add a shorthand syntax for foreach-eval-call
Date: Sat, 17 Jul 2010 15:31:34 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4

Follow-up Comment #6, bug #30370 (project make):

Interesting to findout which way will work faster. Many generated pattern
rules? or PAttern rule with multiple masks

But in general I agree with Paul and Boris. Current make is flexible enough
to generate common parts
Let me give you real life example of power of make

# build/ase/%.c => build/xlc/%.sc.o
$(eval $(call
qib_compiler_generate_object_rules,c,$(qib_ase_tgt_dir),$(qib_ase_src_suffix)))

# %.cpp => build/xlc/%.cpp.o
$(eval $(call
qib_compiler_generate_object_rules,cxx,,$(qib_cxx_src_suffix)))

# %.c => build/xlc/%.c.o
$(eval $(call qib_compiler_generate_object_rules,c,,$(qib_c_src_suffix)))

#
qib_compiler_generate_object_rules=
$(foreach qib_compiler_type_,$(qib_compiler_supported_types),
  $(foreach qib_compiler_variant_,$(qib_compiler_supported_variants),
    $(call
qib_compiler_object_rule,$1,$2,$(QIB_DATABASE),$(qib_compiler_type_),$(qib_compiler_variant_),$3)
  )
)

# define gets 6 parameters!!!
define qib_compiler_object_rule

$$(qib_compiler_$4_dir)$5/%$6$$(qib_compiler_obj_suffix) :
qib_real_source=$$(patsubst
$$(qib_compiler_$4_dir)$5/%$$(qib_compiler_obj_suffix),%,$$(@))

$$(qib_compiler_$4_dir)$5/%$6$$(qib_compiler_obj_suffix) :
$2%$$(qib_$1_src_suffix)
        $$(call qib_debug_echo,$1,
          $$(if $$(qib_coverage_tgt_dir),$$(qib_posix_mkdir) $$(dir $$(@)) &&)
          $$(call qib_$1_$4_make,$$(@),$$(<),$5,$3)
        )

$$(qib_compiler_$4_dir)$5/%$6$$(qib_compiler_obj_suffix).out ::
$$(qib_compiler_$4_dir)$5/%$6$$(qib_compiler_obj_suffix)


endef




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30370>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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