This is a public domain implementation of make which follows the POSIX standard.
If you've got here I assume you know what make is and why you might want to use it. If not, Chris Wellons has a nice Tutorial on Portable Makefiles.
The code is based on Neil Russell's public domain make, as submitted to the Usenet newsgroups net.sources and mod.sources in 1986. The basic data structures and algorithms remain but everything else has changed. This version is also dedicated to the public domain.
The problem with make is that it's a tool for developers, and developers like to tinker with their tools. There are therefore many slightly different versions of make around. POSIX attempts to standardise their common behaviour but leaves a lot of the details unspecified or implementation dependent. It's also rather lax, in that it allows extensions to exist provided they don't interfere with the specified functionality.
This version tries to stick to the POSIX standard. The default build from source includes a number of extensions but a key feature of the program is that it can be switched to a strictly POSIX-compliant mode at runtime. This can be achieved in several ways:
.POSIX
as the first non-comment line of the first makefile
to be processed.
--posix
command line option.
This must be the first given on the command line.
PDPMAKE_POSIXLY_CORRECT
environment variable. If this is set to any value (even an empty string)
all extensions are disabled.
Extensions from a future POSIX standard are included. These remain subject to change until the standard is finally published.
-j maxjobs
command line option is
accepted but doesn't cause jobs to be run in parallel, as is permitted
by the proposed standard.
.NOTPARALLEL
and .WAIT
special targets are permitted (but have no effect, see above).
.PHONY
special target
are always treated as being out-of-date.
include
line.
-include
variant of include
. This can be handy
when using the automatic dependency tracking feature of compilers.
make
rather than the "delayed
remaking" used by GNU make
.
$^
and $+
internal macros
evaluate to all prerequisites of the current target (not just out-of-date
ones, as with $?
). $^
removes duplicated
prerequisites from the list, $+
doesn't.
MAKE
environment variable is provided the
MAKE
macro is initialised from argv[0]
, with a
relative path converted to absolute.
::=
, :::=
,
+=
, ?=
and !=
are permitted.
SRC = src/util.c src/main.c OBJ = $(SRC:src/%.c=obj/%.o)
Some additional extensions are also provided. These are all compatible
with GNU make
, though some are supported by other
implementations.
-C directory
command line option changes
the current working directory.
ifdef
ifndef
else
endif
lib.a(mem1.o mem2.o...)
.
:=
is permitted. It is
equivalent to ::=
in POSIX.
.p.q
and .q.r
and the file thing.p
exists, make is able to deduce how to create thing.r
.
$?
is expanded.
include
line with no files specified is
silently ignored. At least one blank must follow the include
for the line to be valid.
To make POSIX mode more convenient to use certain inconvenient limitations can be relaxed through the use of pragmas. These can be specified in two ways:
-x
flag.
.PRAGMA
special target.
Available pragmas are:
macro_name
target_name
command_comment
empty_suffix
$(VAR:=.c)
.posix_202x
macro_name
and
target_name
pragmas aren't required as the future
standard will allow the additional characters.
Specifying the .PRAGMA
special target with no prerequisites
restores the default behaviour.
The most recent source tarball is pdpmake-1.4.1.tgz. The release notes describe recent changes.
Source is also available in a Git repository mirrored on GitHub, Gitlab and with (IPv6 only):
git clone git://git.frippery.org/pdpmake
Future POSIX and non-POSIX extensions can be enabled separately by
setting the build flags ENABLE_FEATURE_MAKE_EXTENSIONS
and
ENABLE_FEATURE_MAKE_POSIX_202X
to 1
.
Setting both flags to 1
is equivalent to the default
configuration, except that the future POSIX standard is enforced
in POSIX mode rather than the current standard.
Bug reports can be submitted via GitHub, GitLab or by email to the address below.
Remember, though, this is just a bunch of zeroes and ones you happened to find on the internet. If it does anything useful that's an unexpected bonus.