From Free Pascal wiki
Revision as of 11:31, 6 May 2004 by Marcov (talk | contribs)
Jump to navigationJump to search

Fpcmake is a makefile generator. It generates a makefile "Makefile" from a definition file called "Makefile.fpc" and its own build-in template.

This template is located in utils/fpcm/fpcmake.ini, but since fpcmake.ini is included in the binary (to avoid path-searching issues), fpcmake has to be regenerated for each fpcmake.ini change.

The manual has a quite good chapter about Makefile.fpc syntax, examples do the rest (fpcmake.ini, the various Makefile.fpc's in the FPC source tree).

It defines some default targets always present:

  • Clean -- clean all programs and units explicitly stated to be cleaned by clean, but not other units.
  • Cleanall -- clean also all units (*.ppu).

Trouble Shooting

  • Error message, that the command __missing_command__ is missing. This happens when a tool required by the make process is not found. Remedy: Add the path to the tool as an option to make, like DATA2INC=/path/to/data2inc, for the tool data2inc
  • Clean does not delete the files I expect. This happens when the files was generated by a call to make where certain options was given. Remedy: Call make clean with the same options. Options which may affect this is:
    • FPC or PP (Tells make which version of the compiler created the files, this affects *.*w files generated for Windows for fpc < 1.1. To erase these files, please give an fpc 1.0 compiler as a parameter)
  • Make cannot find tools asw, ldw. Happens only when making for fpc 1.0.* Remedy: Make a copy of the tools as and ld, rename them asw, ldw.
  • Target not supported: bad parameters were used when generating the makefile, you need to regenerate it with -Tall (see next paragraph)

Regenerating makefiles

Regenerating Makefile from Makefile.fpc is quite easy. The basic syntax is

fpcmake -w -Tall

  • -w : actually _write_ the Makefile.
  • -Tall : generate the makefile to work on all platforms (default is only the host platform) DON'T FORGET THIS WHEN COMMITTING TO FPC CVS SERVER!
  • It is possible to add -v to increase verbosity.

If you regenerate makefiles outside the fpc/ CVS tree, (e.g. for lazarus in projects), and fpcmake complains it can't find package.fpc for the RTL package, try setting the enviroment variable FPCDIR to the fpc source directory fpc/:

(bash/sh) export FPCDIR=/location/to/fpc

(dos/windows/OS/2) set FPCDIR=c:\location\to\fpc