Build

Overview

Install a C build toolchain:

sudo ./installc

The installer installs missing packages only and uses the system’s package manager.

Tip

Use sudo ./installc -r to remove the installed packages again.

Detect the build configuration:

./configure

Build Para:

make

See below for details.

Configuration

The build configuration is stored in the Makefile.

The Makefile is generated from Makefile.in by ./configure, which replaces defaults with values more appropriate to the system.

The configuration detected by ./configure is saved to config.status, the output of feature detection tests to config.log. config.status is a shell script that rebuilds the Makefile using the most recently detected configuration.

./configure is controlled by:

Para does not use Autoconf; configure and its configuration files are hand-written shell scripts; so you can debug them if you need to. The same goes for the Makefile. However, be careful to edit Makefile.in, the template from which the Makefile is generated, not the Makefile itself, or else your changes may get overwritten.

Configure and the Makefile conform to the GNU Coding Standards (chap. 7).

Files

Para ships with three build configurations, which can be found in the conf directory.

Filename

Purpose

prodrc

Production

develrc

Development

posixrc

Fallback

Use prodrc for production and develrc for development.

posixrc only tests for compiler flags that are either required by some compilers or defined by POSIX.1-2008 and disables features that require non-standard interfaces. It is intended as a fallback if Para does not compile with the production build configuration.

For example,

./configure --conf=posixrc

selects conf/posixrc.

Site-specific settings can be put in conf/siterc, which is always loaded and never included in a distribution.

Tip

You can create a separate development configuration with:

./configure --conf=develrc --makefile=devel.mk

And use that configuration with:

make -f devel.mk

Environment

Configure respects the following standard environment variables:

Variable

Purpose

CC

C compiler

CPPFLAGS

Flags for the C preprocessor

CFLAGS

Flags for the C compiler

LDFLAGS

Flags for the linker

LDLIBS

Libraries to link against

DESTDIR

Destination directory for staged installations

PREFIX

Installation directory prefix

Arguments

See the GNU Coding Standards (chap. 7). However, different to Autoconf, unrecognised options are passed on to the C compiler if the compiler supports them.

See also

configure --help

Compile-time configuration

Some aspects of the behaviour of Para can be configured at compile-time by defining one or more of the macros below.

Macro

Type

Default

Description

COV

bool [1]

0

Build for coverage reports?

DEF_GRACE

double

0

Default for -k

DEF_LOAD

double

2.0

Default for -l [2]

DEF_NJOBS

ptrdiff_t

2

Default for -j [2]

DEF_TIMEOUT

unsigned int

0

Default for -t

HAVE_GETLOADAVG

bool [1]

0 [3]

Is getloadavg(3) available?

NAUTOTESTS

bool [1]

0

Disable auto-generated tests?

NDEBUG

bool [1]

1 [5]

Disable assertions?

EXTENSIONS

bool [1]

0 [6]

Enable non-standard features?

LINT

bool [1]

0

Analyzed by linter?

MAX_NJOBS

ptrdiff_t

64

Maximum for -j [7]

MAX_NVARS

ptrdiff_t

256

Maximum number of environment variables [7]

MAX_STR_SIZE

size_t

8192

Maximum string length [7]

PARA_C_AS_HDR

bool [1]

0

Include para.c as header? [8]

PARA_C_AS_OBJ

bool [1]

0

Compile para.c as object? [8]

Use configure’s -D flag to define macros. For example,

./configure -DMAX_NJOBS=256

configures Para to permit running up to 255 jobs in parallel (one slot is needed for a terminator).

Makefile targets

The Makefile conforms to the GNU Coding Standards and supports the following ‘phony’ targets:

Target

Description

all

Alias for “para” and the default target.

check

Compile and run tests.

quickcheck

Only compile and run quick tests.

lint

Run Flawfinder, RATS, Clang-Tidy and Cppcheck.

quicklint

Only run Flawfinder and RATS.

memcheck

Run Valgrind or leaks.

dist

Make a distribution tarball.

distcheck

Run make all lint check memcheck installcheck from a tarball.

install

Install Para.

installcheck

Check whether make install works.

uninstall

Uninstall Para.

tidy

Delete backups, logs, and temporary files.

mostlyclean

make tidy and delete binaries, coverage data, and objects.

clean

make mostlyclean and delete coverage reports.

mrproper

make clean and delete caches, tags, and tarballs.

distclean

make mrproper and delete the build configuration.

maintainer-clean

make distclean and delete X macros, the manual, and some documentation.

Troubleshooting

./configure fails

Try the POSIX build configuration (see Files above). If that, too, fails re-direct the output of configure to config.mk to save the configuration that is detected:

./configure >config.mk

Then copy Makefile.in to Makefile, but uncomment the line #include config.mk:

sed 's/#\(include config.mk\)/\1/' Makefile.in >Makefile

Makefile updates

The GNU Coding Standards mandate that the Makefile be updated whenever one of the files it depends on changes. Rename or remove config.status to disable this behaviour.

Manual compilation

If all else fails, compile para.c manually:

c99 -DNDEBUG -O1 -opara para.c

Known Issues

Some versions of the Public Domain Korn Shell cannot run ./configure.