Format of the configuration file
This section describes the rules that can be present in the file that is processed by fpcmake.
The file Makefile.fpc is a plain ASCII file that contains a number of predefined sections as in a Windows.ini-file, or a Samba configuration file.
They look more or less as follows:
[package] name=mysql version=1.0.5 [target] units=mysql_com mysql_version mysql examples=testdb [require] libc=y [install] fpcpackage=y [default] fpcdir=../..
The following sections are recognized (in alphabetical order):
clean
Specifies rules for cleaning the directory of units and programs. The following entries are recognized:
- units
-
Names of all units that should be removed when cleaning. Don’t specify extensions, the makefile will append these by itself.
- files
-
Names of additional (not unit files) files that should be removed. Specify full filenames. The resource string table files (
.rstfiles) are cleaned if they are specified in thefilessection.
compiler
In this section values for various compiler options can be specified, such as the location of several directories and search paths.
The following general keywords are recognised:
- options
-
The value of this key will be passed on to the compiler (verbatim) as command line options.
- version
-
If a specific or minimum compiler version is needed to compile the units or programs, then this version should be specified here.
The following keys can be used to control the location of the various directories used by the compiler:
- unitdir
-
A colon-separated list of directories that must be added to the unit search path of the compiler (using the
-Fuoption). - librarydir
-
A colon-separated list of directories that must be added to the library search path of the compiler (using the
-Floption). - objectdir
-
A colon-separated list of directories that must be added to the object file search path of the compiler (using the
-Fooption). - targetdir
-
Specifies the directory where the compiled programs should go (using the
-FEoption). - sourcedir
-
A space separated list of directories where sources can reside. This will be used for the
vpathsetting of GNUmake. - unittargetdir
-
Specifies the directory where the compiled units should go (using the
-FUoption). - includedir
-
A colon-separated list of directories that must be added to the include file search path of the compiler (using the
-Fioption).
Default
The default section contains some default settings. The following keywords are recognized:
- cpu
-
Specifies the default target processor for which the
Makefileshould compile the units and programs. By default this is determined from the compiler info. - dir
-
Specifies any subdirectories that make should also descend in and make the specified target there as well.
- fpcdir
-
Specifies the directory where all the Free Pascalsource trees reside. Below this directory the
Makefileexpects to find thertlandpackagesdirectory trees. - rule
-
Specifies the default rule to execute.
fpcmakewill make sure that this rule is executed if make is executed without arguments, i.e., without an explicit target. - target
-
Specifies the default operating system target for which the
Makefileshould compile the units and programs. By default this is determined from the default compiler target.
Dist
The Dist section controls the generation of a distribution package. A distribution package is a set of archive files (zip files or tar files on unix systems) that can be used to distribute the package.
The following keys can be placed in this section:
- destdir
-
Specifies the directory where the generated zip files should be placed.
- zipname
-
Name of the archive file to be created. If no zipname is specified, this defaults to the package name.
- ziptarget
-
This is the target that should be executed before the archive file is made. This defaults to
install.
Install
Contains instructions for installation of the compiled units and programs. The following keywords are recognized:
- basedir
-
The directory that is used as the base directory for the installation of units. Default this is
prefixappended with/lib/fpc/FPC_VERSIONfor Linuxor simply theprefixdirectory on other platforms. - datadir
-
Directory where data files will be installed, i.e. the files specified with the
Fileskeyword. - fpcpackage
-
A boolean key. If this key is specified and equals
y, the files will be installed as a fpc package under the Free Pascalunits directory, i.e. under a separate directory. The directory will be named with the name specified in thepackagesection. - files
-
extra data files to be installed in the directory specified with the
datadirkey. - prefix
-
is the directory below which all installs are done. This corresponds to the
prefixargument to GNUconfigure. It is used for the installation of programs and units. By default, this is/usron Linux, and/ppon all other platforms. - units
-
extra units that should be installed, and which are not part of the unit targets. The units in the units target will be installed automatically.
Units will be installed in the subdirectory units/$(OS_TARGET) of the dirbase entry.
Package
If a package (i.e. a collection of units that work together) is being compiled, then this section is used to keep package information. The following information can be stored:
- name
-
The name of the package. When installing it under the package directory, this name will be used to create a directory (unless it is overridden by one of the installation options).
- version
-
The version of this package.
- main
-
If the package is part of another package, this key can be specified to indicate which package it is part of.
Prerules
Anything that is in this section will be inserted as-is in the makefile before the makefile target rules that are generated by fpcmake. This means that any variables that are normally defined by fpcmake rules should not be used in this section.
Requires
This section is used to indicate dependency on external packages (i.e units) or tools. The following keywords can be used:
- fpcmake
-
Minimal version of fpcmake that this
makefile.fpcneeds. - packages
-
Other packages that should be compiled before this package can be compiled. Note that this will also add all packages these packages depend on to the dependencies of this package. By default, the Free PascalRun-Time Library is added to this list.
- libc
-
A boolean value that indicates whether this package needs the C library.
- nortl
-
A boolean that prevents the addition of the Free PascalRun-Time Library to the required packages.
- unitdir
-
These directories will be added to the units search path of the compiler.
- packagedir
-
List of package directories. The packages in these directories will be made as well before making the current package.
- tools
-
A list of executables of extra tools that are required. The full path to these tools will be defined in the makefile as a variable with the same name as the tool name, only in uppercase. For example, the following definition:
tools=upx
will lead to the definition of a variable with the name
UPXwhich will contain the full path to theupxexecutable.
Rules
In this section dependency rules for the units and any other needed targets can be inserted. It will be included at the end of the generated makefile. Targets or ’default rules’ that are defined by fpcmake can be inserted here; if they are not present, then fpcmake will generate a rule that will call the generic fpc_ version. For a list of standard targets that will be defined by fpcmake, see section Using fpcmake.
For example, it is possible to define a target all:. If it is not defined, then fpcmake will generate one which simply calls fpc_all:
all: fpc_all
The fpc_all rule will make all targets as defined in the Target section.
Target
This is the most important section of the makefile.fpc file. Here the files are defined which should be compiled when the ’all’ target is executed.
The following keywords can be used there:
- dirs
-
A space separated list of directories where make should also be run.
- exampledirs
-
A space separated list of directories with example programs. The examples target will descend in this list of directories as well.
- examples
-
A space separated list of example programs that need to be compiled when the user asks to compile the examples. Do not specify an extension, the extension will be appended.
- loaders
-
A space separated list of names of assembler files that must be assembled. Don’t specify the extension, the extension will be appended.
- programs
-
A space separated list of program names that need to be compiled. Do not specify an extension, the extension will be appended.
- rsts
-
a list of
rstfiles that needs to be converted to.pofiles for use with GNUgettextand internationalization routines. These files will be installed together with the unit files. - units
-
A space separated list of unit names that need to be compiled. Do not specify an extension, just the name of the unit as it would appear un a
usesclause is sufficient.
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
