BTW we use a slightly different and, I think, slightly improved version of what's shown there (see below). Improvements are:
1. Either the verbose or the concise output is shown, vs both in verbose mode as the original does.
2. It uses $(info ...) instead of echo which saves a fork/exec per recipe (note: this is safe only when used in the first recipe line).
3. It provides a default "MAKING $@" message as demonstrated in the example.
4. A special case is used to ensure the clean target is always verbose.
David
$ cat Makefile
.PHONY: all
all: hola
ifeq ($(V),)
vb = $(info $(or $1,MAKING $(@F)))
.SILENT:
endif
hola: hola.o
$(call vb)
$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)
%.o: %.c
$(call vb,CC $(<F) -> $(@F))
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
.PHONY: clean
clean: clean_recipe = $(RM) *.o hola
clean:
@$(info $(clean_recipe))
@$(clean_recipe)
$ make clean; make
rm -f *.o hola
CC hola.c -> hola.o
MAKING hola
$ make clean; make V=1
rm -f *.o hola
cc -c -o hola.o hola.c
cc -o hola hola.o