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/


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to