Skip to content

Instantly share code, notes, and snippets.

@nyrahul
Last active April 10, 2019 10:39
Show Gist options
  • Save nyrahul/25403698c33fb9d108c0205055acf08e to your computer and use it in GitHub Desktop.
Save nyrahul/25403698c33fb9d108c0205055acf08e to your computer and use it in GitHub Desktop.
Makefile trick: disable verbose compilation .. enable verbose only if 'make V=1'
CC=gcc
AR=ar
V = 0
ACTUAL_CC := $(CC)
CC_0 = @echo "CC [$<]"; $(ACTUAL_CC)
CC_1 = $(ACTUAL_CC)
CC = $(CC_$(V))
ACTUAL_AR := $(AR)
AR_0 = @echo "LN [$@]"; $(ACTUAL_AR)
AR_1 = $(ACTUAL_AR)
AR = $(AR_$(V))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment