[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU make troubleshooting

From: Jeffrey Walton
Subject: Re: GNU make troubleshooting
Date: Mon, 10 Jul 2023 17:17:54 -0400

On Mon, Jul 10, 2023 at 4:45 PM Paul Smith <psmith@gnu.org> wrote:
> [...]
> > That's like peppering a program with printf's. I would like to
> > understand why a statement was (or was not) evaluated, and if
> > evaluated the result, but there is no option with the effect of
> > Bash's 'set +x'.
> I think I don't quite understand this.  Basically EVERY line in make is
> always evaluated, unless it's inside an if-statement.  Makefiles are
> not like shell scripts, where you can skip sections or return early
> before some parts are parsed.  The entire makefile is parsed before any
> rules are invoked.

Yes, lots of conditionals and lots of shell'ing, like:

GREP ?= grep
SED ?= sed

ifneq ($(wildcard /usr/xpg4/bin/grep),)
  GREP := /usr/xpg4/bin/grep
ifneq ($(wildcard /usr/xpg4/bin/sed),)
  SED := /usr/xpg4/bin/sed

SUN_COMPILER := $(shell $(CXX) -V 2>&1 | $(GREP) -i -c -E 'CC: (Sun|Studio)')
GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -v -E
'(llvm|clang)' | $(GREP) -i -c -E '(gcc|g\+\+)')
XLC_COMPILER := $(shell $(CXX) -qversion 2>/dev/null |$(GREP) -i -c "IBM XL")
CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c
-E '(llvm|clang)')
INTEL_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c


reply via email to

[Prev in Thread] Current Thread [Next in Thread]