From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 30 22:57:11 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 676DE106564A for ; Sun, 30 Nov 2008 22:57:11 +0000 (UTC) (envelope-from laladelausanne@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.153]) by mx1.freebsd.org (Postfix) with ESMTP id E20728FC13 for ; Sun, 30 Nov 2008 22:57:10 +0000 (UTC) (envelope-from laladelausanne@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so1558863fgb.35 for ; Sun, 30 Nov 2008 14:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:references:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:cc:x-mailer; bh=oPbMcGsMg0nj6xB23pM/SFTGNr9501ghevvC0jA0/m8=; b=gYYVkfjAFjVhCNDRA87bhp9YwP0AW+TzDsccjfgt99nNgyuQes+LbxOW8dBDhSYs0a mFsF8qSD62ZyvlloQFqH5HEFLv/u4zolkqvgivhPi2M6+N449Ruh811HgS1OW8mJujxg toidw5LQjdIVDlHtIA5+APNDDI48R+25H1grM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:cc:x-mailer; b=d/ADRX+YnkqKwL9uaP5zn1iQachc4c9NKKs7AxARWvN9yfTN1xWepHZDsYLUSDh1Gq PY/KL89waBnqDckOc93y7EL8UTJ6ucRn1nGHhiZcwJCI7ljMMvLYlvmcpDdEDRuZNtlK r6vOg5Oy5IeOVIIWo/6cnwKDMtoKthZHhaupo= Received: by 10.181.234.5 with SMTP id l5mr3693364bkr.124.1228085829601; Sun, 30 Nov 2008 14:57:09 -0800 (PST) Received: from ?192.168.1.11? (dyn.144-85-148-114.dsl.vtx.ch [144.85.148.114]) by mx.google.com with ESMTPS id b17sm7906903fka.27.2008.11.30.14.57.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 30 Nov 2008 14:57:08 -0800 (PST) References: <711D7381-D852-4B6B-991A-84BA6DEFB679@gmail.com> <2A1A4C21-8A2D-4151-BCA0-5FAE1D3BBE86@gmail.com> <200811301843.28564.fbsd.hackers@rachie.is-a-geek.net> Message-Id: <94D09AB0-86B6-4D91-BD61-AB02A12CC260@gmail.com> From: =?UTF-8?Q?Nikola_Kne=C5=BEevi=C4=87?= To: Mel In-Reply-To: <200811301843.28564.fbsd.hackers@rachie.is-a-geek.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Sun, 30 Nov 2008 23:57:07 +0100 X-Mailer: Apple Mail (2.929.2) Cc: freebsd-hackers@freebsd.org Subject: Re: How to build kernel module spread on subdirectories? 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: Sun, 30 Nov 2008 22:57:11 -0000 On 30 Nov 2008, at 18:43 , Mel wrote: >> since there were no replies, I went into the various .mk's, and I >> found some inconsistencies when building modules. If you have a file >> in a different directory, below the directory where you BSDmakefile >> is, objects won't be linked nor cleaned properly. > > The base of the FreeBSD build system, is that SRCS contains file > names. Not > pathnames. Use .PATH directive if sources are elsewhere. This is the > only Hi Mel, thanks for the clarification. I didn't know that SRCS has to contain only filenames. > thing you cannot easily change and should not globally change. A > simple > example of this is sbin/fsdb/Makefile which uses sources from sbin/ > fsck_ffs. > > If you really need it, you should override compilation rules in your > own > BSDmakefile, like so: > .c.o: > ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} > > .cpp.o: > ${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} > So, I'm now using only filenames in SRCS and the .PATH target. As I described in my initial mail, I have to use two makefiles. One is the main Makefile, while the other has to be generated. In the generated .mk, I add to the SRCS, and I create the .PATH target with other (necessary) directories. Unfortunately, make depend doesn't work as it should be. This is the important snippet of my BSDmakefile: ---8<--- elements.mk: elements.conf $(CLICKDIR)/click-buildtool elem2make --bsd elements.conf > elements.mk .MAKEFILEDEPS: elements.mk .sinclude "elements.mk" .include --->8--- When I run make depend, it only includes SRCSs from BSDmakefile, not those from elements.mk. Is there a way to overcome this? I can manually run make elements.mk, but it is a bit tedious. Cheers, Nikola