Next: Defining Directories, Previous: Automatic Remaking, Up: Autoconf FAQ [Contents][Index]
You can support compiling a software package for several architectures simultaneously from the same copy of the source code. The object files for each architecture are kept in their own directory.
To support doing this, make
uses the VPATH
variable to
find the files that are in the source directory. GNU Make
can do this. Most other recent make
programs can do this as
well, though they may have difficulties and it is often simpler to
recommend GNU make
(see VPATH and Make). Older
make
programs do not support VPATH
; when using them, the
source code must be in the same directory as the object files.
If you are using GNU Automake, the remaining details in this
section are already covered for you, based on the contents of your
Makefile.am. But if you are using Autoconf in isolation, then
supporting VPATH
requires the following in your
Makefile.in:
srcdir = @srcdir@ VPATH = @srcdir@
Do not set VPATH
to the value of another variable (see Variables listed in VPATH.
configure
substitutes the correct value for srcdir
when
it produces Makefile.
Do not use the make
variable $<
, which expands to the
file name of the file in the source directory (found with VPATH
),
except in implicit rules. (An implicit rule is one such as ‘.c.o’,
which tells how to create a .o file from a .c file.) Some
versions of make
do not set $<
in explicit rules; they
expand it to an empty value.
Instead, Make command lines should always refer to source files by prefixing them with ‘$(srcdir)/’. It’s safer to quote the source directory name, in case it contains characters that are special to the shell. Because ‘$(srcdir)’ is expanded by Make, single-quoting works and is safer than double-quoting. For example:
time.info: time.texinfo $(MAKEINFO) '$(srcdir)/time.texinfo'
Next: Defining Directories, Previous: Automatic Remaking, Up: Autoconf FAQ [Contents][Index]