Sign in Join
FPDoc Onlineexperiment

Variables set by fpcmake

The makefile generated by fpcmake contains a lot of makefile variables. fpcmake will write all of the keys in the makefile.fpc as makefile variables in the form SECTION_KEYNAME. This means that the following section:

[package]
name=mysql
version=1.0.5

will result in the following variable definitions:

override PACKAGE_NAME=mysql
override PACKAGE_VERSION=1.0.5

Most targets and rules are constructed using these variables. They will be listed below, together with other variables that are defined by fpcmake.

The following sets of variables are defined:

  • Directory variables.

  • Program names.

  • File extensions.

  • Target files.

Each of these sets is discussed in the subsequent:

Directory variables

The following compiler directories are defined by the makefile:

BASEDIR

Is set to the current directory if the pwd command is available. If not, it is set to ’.’.

COMPILER_INCDIR

Is a space-separated list of include file paths. Each directory in the list is prepended with -Fi and added to the compiler options. Set by the incdir keyword in the Compiler section.

COMPILER_LIBDIR

Is a space-separated list of library paths. Each directory in the list is prepended with -Fl and added to the compiler options. Set by the libdir keyword in the Compiler section.

COMPILER_OBJDIR

Is a list of object file directories, separated by spaces. Each directory in the list is prepended with -Fo and added to the compiler options. Set by the objdir keyword in the Compiler section.

COMPILER_TARGETDIR

This directory is added as the output directory of the compiler, where all units and executables are written, i.e. it gets -FE prepended. It is set by the targetdir keyword in the Compiler section.

COMPILER_TARGETUNITDIR

If set, this directory is added as the output directory of the compiler, where all units and executables are written, i.e. it gets -FU prepended.It is set by the targetdir keyword in the Dirs section.

COMPILER_UNITDIR

Is a list of unit directories, separated by spaces. Each directory in the list is prepended with -Fu and is added to the compiler options. Set by the unitdir keyword in the Compiler section.

GCCLIBDIR

(Linuxonly) Is set to the directory where libgcc.a is. If needgcclib is set to True in the Libs section, then this directory is added to the compiler command line with -Fl.

OTHERLIBDIR

Is a space-separated list of library paths. Each directory in the list is prepended with -Fl and added to the compiler options. If it is not defined on linux, then the contents of the /etc/ld.so.conf file is added.

The following directories are used for installs:

INSTALL_BASEDIR

Is the base for all directories where units are installed. By default, On Linux, this is set to $(INSTALL_PREFIX)/lib/fpc/$(RELEASEVER).
On other systems, it is set to $(PREFIXINSTALLDIR). You can also set it with the basedir variable in the Install section.

INSTALL_BINDIR

Is set to $(INSTALL_BASEDIR)/bin on Linux, and
$(INSTALL_BASEDIR)/bin/$(OS_TARGET) on other systems. This is the place where binaries are installed.

INSTALL_DATADIR

The directory where data files are installed. Set by the Data key in the Install section.

INSTALL_LIBDIR

Is set to $(INSTALL_PREFIX)/lib on Linux,
and $(INSTALL_UNITDIR) on other systems.

INSTALL_PREFIX

Is set to /usr/local on Linux, /pp on DOS or . Set by the prefix keyword in the Install section.

INSTALL_UNITDIR

Is where units will be installed. This is set to
$(INSTALL_BASEDIR)/units/$(OS_TARGET). If the units are compiled as a package, $(PACKAGE_NAME) is added to the directory.

Target variables

The second set of variables controls the targets that are constructed by the makefile. They are created by fpcmake, so you can use them in your rules, but you shouldn’t assign values to them yourself.

TARGET_DIRS

This is the list of directories that make will descend into when compiling. Set by the Dirs key in the Target section?

TARGET_EXAMPLES

The list of examples programs that must be compiled. Set by the examples key in the Target section.

TARGET_EXAMPLEDIRS

The list of directories that make will descend into when compiling examples. Set by the exampledirs key in the Target section.

TARGET_LOADERS

Is a list of space-separated names that identify loaders to be compiled. This is mainly used in the compiler’s RTL sources. It is set by the loaders keyword in the Targets section.

TARGET_PROGRAMS

This is a list of executable names that will be compiled. the makefile appends $(EXEEXT) to these names. It is set by the programs keyword in the Target section.

TARGET_UNITS

This is a list of unit names that will be compiled. The makefile appends $(PPUEXT) to each of these names to form the unit file name. The sourcename is formed by adding $(PASEXT). It is set by the units keyword in the Target section.

ZIPNAME

Is the name of the archive that will be created by the makefile. It is set by the zipname keyword in the Zip section.

ZIPTARGET

Is the target that is built before the archive is made. This target is built first. If successful, the zip archive will be made. It is set by the ziptarget keyword in the Zip section.

Compiler command line variables

The following variables control the compiler command line:

CPU_SOURCE

The source CPU type is added as a define to the compiler command line. This is determined by the Makefile itself.

CPU_TARGET

The target CPU type is added as a define to the compiler command line. This is determined by the Makefile itself.

OS_SOURCE

What platform the makefile is used on. Detected automatically.

OS_TARGET

What platform will be compiled for. Added to the compiler command line with a -T prepended.

Program names

The following variables are program names, used in makefile targets.

AS

The assembler. Default set to as.

COPY

A file copy program. Default set to cp -fp.

COPYTREE

A directory tree copy program. Default set to cp -frp.

CMP

A program to compare files. Default set to cmp.

DEL

A file removal program. Default set to rm -f.

DELTREE

A directory removal program. Default set to rm -rf.

DATE

A program to display the date.

DIFF

A program to produce diff files.

ECHO

An echo program.

FPC

The Free Pascal compiler executable. Default set to ppc386.exe

INSTALL

A program to install files. Default set to install -m 644 on Linux.

INSTALLEXE

A program to install executable files. Default set to install -m 755 on Linux.

LD

The linker. Default set to ld.

LDCONFIG

(Linuxonly) The program used to update the loader cache.

MKDIR

A program to create directories if they don’t exist yet. Default set to install -m 755 -d.

MOVE

A file move program. Default set to mv -f.

PP

The Free Pascal compiler executable. Default set to ppc386.exe

PPAS

The name of the shell script created by the compiler if the -s option is specified. This command will be executed after compilation, if the -s option was detected among the options.

PPUMOVE

The program to move units into one big unit library.

PWD

The pwd program.

SED

A stream-line editor program. Default set to sed.

UPX

An executable packer to compress your executables into self-extracting compressed executables.

ZIPPROG

A zip program to compress files. Zip targets are made with this program.

File extensions

The following variables denote extensions of files. These variables include the . (dot) of the extension. They are appended to object names.

ASMEXT

Is the extension of assembler files produced by the compiler.

LOADEREXT

Is the extension of the assembler files that make up the executable startup code.

OEXT

Is the extension of the object files that the compiler creates.

PACKAGESUFFIX

Is a suffix that is appended to package names in zip targets. This serves so packages can be made for different OSes.

PPLEXT

Is the extension of shared library unit files.

PPUEXT

Is the extension of default units.

RSTEXT

Is the extension of the .rst resource string files.

SHAREDLIBEXT

Is the extension of shared libraries.

SMARTEXT

Is the extension of smartlinked unit assembler files.

STATICLIBEXT

Is the extension of static libraries.

Target files

The following variables are defined to make targets and rules easier:

COMPILER

Is the complete compiler command line, with all options added, after all Makefile variables have been examined.

DATESTR

Contains the date.

UNITPPUFILES

A list of unit files that will be made. This is just the list of unit objects, with the correct unit extension appended.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.