Subsections


8.2 Role-File prog.mk

8.2.1 Purpose

The purpose of the prog role is to build executable binaries for different systems. The executable binaries are the targets.

8.2.2 Make-Targets

all:
Phony target. Build all targets and install them into the local install-tree then. The local install-tree is $(L4DIR)/bin. To install, strip -strip-unneeded is used.

relink:
Phony target. Relink and reinstall the targets, in the case your dependencies are somehow wrong.

8.2.3 Provided Variables

The following variables are provided by the prog.mk role-file:

GCCINCDIR The path where the gcc-specific include-files, such as stdarg.h. Never (really, NEVER) try to include a stdarg.h from a C library!).
GCCLIB The name of the compiler's companion library (libgcc).

8.2.4 Required Parameters

TARGET The list of the targets.
Or:
TARGET_<system> The list of the targets for a special system. Specify the system(s) in SYSTEMS.

8.2.5 Optional Parameters

ASFLAGS++ standard Makefile variable, used additionally for compiling assembler files. Default: empty.
BID_STRIP_PROGS If set to ``y'', strip binaries on installation into local or global bin-directories using $(STRIP) -strip-unneeded. Default: empty.
BUILD_PROFILE++ If nonempty, additional profile-versions of the targets are built. Therefore, each generated .o-file has an according .pr.o-file, which is compiled using the options -pg -DPROFILE. Each target is accompanied by an additional file with the suffix .pr. These additional files contain the profile code and are linked against profile libraries. See Section 8.3 on how to build profile libraries. Default: empty
CLIENTIDL++ IDL client source files. The .c and .cc-files compiled from the given IDLs are added to SRC_C++ and SRC_CC++ respectively. Default: unset.
CFLAGS++ standard Makefile variable, used additionally for the compiler. Default: adds $(OPTS) $(WARNINGS).
CPPFLAGS++ standard Makefile variables, used additionally for preprocessor. Default: adds $(DEFINES) -I{$(PRIVATE_INCDIR) $(IDL_PATH) $(GCCINCDIR) $(L4INCDIR)} $(LIBCINCDIR). $(IDL_PATH) is added if either $(CLIENTIDL) or $(SERVERIDL) are set. With $(MODE)=host, $(L4INCDIR) is not added.
CRT0 CRT0 object to link as fist object to the binary. Default depends on the selected mode.
CRTN CRTN object to link as last object to the binary. Default depends on the selected mode.
CXXFLAGS++ standard Makefile variable, used additionally for compiling C++ files. Default: adds $(OPTS) $(WARNINGS).
DEBUG If set, adds -DDEBUG to $(DEFINES). See there for details.
DEFAULT_RELOC++ The default link-addresses for the targets. Depending on the system, a relocation address needs to be specified. This address is used, if the default-reloc mechanism (see 7) does not deliver an address. Default: unset.
DEFINES++ Container for additional defines for the preprocessor. Default: Adds $(ARCH), $(CPU) and $(L4API) as defines. See Section 6.3 for details. If $(DEBUG) is set, -DDEBUG is added.
IDL_PATH++ The path to IDL-files. This path is used to find the client and server idl-files. Default: $(PKG_DIR)/idl/OBJ-$(SYSTEM).
IDL_PKGDIR A list of package directories where IDL files are used from. This will eventually supercede $(IDL_PATH). Default: $(PKGDIR).
IDL_TYPE+ The type of the IDL-files. This type is used to determine the compiler to use. See Section 8.4 for details. Default: dice.

Note: The '+' refers to the different IDL-files, not to the values of $(TARGET).

INSTALL_TARGET+ The list of the targets that will be installed automatically or on make install. Default: The targets and the targets specific to the current system. Also see the NOTARGETSTOINSTALL parameter.
INSTALLDIR_BIN The directory in the global install tree to install a binary to. Default: $(DROPS_STDDIR)/bin
INSTALLDIR_BIN_LOCAL The directory in the local install tree to install a binary to. Default: $(L4DIR)/bin
INSTALLFILE_BIN The command to install a binary to the global install tree.

Default depends on $(BID_STRIP_PROGS).

INSTALLFILE_BIN_LOCAL The command to install a binary to the local install tree.

Default depends on $(BID_STRIP_PROGS).

KEEP_ON_CLEAN A list of files that should not be removed on a ``make clean''.

Default: empty.

L4INCDIR++ System-dependent list of include directories. Default:

$(L4DIR)/include/$(ARCH)/$(L4API)

$(DROPS_STDDIR)/include/$(ARCH)/$(L4API)

$(L4DIR)/include/$(ARCH)

$(DROPS_STDDIR)/include/$(ARCH)

$(L4DIR)/include

$(DROPS_STDDIR)/include

L4LIBDIR++ System-dependent list of library directories. Default:

$(L4DIR)/lib/$(ARCH)_$(CPU)/$(L4API)

$(DROPS_STDDIR)/lib/$(ARCH)_$(CPU)/$(L4API)

$(L4DIR)/lib/$(ARCH)_$(CPU)

$(DROPS_STDDIR)/lib/$(ARCH)_$(CPU)

$(L4DIR)/lib

$(DROPS_STDDIR)/lib

L4LIBS Libraries and flags for the binary. Depends on the selected mode.
LDFLAGS++ standard Makefile variables, used as additional flags for the linker. Default for mode host: -L{$(PRIVATE_LIBDIR) $(LIBCLIBDIR)} $(LDSCRIPT) $(LIBS) $(L4LIBS) $(LIBCLIBS).

Default otherwise: -L{$(PRIVATE_LIBDIR) $(L4LIBDIR) $(LIBCLIBDIR)} $(LDSCRIPT) $(LIBS) $(L4LIBS) $(LIBCLIBS).

LDSCRIPT++ The name of the standard linker script used to link the binary. Default depends on the mode.
LIBCINCDIR Include path and flags to the libc includes. Default: Determined by the mode, points to dietlibc or uClibc normally.
LIBCLIBDIR Library path and flags to libc. Default: Determined by the mode, points to dietlibc or uClibc normally.
LIBCLIBS Libraries and flags for libc. Default: Determined by the mode, points to dietlibc or uClibc with support libraries normally.
LIBS++ libraries and objects to be linked to the targets. Contains additional PATHS (with -L) and libs (with -l). Default: unset.
MODE++ Specify, which target system a target has to be built for (see Section 6.5). Default: l4env
NOTARGETSTOINSTALL If nonempty, the binaries will not be installed, neither in the local $(L4DIR)/bin nor in the global $(DROPS_STDDIR)/bin. Default: empty
OPTS Optimization switches for the compiler. Default: -g -O2 plus arch-dependent switches
PRIVATE_INCDIR++ Additional list of include-directories. Will be prefixed with -I. Default: unset
PRIVATE_LIBDIR++ Additional list of library-directories. Will be prefixed with -L. Default: unset
SERVERIDL++ IDL server source files. The .c and .cc-files compiled from the given IDLs are added to SRC_C++ and SRC_CC++ respectively. Default: unset.
SRC_{C,CC,S}++ The list of source {.c, .cc, .S}-files which have to be compiled and linked to the targets. Default: unset.
SYSTEMS The systems the targets have to be build for. If multiple systems are given, each system is build into a separate directory. Default: x86-l4v2.
WARNINGS++ Warning switches for the compiler. Default: -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations

8.2.6 Example

PKGDIR = ..
L4DIR ?= \$(PKGDIR)/../..

TARGET = ping
SRC_C  = ping.c

include \$(L4DIR)/mk/prog.mk

8.2.7 C++ programs

If you do not need exception support, you can use the l4env mode, which comes with a much smaller libc. You have to define some callbacks then. Please see the exec server as an example. You should specify CXXFLAGS = -fno-exceptions -fno-rtti.

8.2.8 Implementation status

BUILD_PROFILE
To make it work, additional libraries (libl4sys.pr) must be linked, which is not the case now. It is not clear, if all l4-libraries should be exchanged by profiling variants or not.
MODE
is currently interpreted as MODE, not as MODE++.

L4 Checker 2012-04-11