help:Makefile template for device drivers with multiple directories

Hans Petter Selasky hselasky at c2i.net
Fri Jun 9 08:12:10 UTC 2006


On Friday 09 June 2006 04:16, hongz at promisechina.com wrote:
> My problem seems to be very special. My driver module is a single one, but
> I want to build only one object for each directory (such as osd.o: osd/*.c;
> engine.o: engine/*.c; cam.o:cam/*.c). And my driver module (such as
> Shasta.ko) is constructed only by osd.o, engine.o and cam.o. I need to do
> this because we want each component (engine, cam, and osd) more
> independent. Otherwise, I have to consider the issues such as naming
> conflicts and so on. Is it possible to do so under FreeBSD?
>

You mean object naming conflicts or symbol naming conflicts?

If you have symbol naming conflicts, then you have to rename the 
functions/procedures. Else it won't be possible to link the module.

If you have object naming conflicts, then I think you either have to rename 
the file names, or make a customized Makefile. It is the same in the FreeBSD 
kernel. All object files have different names.

Maybe something similar to the following will do:

SRCS+= osd.o engine.o

osd.o:
 ${CC} -o osd.o ${.CURDIR}/osd/*".c"

engine.o:
 ${CC} -o engine.o ${.CURDIR}/engine/*".c"

--HPS


More information about the freebsd-hackers mailing list