I have a makefile that includes several other makefiles and uses recursive make in numerous places.
I'm trying to have make print its database of targets (-p) without running them. This should simply be achievable with make -pn, however it isn't working. The recipes are being run despite -n being passed.
- I've checked many times and every invocation of - makeinside every file is via- $(MAKE), so I would expect this to work.
- Removing - -pmakes no difference,- make --dry-runstill executes commands.
- The issue appears to affect all - makes, not just sub-makes.
Is there anything I'm missing? I'm on GNU Make 4.3 on Alpine.
I'm using these special variables/targets which may affect the outcome:
.ONESHELL:
.SILENT:
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -exc
export MAKELEVEL
 
                        
Here's a quick example to prove that it works as expected:
Now run without
-n:We can see the recipe was run and the shell echos
hi. Now run with-n:Here it prints the command to run, but doesn't actually run it.
No need to add
-$(MAKEFLAGS)to the sub-make invocation.