Sign in Join
Wiki copytemporary

Fpcmake: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11**Fpcmake** is a [[makefile]] generator, to control the [[make]] [[utility]] by [[GNU]]. It generates a makefile named "Makefile" from a definition file called "Makefile.fpc" and its own built-in template. It is used in the FPC source tree (e.g. in FPC 2.6.0), but is planned to be succeeded by [[FPMake]].
22
33This 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.
44
55The manual has a quite good [chapter about Makefile.fpc syntax](https://www.freepascal.org/docs-html/current/prog/progap5.html#x294-310000E), and examples teach the rest (fpcmake.ini, the various Makefile.fpcs in the FPC source tree).
66
77It defines some default targets that are always present:
88
99- Clean -- clean all programs and the units explicitly stated to be cleaned, but not other units.
1010- Cleanall -- also clean all units (*.ppu).
1111
1212## Troubleshooting
1313
1414- I get an 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
1515- Clean does not delete the files I expect. -- This happens when the files were generated by a call to make where certain options were given. Remedy: Call make clean with the same options. Options which may affect this are:
1616 - OS_TARGET
1717 - CPU_TARGET
1818 - 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)
1919- 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.
2020- Target not supported: bad parameters were used when generating the makefile, you need to regenerate it with -Tall (see next paragraph)
2121
2222## Regenerating makefiles
2323
2424Regenerating a *Makefile* from *Makefile.fpc* is quite easy. The basic syntax is
2525
26-`fpcmake -w -Tall`
26+```text
27+fpcmake -w -Tall
28+```
2729
2830- -w : actually **write** the Makefile.
2931- -Tall : generate the makefile so as to work on all platforms (default is only the host platform).
3032
31-**`DON'T FORGET THIS WHEN COMMITTING TO FPC / LAZARUS SVN SERVER!`**`. `
33+```text
34+DON'T FORGET THIS WHEN COMMITTING TO FPC / LAZARUS SVN SERVER!.
35+```
3236
3337For Lazarus developers:
3438
35-**`YOU MUST USE THE FPC DEVELOPER VERSION (trunk, e.g. 2.7.1) TO GET ALL PLATFORMS`**`.`
39+```text
40+YOU MUST USE THE FPC DEVELOPER VERSION (trunk, e.g. 2.7.1) TO GET ALL PLATFORMS.
41+```
3642
3743- It is possible to add -v to increase verbosity.
3844
3945If you regenerate makefiles outside the fpc/ SVN tree, (e.g. for Lazarus in projects), and fpcmake complains it can't find package.fpc for the RTL package, try setting the environment variable FPCDIR to the FPC source directory using commands like the following:
4046
4147- Unix/Linux/OSX bash/sh
4248
4349``` bash
4450# e.g. if your FPC directory is located in /location/to/fpc:
4551export FPCDIR=/location/to/fpc
4652```
4753
4854- DOS/Windows/OS/2
4955
5056```dos
5157REM e.g. if your FPC directory is located in c:\location\to\fpc:
5258set FPCDIR=c:\location\to\fpc
5359```
5460
5561## Extending
5662
5763### CPU/OS
5864
5965When adding a new operating system or CPU it's needed to extend fpcmake utility, so MAKE utility will call the proper binaries for the new target.
6066
6167The following types and constants needs to be extended. The arrays are declared at **fpcmmain.pp** unit.
6268
6369- TCpu - the enum listing all possible CPUs. A new entry needs to be added for a new CPU
6470
6571:* CpuStr - is the constant of representing strings for each TCPu entry
6672
6773:* CpuSuffix - the CPU string used as a suffix. Simply by prefixing "_"
6874
6975:* ppcSuffix - the CPU suffix to be used in the executable name
7076
7177- TOS - the num listing all operating systems
7278
7379:* OSStr - the constant listing representing TOS as a string. The value is used when writing a file or parsing parameters
7480
7581:* OSSuffix - the constant listing representing OS as a suffix
7682
7783- OSCpuPossible - the matrix that reflects what OS and CPU combination is possible
7884
7985## See also
8086
8187- [Free Pascal Programmers Guide (Appendix E)](http://www.freepascal.org/docs-html/prog/progap5.html)
8288
8389---
8490*From the Free Pascal wiki, page "Fpcmake", as it stood on 2022-02-17 after a change by Unxed, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
8591Category: FPC
8692Category: Utilities

Back to history