Porting mplib1

mplib1 has been ported to the following platforms/formats.

To build mplib1 on any platform you will require GNU make or some equivalent make program that can cope with VPATH directives, inclusion of dynamically generated include files (for dependancies) and appending text to a variable ( CFLAGS+=-DSPECIAL_DEFINE ).

If you already have a suitable make, to build for an existing platform execute the following in the main directory

where XXXX is one of the following

This will create a link from make_platform to the relevant platform makefile, and also create a new mplib1/mplib1_config.h file.

It will also create a file called make_site which should now be customised for the particular environment. Currently the only likely contents are definitions of where to find GNU GDBM files.

It should then be possible to build mplib1 simply by typing


Porting to a new platform

Porting mplib1 to a new platform is easiest if it bears some resemblance to an existing port. That notwithstanding, just follow the straight-forward instructions below.

  1. Choose a suitable platform type name, below we use 'wibbleos'.
  2. In the platform directory we will create two files. One called wibbleos.g the other wibbleos.m.
  3. The wibbleos.g contains the platform required #define statements. These are detailed below.
  4. The wibbleos.m contains the platform specific Makefile statements. Some of the varients required are discussed below.

Platform defines

The following are a list of the current symbols that may be required.

to be defined when compiler does not handle long long constructs
Used when the compiler handles long long constructs and accepts %Lx for printing same. Otherwise %llx is used.
Used when the machine architecture requires 8 byte elements (double and long long) to align on 8 byte boundaries.
to be defined when <sys/select.h> needs to be included (for definition of fd_set).
to be defined when <getopt.h> needs to be included for the definition of getopt(2)
to be defined when gettimeofday is defined as taking two parameters like.
	int gettimeofday(struct timeval *tv, struct timezone *tz);
to be defined when gettimeofday is defined as taking two parameters, but the second one should always be NULL.
to be defined when it is valid to add an off_t to a void * to get another pointer (equivalent to typecasting to char, adding the offset, and typecasting back).

There is a set of symbols of which one and only one should be used, which defines which inter-process locking mechanism to use. For details of current implementations click here.

Makefile details

The platform dependant makefile will have any specific requirements for the following make variables.
DEPFLAGS - make depend flags
include paths, special flags
CFLAGS - producing object files from C files
include paths, special flags
ARFLAGS - archiving flags
object format, verbosity etc.
LDFLAGS - linking flags
object formats, symbol manipulation, etc.
LDLIBS - linking libraries
libraries, library paths.

In addition it would contain any special build rules for platform specific compatibility.

Note: if modifications to the source files are required, then the changes should be selectable using a suitable #ifdef and the #define placed in the platform define file.