[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multiple instance of target but with potentially different dependencies
From: |
Koehler, Yannick (HP Networking) |
Subject: |
Multiple instance of target but with potentially different dependencies |
Date: |
Thu, 18 Oct 2012 16:25:04 +0000 |
Hi,
I am looking for advance make usage help, we are building a software based on
a set of modules. The same modules exist in many variance of our product and
we use a single make to build all variances. So for example we have a linux
and windows platform and both need the module A and module B. And module B
depends on module A.
moduleB: moduleA
Since we have these modules for each platform it looks like this:
platformA: platformA.moduleA platformA.moduleB
platformB: platformB.moduleA platformB.moduleB
platformA.moduleB: platformA.moduleA
platformB.moduleB: platformB.moduleA
Since the module dependency isn't tie to the platform, but tie to the module,
we built a script to generate the make on the fly for the module dependency:
$(platform).moduleA: $(platform).moduleB
This in turn works fine but we are now dependent on bash to generate the
makefile. Also, we have more platform than what is being describe here, and we
now are starting to get platform that do not have the same module and therefore
the module dependency is getting complex to manage. For example let's say that
moduleB doesn't exists in platformB, and it does on platformA, and on platformA
the moduleB is still dependent on platformA.moduleA we then have to manually
specify the rules:
platformA: platformA.moduleA platformA.moduleB
platformB: platformB.moduleA
platformA.moduleB: platformA.moduleA
And we do not benefit anymore from our bash script. Considering the amount of
platform and modules this is tedious and I was looking for an alternative way
to specify those complex relation without depending on bash for example.
You could also see platformA as platformTypeA, platformTypeB where
platformA: platformTypeA platformTypeB
platformB: platformTypeB
platformTypeA: platformA.moduleA platformA.moduleB
platformTypeB: platformB.moduleA
Then basically I want to express that moduleB depends on moduleA, only when the
platformTypeA is involved, in the case of platformTypeB, the same moduleB has
no dependency over moduleA. This platformtype specific dependency are known
inside the module, so the moduleB's makefile know to not link with moduleA when
on platformTypeB.
The approach I took may be totally wrong, so I am open to creative suggestions.
We did think about always putting the dependency in there and simply do
nothing at compile time inside moduleA for platformTypeB but that was not
intuitive when creating new module the developer need to be teach about this
and it also doesn't provide a clear dependency graph, we also then end-up
having 2 locations for managing dependency, one for satisfying Makefile syntax
and behavior and another one to go around it.
--
Yannick Koehler
- Multiple instance of target but with potentially different dependencies,
Koehler, Yannick (HP Networking) <=