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 implements the make utility as defined in both the 2017 and 2024 POSIX standards. 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.
The standard mechanism (.POSIX in the makefile) is actually
the least useful. Any processing that happens before the makefile is
read won't be done in POSIX mode.
Some extensions beyond the POSIX standard are provided. These are all
compatible with GNU make, though some are supported by other
implementations. Full feature parity with GNU make is not
an objective.
-C directory command line option changes
the current working directory.
ifdef
ifndef
ifeq
ifneq
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.
-e option when errors aren't being ignored.
$< and $* internal macros
are given values in target rules.
.DEFAULT target aren't
used for phony targets.
To make POSIX mode more convenient certain limitations can be relaxed through the use of pragmas. These can be specified in three ways:
-x flag.
.PRAGMA special target.
PDPMAKE_PRAGMAS can
contain a space-separated list of pragmas. This variable is exported by
pdpmake so pragmas are propagated to recursive invocations.
Available pragmas are:
macro_nametarget_namecommand_commentempty_suffix$(VAR:=.c).posix_2017posix_2024macro_name and target_name pragmas aren't
required as the additional characters are allowed.posix_202xposix_2024, provided
for backward compatibility.windowsC:/path in
builds for Microsoft Windows. This may also require the
target_name pragma.
The .PRAGMA special target should be used as early as possible
in the makefile. Altering pragmas at different places in the makefile is
likely to result in inconsistencies.
There is a brief summary of the features added since the 2017 revision of the POSIX standard.
The most recent source tarball is pdpmake-2.0.3.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
Makefile.
Makefile you need to have
a make binary. If necessary you can bootstrap pdpmake
by running the command cc -o make *.c in the source directory.
make you can
bootstrap that using a default build of pdpmake in the
usual ./configure; make incantation.
A default build supports non-POSIX extensions and features from both POSIX 2024 and 2017. When strict POSIX compliance is requested at runtime the POSIX 2024 standard is enforced by default.
Non-POSIX extensions and POSIX 2024 features can be controlled separately
at build time by setting the preprocessor symbols
ENABLE_FEATURE_MAKE_EXTENSIONS and
ENABLE_FEATURE_MAKE_POSIX_2024 to 0 or
1 when building a binary.
The POSIX standard enforced by default at runtime can be set using the
preprocessor symbol DEFAULT_POSIX_LEVEL. Use 0
for POSIX 2017 and 1 for POSIX 2024.
Microsoft Windows users will find a native build of pdpmake
included in the BusyBox for Windows
binaries. Download an appropriate binary for your system and rename it
make.exe or pdpmake.exe. BusyBox for Windows
includes a Unix shell and many utilities. These can be used in Makefiles
without any further setup.
It's also possible to build pdpmake for Windows using
Cygwin.
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.