Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Apr 1997 19:44:18 +1000
From:      David Nugent <davidn@labs.usn.blaze.net.au>
To:        freebsd-current@freebsd.org
Subject:   Object directories and source files from other directories
Message-ID:  <199704260944.TAA25499@labs.usn.blaze.net.au>

next in thread | raw e-mail | index | archive | help
I have a an interesting problem which I'd like some advice on.

I wish to introduce into ftpd the ability to compile it with an
internal '/bin/ls'[*]. In fact, FreeBSD's ls - linked into ftpd
with main() from ls renamed to something more appropriate.
Source files should come from ../../bin/ls relative to libexec/ftpd
from within the source tree.

Now, the problem is this. I wish to use these files directly, but
simply putting them, including the path, into the SRCS= macro
will cause the objects to be taken from /usr/obj/usr/src/bin/ls,
but I wish to compile them separately and put them into ftpd's
object directory instead.

I want to avoid overriding pre-defined make rules, and I
think it would be wrong to start fooling with individual recipies
for each file (or a single recipe for all the bin/ls source files
- whatever). This should all come from the standard bsd.prog.mk.
The best I've come up with so far is to cp the files from src/bin/ls
to ftpd-*.c (dumping them into the object directory, naturally),
add -I${.CURDIR}../../bin/ls to CFLAGS to pick up the ls include
files and compiling it that way.

Ok, it achieves the result, but what I'd prefer to do is find some
way of expressing a dependancy between a source file in a foreign
directory and a .o in the object directory without overriding the
default make recipe.

So - a question to our bmake gurus. Is there an easy way of doing
this?


Regards,
David

[*] Note: internal ls won't be the default. You will enable it by
using /etc/make.conf and defining "FTPD_INTERNAL_LS=yes", or setting
it in the environment or something similar. This is really very useful
for ftp into chroot'ed environments, and significantly minimizes
maintenance and ease of setting up. So much so, that I think this is
a *very* worthwhile addition to the base tree, and the only real
cost is some conditionals in the ftpd Makefile and a few very minor
source diffs.

David Nugent - Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-9791-9547  Data/BBS +61-3-9792-3507  3:632/348@fidonet
davidn@freebsd.org davidn@blaze.net.au http://www.blaze.net.au/~davidn/





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704260944.TAA25499>