From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 9 08:12:10 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B3FF316A41A for ; Fri, 9 Jun 2006 08:12:10 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from mail45.e.nsc.no (mail45.e.nsc.no [193.213.115.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id D929943D73 for ; Fri, 9 Jun 2006 08:12:09 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from Unknown-00-c0-9f-49-78-d8.lan (ti131310a080-10195.bb.online.no [85.165.231.211]) by mail45.nsc.no (8.13.6/8.13.5) with ESMTP id k598C8wM008044; Fri, 9 Jun 2006 10:12:08 +0200 (CEST) From: Hans Petter Selasky To: hongz@promisechina.com Date: Fri, 9 Jun 2006 10:11:21 +0200 User-Agent: KMail/1.7 References: <1149819363$61755$89298172@hongz@promisechina.com> In-Reply-To: <1149819363$61755$89298172@hongz@promisechina.com> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200606091011.23951.hselasky@c2i.net> Cc: freebsd-hackers@freebsd.org, 'Artem Ignatiev' Subject: Re: help:Makefile template for device drivers with multiple directories X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jun 2006 08:12:10 -0000 On Friday 09 June 2006 04:16, hongz@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