build: make NDEBUG=1 and make release build the release profile

- The RELEASE=1 profile replaced 2.42.0's NDEBUG=1 one, but the
  static archives and the container image still build with NDEBUG=1,
  which therefore selected the debug profile: -O0 -g3 with assertions
  on. Both Makefiles accept NDEBUG=1 again, as -O3 -DNDEBUG, and the
  debug profile defines DEBUG. The vendored libfuse follows the same
  profile as mergerfs.
- make release first removes the objects, binaries and stamp under
  build/ and cleans vendored/libfuse, because make only compares
  timestamps: objects from an earlier debug build were otherwise
  linked into the release binary unchanged. Packages and build reports
  in build/pkgs are kept; TEST_release_pkg_preservation checks both.
- make release also builds preload.so. It takes the release defines
  through its own PRELOAD_CPPFLAGS: the global CPPFLAGS add
  _FILE_OFFSET_BITS=64, which would hide its unsuffixed
  open/openat/fopen/creat interposers.
- mergerfs.spec builds the release target, as debian/rules does. The
  distribution's CFLAGS, CXXFLAGS and LDFLAGS still apply.
- The release driver mounts the repository with ":ro,z", not ":ro:z",
  which Podman read as an extra field instead of a mount option.
  TEST_release_metadata runs the driver against a fake podman and
  checks the volume argument and the build report.
- Remove release-installer: build-release has no installer target.
- make help printed a literal "\n" where /bin/sh is bash. Match the
  build.md transcript to its output and document the profiles.

Performance: static archives and the container image go from -O0 with
assertions back to optimized builds, now -O3 -DNDEBUG (2.42.0: -O2
-DNDEBUG). RPM packages keep the distribution's -O2 and no longer
evaluate assertions. A plain make is unoptimized, as before.
This commit is contained in:
Antonio SJ Musumeci 2026-11-29 23:10:53 -05:00
parent 9d12bcf235
commit 3c02e47e47
7 changed files with 307 additions and 17 deletions

View file

@ -84,9 +84,22 @@ $ gmake install # as root
```
$ make help
usage: make
make USE_XATTR=0 - build program without xattrs functionality
make STATIC=1 - build static binary
make LTO=1 - build with link time optimization
usage: make ARG
USE_XATTR=0 - build program without xattrs functionality
STATIC=1 - build static binary
LTO=1 - build with link time optimization
SANITIZE=1 - build with sanitizers (address,undefined,leak)
SANITIZE=list - build with custom sanitizers (comma separated)
CLEANUP=1 - cleanup images between release build process
PKGDIR=/dir/ - location for release build pkgs
GITREF=gitref - gitref to use for release builds
```
A plain `make` builds the debug profile (`-O0 -g3`, assertions
enabled). `make release` builds the binaries and `preload.so` with
`-O3` and assertions disabled. It rebuilds the objects, binaries and
vendored libfuse so debug objects cannot end up in the release build.
It leaves packages and reports in `build/pkgs/` (or your `PKGDIR`)
alone. `make clean` still removes the entire `build/` directory.
`make NDEBUG=1` selects the same release flags without cleaning; the
static package builds use it together with `LTO=1 STATIC=1`.