Bug in make(1)?
Dimitry Andric
dim at xs4all.nl
Thu Apr 3 16:04:12 PST 2003
On 2003-04-03 at 23:23:00 Pawel Jakub Dawidek wrote:
> IMHO make(1) should put .o files in current directory _and_ look for
> them there when producing an executable file. Right?
I think this is more of a gcc/g++ problem/feature. :) The info page
says:
If `-o' is not specified, the default is to put an executable file
in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its
assembler file in `SOURCE.s', and all preprocessed C source on
standard output.
So at first glance I would say: "gcc -c some/weird/path/file.c"
outputs the file "some/weird/path/file.o". But it doesn't, it puts
the object file in the current directory... This is probably a
feature, and if you change it, I guess a lot of stuff will break. :)
Therefore, the simplest solution is to specify -o options everywhere.
I've attached a patch for /usr/share/mk/sys.mk that does this, but
please beware, it might break stuff which *expects* output files to
always be put in the current directory.
OTOH, make(1) itself seems to be consistent with relative pathnames;
if you tell it a rule to create .b files from .a files, it will
correctly try to use that rule to convert some/path/file.a into
some/path/file.b (and NOT ./file.b).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sys.mk.diff
Type: application/octet-stream
Size: 2042 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20030404/118b2e04/sys.mk.obj
More information about the freebsd-hackers
mailing list