Hello,

I have constructed the following small script to be executed by the program
“GNU Make 4.2.1-1.7” on my openSUSE Tumbleweed system.


define rule_pair =
name::=$(1)
$$(name:.ml=.cmo): $$(name)
        $$(OCAMLC_CMD) -c $$<

$$(name:.ml=.cmx): $$(name)
        $$(OCAMLOPT_CMD) -c $$<
endef

$(foreach x,$(SRC_without_mli),$(eval $(call rule_pair,$(x))))


I guess that the functionality from this approach is similar to the usage
of two specific suffix rules.
But I would like to distinguish the involved software dependencies better.


I imagine that it would be nice to improve the shown implementation details.

1. I am using the extra variable “name” just for the reuse of the make
   functionality “substitution references”. I would prefer to append desired
   file name suffixes directly instead of replacing a previous one.
   Can the passed text list become a bit smaller eventually?

2. The specification “$$(name)” is working. Would it make sense to avoid
   such a variable reference there?
   Unfortunately, the simple specification “$(1)” does not work in the way
   I would expect for the selection of a single file as a dependency.
   Would you like to explain this software behaviour?

Regards,
Markus

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

Reply via email to