[Top][All Lists]

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

Checking alternatives for a dynamic make rule construction

From: SF Markus Elfring
Subject: Checking alternatives for a dynamic make rule construction
Date: Thu, 15 Jun 2017 17:18:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0


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:.ml=.cmo): $$(name)
        $$(OCAMLC_CMD) -c $$<

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

$(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?


reply via email to

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