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

_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to