Reputation:
when Makefile execute some tasks, il will print many information in console, can we choose to hide them? when I have many .o to generate, these information will be too many to see and they are just meaningless if we don't read them.
The following code
$(obj)environment.o: $(src)environment.c
$(CC) $(AFLAGS) -Wa, --no-warn \
-DENV_CRC=$(shell $(obj)../tools/envcrc) \
-c -o $@ $(src)environment.c
will print heavy information like
arm-linux-gcc -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float
-D__KERNEL__ -DTEXT_BASE=0x01000000
-I/home/mingzhao/Documents/bootloader/u-boot-1.2.0/include
-fno-builtin -ffreestanding -nostdinc -isystem
/home/mingzhao/Documents/bootloader/arm/4.3.2/bin/../lib/
gcc/arm-none-linux-gnueabi/4.3.2/include -pipe -DCONFIG_ARM
-D__ARM__ -march=armv4 -mabi=apcs-gnu -Wall -Wstrict-prototypes
-c -o environment.o environment.c
Upvotes: 3
Views: 4638
Reputation: 101041
The "right" way to handle this (IMO) is to add this to your makefile:
$(VERBOSE).SILENT:
Then in your rules where you don't ever want the command printed (for example, an echo
statement as in Beta's answer below) you prefix it with @
. For all other commands, you don't prefix it with @
.
What this does is enable "silent" mode by default (because the variable VERBOSE
is not set and so this resolves to the .SILENT
pseudo-target).
Then if you want to see everything, you add a VERBOSE=1
(actually you can set it to any non-empty value, so VERBOSE=true
if you prefer). When you do that it turns off "silent" mode because the above line expands to 1.SILENT:
(or true.SILENT:
or whatever) which is meaningless to make.
Upvotes: 4
Reputation: 2397
You can use this syntax : @$(CC) $(AFLAGS) -Wa, --no-warn \...
Upvotes: 0
Reputation: 99154
I like something like this:
$(obj)environment.o: $(src)environment.c
@echo building $@
@$(CC) $(AFLAGS) -Wa, --no-warn \
-DENV_CRC=$(shell $(obj)../tools/envcrc) \
-c -o $@ $(src)environment.c
The @echo ...
gives a minimal status message, the '@' in front of the $(CC)
suppresses standard output (but still allows error messages).
Upvotes: 1
Reputation: 1669
You can use the option make --silent
which will suppress output for all targets. If you want to suppress output for some commands, you can prefix them by @
Upvotes: 2