On 7 August 2013 18:52, Jon Medhurst (Tixy) tixy@linaro.org wrote:
E.g. in a Makefile to have
obj-$(CONFIG_FOO) += common-thing.o foo.o obj-$(CONFIG_BAR) += common-thing.o bar.o
where both FOO and BAR can be enabled at the same time?
I have been in this kind of problems earlier..
Looks a bit suspect to me. My instinct would be to invent CONFIG_BAZ to compile common-thing.o and make FOO and BAR select it.
This is the best I would say.
Or possibly some makefile conditional OR expression I can't think of off the top of my head.
In this case you need to use CONFIG_FOO twice.. It would be something like this (obviously syntax is broken):
obj-$(CONFIG_FOO) += foo.o obj-$(CONFIG_BAR) += bar.o obj-$(CONFIG_FOO OR CONFIG_BAR) += common-thing.o
I would prefer the first approach compared to this one. And second is probably the best.