by mcbain · 8y ago · 0 comments
This is less fragile and requires less dependence on replacing make in the $PATH.
All maintained and ready to go.
My personal pet peeve with POSIX Make is that you can't export an environment variable for one target only without calling $(MAKE)[1].
I use GNU-specific Makefile features all the time - here's a list of some of the cool features:
- Built-in functions (see https://www.gnu.org/software/make/manual/html_node/Functions.html for a list)
- User-supplied functions
- Much better pattern substitution
- Ways to tell Make that some files can be skipped in certain cases (.INTERMEDIATE and .SECONDARY modifiers)
- Ways to adjust Make's behavior (SECONDEXPANSION, DELETE_ON_ERROR, ONESHELL)
As a software packager, I'd advocate for autotools or CMake over a raw Makefile every time (assuming your project is a library or some binaries).But with that said, I use GNU Make all the time for "glue automation" - like if I had a folder full of files that needed some processing, I'd probably write a Makefile instead of a shell script. I also use top-level Makefiles on projects that have their own build systems, so that I don't need to remember how they work every time. People use shell scripts for that stuff too, but Make is better IMO.
It annoys me quite a bit when someone decides not to use autotools or meson, or other standard build tools. I have a build system set up to build static packages for several architectures, and most of my packages are described like this:
name=some
ver=123
url=https://where-to-get/some-$ver.tar.gz
build() {
autotools_build --some-option
}
And it does the right thing for all packages that use autotools.If you roll out your own Makefile, I have to figure out how to build the targets, how to install them, whether you use DESTDIR, whether you respect cross-compile options, how to build static library, how to configure your package... and code all this by hand to build() function.
The same goes for my custom Arch Linux packages.
Make the packagers job easy and just don't roll your own if you want your package to be distributed widely.
At least the OpenBSD developers hated the Linuxisms so much that they made a song "Aquarela do Linux!" to name and shame this:
To be fair: Nothing in GNUiverse teaches you interoperability; I too learned it the hard way when switching from Linux to BSD.
When installing Solaris, Sinix, AIX etc, you'd typically install the GNU tools immediately.
I understand the FreeBSD folks' frustration, though.