Build¶
Overview¶
Install a C build toolchain:
sudo ./installc
The installer 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:
A configuration file (see Files below)
The environment (see Environment below)
Arguments (see Arguments below)
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 conforms to the GNU Coding Standards (chap. 7).
Files¶
Para ships with three build configurations, which can be found in the
conf
directory.
Filename |
Purpose |
---|---|
|
Production |
|
Development |
|
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 .configrc
, which is always loaded.
Tip
You can create a separate development configuration with:
./configure --devel --makefile=devel.mk
And use that configuration with:
make -f devel.mk
Macros¶
Macro |
Type [1] |
Default |
Description |
---|---|---|---|
|
bool |
0 |
Build for coverage reports? |
|
double |
120 |
Default for |
|
double |
2.0 |
|
|
ptrdiff_t |
2 |
|
|
unsigned int |
0 |
Default for |
|
bool |
0 [3] |
Is |
|
bool |
0 |
Disable auto-generated tests? |
|
bool |
1 [4] |
Disable assertions? |
|
bool |
0 [5] |
Disable non-standard features? |
|
bool |
0 |
Analyzed by linter? |
|
ptrdiff_t |
64 |
|
|
ptrdiff_t |
256 |
Maximum number of environment variables [6] |
|
size_t |
8192 |
Maximum string length [6] |
|
bool |
0 |
Include |
|
bool |
0 |
Compile |
Use configure’s -D
flag to set 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).
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
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. |
tidy |
Delete backups, logs, and temporary files. |
mostlyclean |
make tidy and delete binaries, coverage data, and objects. |
clean |
make mostlyclean and delete coverage info. |
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 and some documentation. |
dist |
Make a distribution tarball. |
distcheck |
Run make check lint installcheck from a tarball. |
install |
Install Para. |
installcheck |
Check whether make install works. |
uninstall |
Uninstall Para. |
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