Debian Codegraph @

README-12-vpath-builds

raw
1
2 The default build of GNU APL creates only the APL interpreter binary
3 aka. src/apl. This is assumed to be what the majority of GNU APL users
4 need in the first place.
5
6 This default build places all intermediate files - mostly .o files
7 from the corresponding .cc files into the same directory (src) as
8 the source files. If GNU APL is re-configured after the first build,
9 the intermediate files from the previous build are overwritten with
10 - possibly different - intermediate files having the same names and
11 this can, depending on the ./configure options that were used, lead to
12 a dubious mix of object files built with different ./configure options.
13
14 Also, if the same target, say src/apl, is built several times with
15 different ./configure options then the previous src/apl versions are
16 lost and the user has to (manually) copy them to some other place where
17 they are not overwritten.
18
19 To avoid the above complications, GNU APL supports the so-called
20 "VPATH builds", which are a feature of the Autoconf build system used
21 by GNU APL.
22
23 The difference between the default build and a VPATH build is this: the
24 default build places all object files and the final result (i.e. file apl,
25 libapl.so, or lib_gnu_apl.so) into the sub-directory src of the top-level
26 directory, while a VPATH build places these files into a sub-directory
27 chosen (and created) by the user. As a consequence, if a user wants to
28 build different configurations in one go (i.e. without the need to copy
29 the build results between different builds) then she can do so by creating
30 different directories for the different builds and then executing the
31 build in the different directories. The total build time increases a little
32 because every object file is recompiled in every build while some of
33 them may be re-used in a standard build.
34
35 A VPATH build is, in principle, performed like this:
36
37 cd <top-level-apl-directory>
38 mkdir my_build_directory
39 cd my_build_directory
40 ../configure
41 make
42
43 However, the following considerations are required:
44
45 A. the build directory chosen for the VPATH build needs to be located below
46 the top-level APL directory and (currently) not deeper than four directory
47 levels. A commom choice is a directory named 'obj' in the top-level
48 directory.
49
50 B. The top-level APL directory and its sub-directory 'src' must be "fresh",
51 i.e. must not have been polluted by non-VPATH builds before a VPATH
52 build. A prior non-VPATH build will cause the subsequent VPATH build to
53 (incorrectly) "believe" that the object files in the 'src' directory (from
54 the non-VPATH build) need not be recompiled (even though these files
55 should now be in the 'src' directory of the VPATH build directory.
56
57 The following "hack" to fix a polluted top-level directory seems work:
58
59 cd <top-level-apl-directory>
60 ./configure # so that src/Makefile exists
61 make -C src clean # otherwise some object files will be missing
62 rm config.status # otherwise configure will complain
63
64 After a previous (non-VPATH) ./configure (in the top-level GNU APL
65 directory) the same can be achieved with 'make VPATH_clean'
66
67 An example for VPATH builds is the script build/build_all