How to build kernel module spread on subdirectories?

Nikola Knežević laladelausanne at gmail.com
Tue Dec 2 07:25:27 PST 2008


On 2 Dec 2008, at 13:33 , Dag-Erling Smørgrav wrote:

> perryh at pluto.rain.com writes:
>> <heresy> Provided the module in question is contemplated for delivery
>> as a port, rather than as part of the base -- so that having a build
>> dependency on a port is tolerable -- perhaps it would be more easily
>> built using devel/gmake? </heresy>
>
> You'd have to reproduce most of /usr/share/mk/*.mk in gmake syntax.

That was the main reason why I decided to switch to make :) I had  
problems with CFLAGS set in that GNUmakefile, so I wanted to extract  
CFLAGS used to build the rest of the kernel. And it works now, without  
any problems :)

To answer the other question in other email: yes, that file needs to  
be generated, or I would need to regenerate it whenever I add a new  
element... Which I may forget... So, this is what I ended up using:
<snip til the end>
.MAKEFILEDEPS: elements.mk

beforedepend: elements.mk

.if make(depend) && !exists(${.CURDIR}/elements.mk)
.warning "You should first generate elements.mk"
afterdepend:
         rm -f .depend
         $(MAKE) depend
.endif

.sinclude "elements.mk"
.include <bsd.kmod.mk>

Cheers,
Nikola


More information about the freebsd-hackers mailing list