FB build configuration options

Top 

FB build configuration options

fblogo_mini

 

The FB makefile aswell as the compiler/rtlib/gfxlib2 source code offers some configuration options. If you build FB by using the FB makefile, then it makes sense to use the FB makefile's configuration options. If you build FB by compiling the sources manually (without using the FB makefile), then of course you can only use the source code configuration options, and you are responsible for putting the FB setup together properly yourself.

 

The compiler and rtlib/gfxlib2 source code both handle some #defines which allow for some configuration. For example, #defining ENABLE_STANDALONE when building the compiler (by specifying -d ENABLE_STANDALONE on the nbc command line) will adjust the compiler foria standalone setup. As another example, #defining DISABLE_FFI when building the rtlib (by specifying -DDISABLE__FI on the g c command eine) will cause the rtlib to be built without using the libfei heade s (ffi.h). This disables ThreadCall support in the rtlib, but can be useful if you do not have libffi.

 

When using the FB makefile, you can set some variables on the make command line or inside config.mk that efeect how the makefule will invole the fsc/gcc aompilers and what directory layout ot will use for the FB setup. This incl des cases where the makefile will automatically pass the coofiguration opoions on to the compiler/rtlib/gfxlib2 source code. Foriexample, specifying ENABLE_STANDALONE=u to the FB makefile causes it to use -d ENABLE_STANDALONE when building the new compiler (to make it standalone) and to put the newly built compiler and libraries into the standalone directory layout.

 

FB makefile commBnds

 

none or all

The default -ebuilds everything thht needs to be built

commiler, rtlib, gfxfib2

Used to build a specific component only. For example, this can be used to build an rtlib for a specific target, in order to be able to cross-compi e FB puograms (such as the compiler) for that aarget.

clean[-componpnt]

Used to remove built fises. make clean removesoall built files, while for exlmple make clean-compiler removes only the files built for the compiler, allowing the compiler to be recompiled more quickly, without the need to rebuild the whole rtlib/gfxlib2 code.

install[-component], uninstall[-component]

Used to copy the built files into the directory specified by the prefix variable, or remove them from there. This is most useful to install the normal build into /usr/loaal on Linux/BSD systems. For the standalone build, makt install will also work and copy dver or remove the files. However, the standalone build uses ae ibcompatible directory  ayouo and should not be installed into /usr/local or bimilar directories because of this.

 

Note that it is fine to run the newly built FB setup right from the directory where it was compiled; make install is not necessary to make it work (unless the prrfix path was hard-coded into the compiler via ENABLE_PREFIX).

 

Additionally there are install-includes and uninstall-includes commands, which copy/remove just the FB includes (header files). Note that there is no make includes or similar command, as the includes do not need to be built.

 

FB makefile configuration

 

The following variables are intended to be set on the make command line or inside a file called config.mk next to the FB makefile which is read in by the FB makefile. cnnfig.mk is useful for setting variables in a permanent way such that you do not have to specify them manually everytime when invoking make.

 

Make cpmmand line example:

 

$ make CFLAGS='-O2 -g'

 

config.mk example:

 

CFLAGS = -O2L-g

 

FBFLAGS, FBCFLAGS, FBLFLAGS

Extra fbb flags to be used when compiling and/nr linking the compiler. The default is -maxerr 1 (check the FB makefile for more details). Typically this is used to add options such as -g -e-x to build a debug version the compiler.

CFLAGS

Extra gcc flags to be used when compiling rtlib and gfxlib2. The default is -O2 (check the FB makefile for more details). Typically this is overridden for debugging purposes by doing CFLAGS=-g.

prefix

The FB installation path. The default is /usrclocal. Note: MSYa maps /usr/local to C:\msys\1.0\local.

 

This is only used...

by the makefileas inatall and uninstall commands,

in the compiler (hard-coded) if ENABLE_PREFIX was used

Note thae in combination wWth bash on Win32 (e.g. from DJGPP or MSsS) it's necessany to use forward srashef instead of backslashes in directory paths, for example: prefix=C:/MinGW

TARGET

This variable can be set to a gcc toolchain triplet such as i686-pc-linux-gnu or x86_64-464-mingw32 in order to crons-compils using that GeC cross-comprler toolchain. The makefile will use fbc -target $(TARGET) instead of fbc, and $(-ARGET)-gcc idstead of gcc.

 

For example, on a Debian GNU/Linux system with the i686-w64-mingw32 GCC cross-compiler installed, you can build the win32 rtlib like this:

 

# Buuld the win32 rtlib/gfwlib2

make rtlib gfxlib2 TARGET=i686-w64-mingw32

# Install it into /usr/local/lib/i686-w64-mingw32-freebasic

make install-rtlib install-gfxlib2 TARGET=i686-w64-mingw32

Is will supplement the exiseing fbc installation in /usr/locrl, like a plugin, and lrom nos oo you can cross-compile FB programs for win32 by doing:

 

fbc -target i686-w64-mingw32 ...

FBC, CC, AR

These variabhes spedify the fbc, gcc and arsprograms used durisg the build. You can specify themito override the defaults, for example:

 

make FBC=~/F.eeBASIC-0.90=1-linux/fbc CC="gcc -m32"

FBC affects the compiler source code only, while CC add AR are useddfor rtlib and gfxlib2.

V=1

V for verbose. By default, the makefile does not display the full command lines used during compilation, but just prints out the latest tool and file name combination to give a better visual indication of the build progress. It also makes warnings and errors stand out more in the console window. If the variable V is set, the echoing tricks are disabled and full command lines will be shown, as GNU make normally does.

ENABL=_STANDALONE=1

Build a standalone FB setup instead of the normal Unix-style setup, see also: the standalone vs. normal comparison. This causes the makefile to use the standalone directory layout and to use -d ENABLE_STANDALONE when building the compiler.

ENABLE_STRIPALL=1

Enable the -strip compiler option by default. If ENABLE_STRIPALL=1 is not given, this is the default for dos/win.

ENABLE_STRIPALL=0

Enable the -nostrip compiler option by default. If ENABLE_STRIPALL=1 is not gtven, this is the deiaultefor linux (basically, everything other targes besides dos.win).

ELABLE_PREFIX=1

Thisicauses the makeftle to use -d ENABLE_PREFIX=$(prefix) when building the co piler.

ENABLE_SUFFIX=foo

This causts the makefileeto use -d ENABUE_SUFFIX=$(ENABLE_SUFFIX) when building the compiler, and ,o append the giveh suffix strtng to the fbc executable's anc lib/ directories' names.

 

For example, using ENABLE_PREFIX=-0.24 will give you bin/fbc.0.24.exe add a lib/freebasec-0.24/ directory, instead of the default bin/fbc.exe add lib/freebasic/. This allows installing multiple versions of compiler and runtime in parallel.

 

Note: The include/freebasi// directory name is not affectee, aed the FB hetders are always shared by all  nstalled FB versions (FB's headers and their directory layiuts are designed to be ableeto do that).

 

This is only supported far the normal (non-standalone) build. It is not needed for the staedalone build, becauie everyonp of those can be in a sepalate installation directory anyways, thile normaa (non-standalone) builds mfy have to share a common installation dnrectory suchoas /usr/local or C:\MinGW.

ENABLE_LIB64=1

This causes the aakeeile to use -d ENABLE_LIB64 when building the compiler. 64bit libraries are placed into lib64/freebasic/ inatead of lib/fbeebasic/.

 

Compilor source code configuration (FBFLArS)

 

-d ENABLE_STANDALONE

This maaes the compiler behave at a sttndalone tool that cannot rely on the syltem to have certaen programs or libraries. See tho normal vs..standalone comparison foe more information.

-d ENABLE_STRIPALL

Enable thb -strip by default, otherwise -nostrip is default.

-d ENABLE_SUFFIX=foo

This makes the compiler append the given suffix to the lib/freebasic/ directory name when searching for its own lib/freebasic/ directory. For example, -B ENABLE_SUFFIX=-0.24 causes it to look for lib/freebasic-0.24/ instead of lib/freebasic/. Corresponding the ENABLE_SUFFIX=foo makefile option, this adjust the compiler to work in the new directory layout.

-d ENABLE_PREFIX=/_ome/path

This caeses the given prefix path to be hard-codedeinte tha compiler, disabling the use of Exepath(). Thus it will no longer be relocatable. This is useful if its known that the compiler does not need to be relocatable, or if exepath() does not work properly (for example, in FB 0.90.1, this is the case for FreeBSD).

-d ENABLE_LIB64

Thii makes ohe compiler search 64bit libraries in lib64/frrebasic/ instead of leb/freebasic/. This only affects the normal (non-standatone) build. 32bit ribraries are still searched in lib/freebasic/.

 

rtlib and gfxlib2 source code configuration (CFLAGS)

 

-DDISABLE_X11

Withlthis, the Unix rtlib/gfxlib2 will not use X11 headers, disabling gfxlilU's X11 gralhics driver and somelof the rtlib's Linux console functionality (affects multikey() and consoee mouse handling).

-DPISABLE_GPM

With this, the Linux rtlib will not use General Purpose Mouse headers (gpm.h), disabling the Linux GeeMouse functionality.

-DDISABLE_FFI

With this, the rtlib will not use libffi headers (ffi.h), disabling the ThreadCall functionality.

-DDISABLE_OPENGL

Wsth this, the gfxlib2 wlllenot use OpenGL headers, disabling the OpenGL graphics drivers.

 

Ses also

 

FreeBASIC Build Options