0

I use makefile in windows (make version: GNU Make 4.2.1 Built for i686-pc-msys), I try to suppress the printouts of the command, some are suppressed and some return an error.

if I do

VERBOSE := 0
ifeq ($(VERBOSE), 0)
    export HIDE := @
else
    export HIDE :=
endif
$(TARGET_RTOS_LIB) : $(RTOS_SW_BLOCK) $(MAKEFILE)
    $(HIDE)cd $(GNSS_OUT_PATH)

It works. But if when I do:

ARM_TOOL_PATH := $(ROOT_DIR)build/10_2021.10/bin
$(TARGET_PKG): MakeDirs $(MAKEFILE)
    AR = $(HIDE)$(ARM_TOOL_PATH)/arm-none-eabi-ar.exe
    $(AR) $(ARFLAGS) $@ $(notdir $(OBJS))

I get the following error:

/bin/sh: @/c/Work/GitProjects/GNSS_1350/build/10_2021.10/bin/arm-none-eabi-ar.exe: No such file or directory

What am I missing? I tried writting the full path without using ARM_TOOL_PATH, I also tried adding the tool path to Windows path and only use @arm-none-eabi-ar.exe but I get the same result

Thank you for your help

Clonimus74
  • 19
  • 3
  • The above input does not look like a makefile -- your first few lines are proper makefile directives, which I would expect to see in the global scope of the makefile, but then the next lines look like they are intended to be either run from either inside of a recipe, or from `$(shell ...)` invocation. Please edit your question with more information (Also, include your make version as it may be relevant). – HardcoreHenry Jan 16 '22 at 17:15
  • You could try assign `AR` and `ARM_TOOL_PATH` using `:=` instead, expanding the variable at assignment rather than at the time of expansion. Unrelated, you may be interested of the `--silent` flag: https://www.gnu.org/software/make/manual/make.html#Echoing – Andreas Jan 16 '22 at 17:15
  • A useful trick for managing this is mentioned here: http://make.mad-scientist.net/managing-recipe-echoing/ – MadScientist Jan 16 '22 at 19:10
  • It is within a reipe, sorry, I tried to be concise – Clonimus74 Jan 16 '22 at 19:53
  • Is there a reason you don't simply use `make -s` when you don't want to see what's happening? – tripleee Jan 17 '22 at 10:15

1 Answers1

0

Thank you to @Andreas and @MadScientist for pointing me to the right direction

I did the following:

export VERBOSE := 0

ifeq ($(VERBOSE), 0)
export HIDE := @
else
export UNSILENT := 1
export HIDE :=
endif

and added the following line to every makefile

$(UNSILENT).SILENT:
Clonimus74
  • 19
  • 3
  • I can see no reason to `export` these variables. The `HIDE` variable now seems completely redundant. – tripleee Jan 17 '22 at 10:14
  • I find most solutions in https://stackoverflow.com/questions/24005166/gnu-make-silent-by-default superior to this one. Leaving link here for anyone interested. – Andreas Jan 17 '22 at 12:58