|
Keeping source and generated files separate eases
file management when multiple target architectures are involved.
There are several ways to do this:
-
Make a complete copy of the source tree for each architecture:
although easy to manage, this technique is not space efficient.
And, since there are multiple copies of the source,
it's hard to keep the separate source copies from diverging.
-
Make architecture specific subdirectories for each source tree leaf directory:
this is much more space efficient since all architectures share one
copy of the source.
However, isolating the files for one particular architecture is non-trivial,
since architecture specific directories are distributed throughout the
entire source tree.
package-root
. . .
. . .
. . .
. . .
. . .
. . .
. . .
bin lib src
. . . . . .
. . . . . .
A1 A2 A1 A2 lib cmd
. .
. .
. .
. .
libar foo
. . . .
. . . .
A1 A2 A1 A2
-
Make a directory tree copy of the source tree (just directories, no files)
for each architecture and make a symlink in the copy for each regular file
in the source tree: this is space efficient and isolates the architecture
specific files under a separate tree.
It is too easy, however, to clobber original source files from within
the architecture specific trees.
-
Make a directory tree copy of the source tree (just directories, no files)
for each architecture and viewpath the architecture tree on top of the
source tree:
this is space efficient and safely separates source from generated files.
package-root
. .
. .
. .
src arch
. . . .
. . . .
lib cmd . .
. . A1 A2
. . . .
. . . .
libar foo . .
src src
. . . .
. . . .
lib cmd lib cmd
. . . .
. . . .
libar foo libar foo
Viewpathing also allows multiple source trees to be chained together;
this means that source from separate package root directories can be shared.
This technique is useful for separating local master package root trees
from external package roots. Multi-level viewpaths can be specified on the
package(1)
command line by assigning a
:
separated list of root directories to the
VPATH
variable:
VPATH=installroot:master:external-1:external-2
If the local host supports DLL preload then the
3d(1)
command can be used to provide a transparent viewpath view to all
dynamically linked commands.
|