Date: Thu, 28 Nov 2024 18:20:27 +0200
On Thu, 28 Nov 2024 at 17:12, Boris Kolpackov <boris_at_[hidden]> wrote:
> > When foo.cc is compiled for e1, the extra files go to e1's private
> > directory (it has to be compiled a second time as the flags might be
> > different).
>
> Or they might not in which case it's perfectly valid to link the same
> object file to several executables. Here it is expressed in make:
>
> e1: foo.o
> e2: foo.o
> foo.o: foo.cc
If you are creating makefiles by hand, then _you_ need to specify the
compiler flag to specify where the private directory is. Or, if your
chosen way of compiling code does not conform to this way, leave out
the compiler flag. In that case nothing changes and you can carry on
doing things as you have always done.
> In other build systems it's not a special case and nobody needs to
> commit any crimes. In build2, for example, there is no conceptual
> difference between object targets and library targets and just as
> you can list the same library target as a prerequisite of multiple
> executables, so you can do it with the same object target.
And in this case build2 could create a private directory for the
object target and one for the library target. When compiled, that is
where the files would go.
> > When foo.cc is compiled for e1, the extra files go to e1's private
> > directory (it has to be compiled a second time as the flags might be
> > different).
>
> Or they might not in which case it's perfectly valid to link the same
> object file to several executables. Here it is expressed in make:
>
> e1: foo.o
> e2: foo.o
> foo.o: foo.cc
If you are creating makefiles by hand, then _you_ need to specify the
compiler flag to specify where the private directory is. Or, if your
chosen way of compiling code does not conform to this way, leave out
the compiler flag. In that case nothing changes and you can carry on
doing things as you have always done.
> In other build systems it's not a special case and nobody needs to
> commit any crimes. In build2, for example, there is no conceptual
> difference between object targets and library targets and just as
> you can list the same library target as a prerequisite of multiple
> executables, so you can do it with the same object target.
And in this case build2 could create a private directory for the
object target and one for the library target. When compiled, that is
where the files would go.
Received on 2024-11-28 16:20:40