Next: , Previous: Macros and Submakes, Up: Portable Make


12.8 The Make Macro MAKEFLAGS

Posix requires make to use MAKEFLAGS to affect the current and recursive invocations of make, but allows implementations several formats for the variable. It is tricky to parse $MAKEFLAGS to determine whether -s for silent execution or -k for continued execution are in effect. For example, you cannot assume that the first space-separated word in $MAKEFLAGS contains single-letter options, since in the Cygwin version of GNU make it is either --unix or --win32 with the second word containing single-letter options.

     $ cat Makefile
     all:
             @echo MAKEFLAGS = $(MAKEFLAGS)
     $ make
     MAKEFLAGS = --unix
     $ make -k
     MAKEFLAGS = --unix -k