Date: Sun, 30 Nov 2008 23:57:07 +0100 From: =?UTF-8?Q?Nikola_Kne=C5=BEevi=C4=87?= <laladelausanne@gmail.com> To: Mel <fbsd.hackers@rachie.is-a-geek.net> Cc: freebsd-hackers@freebsd.org Subject: Re: How to build kernel module spread on subdirectories? Message-ID: <94D09AB0-86B6-4D91-BD61-AB02A12CC260@gmail.com> In-Reply-To: <200811301843.28564.fbsd.hackers@rachie.is-a-geek.net> References: <711D7381-D852-4B6B-991A-84BA6DEFB679@gmail.com> <2A1A4C21-8A2D-4151-BCA0-5FAE1D3BBE86@gmail.com> <200811301843.28564.fbsd.hackers@rachie.is-a-geek.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <bsd.kmod.mk>
--->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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?94D09AB0-86B6-4D91-BD61-AB02A12CC260>
