On Saturday 29 November 2008 12:40:47 Nikola Knežević wrote:
> On 25 Nov 2008, at 15:20 , Nikola Knežević wrote:
> > I tried to move from OBJS into SRCS (main BSDmakefile now has: SRCS+=
> > $(ELEMENT_SRCS)), by using something like:
> > # subdir0
> > ELEMENT_SRCS__x =\
> > subdir1/file0.cc \
> > subdir1/file1.cc
> >
> > ...
> >
> > But this fails during the linking phase, because the linker is
> > called with subdir1/file0.o, instead of just file0.o.
> >
> > To make something clear, I didn't just rewrite the GNUmakefile to
> > BSDmakefile, I also followed some of the logic used to build kernel
> > modules. I'm including bsd.kmod.ko, list sources in SRCS, don't have
> > any explicit rule to build .o out of .cc/.c. There is no all:
> > target, as well.
>
> Hi,
>
> 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 
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}


As a general rule, a directory should contain "one project", use bsd.subdir.mk 
to descend.
Absolute paths in a Makefile only work on YOUR machine, so don't do it.
-- 
Mel
_______________________________________________
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