One of the things that Daniel J. Bernstein did in his packages is merge steps two and three. There would be makefile/redo rules for detecting the presence of operating-system-specific stuff, and linking the appropriate source/header files into place.
Here's an example from ucspi-tcp that auto-configures whether the platform supports waitpid():
* https://github.com/comotion/ucspi-tcp/blob/master/Makefile#L...
* https://github.com/comotion/ucspi-tcp/blob/master/choose.sh
* https://github.com/comotion/ucspi-tcp/blob/master/trywaitp.c
* https://github.com/comotion/ucspi-tcp/blob/master/haswaitp.h...
* https://github.com/comotion/ucspi-tcp/blob/master/haswaitp.h...
When I extended redo to the whole of djbwares, this system was fairly simple to convert. Here is haswaitp.h.do which is what redo ends up running whenever something reveals a dependency from haswaitp.h :
#!/bin/sh -e
redo-ifchange trywaitp.c compile link
if ( ./compile trywaitp.o trywaitp.c trywaitp.d && ./link trywaitp trywaitp.o ) >/dev/null 2>&1
then
echo \#define HASWAITPID 1 > "$3"
else
echo '/* sysdep: -waitpid */' > "$3"
fi
* http://jdebp.eu./Softwares/djbwares/The BSD Ports tree provides exactly this functionality. All package dependencies provided via standard make variables and rules, enabling recursive resolution of all package dependencies.
It's also possible to do some truly awful things with make. I once worked on an embedded device that the SDK provided by the OEM was written using a truly horrific makefile system. There were no less than 80 makefiles all tied together to build an entire system image, including the building of the linux kernel, all the bintools, and a bunch of other custom stuff the OEM provided. Trying to understand, much less modify any part of that build system was an absolute nightmare, and is one of the few times I've actually wished they had used shell scripts instead of make for some of that stuff.
As for Maven, it was quite a pioneer in its day, but it hasn't aged well, in particular being written in XML which just adds needless verbosity. For a more modern take, look at Gradle, which provides everything that Maven does (and uses mavens dependency system), but is a lot more flexible because it's a DSL for project building instead of a declarative system like Maven.