Add quiet mode to the Makefile system

The standard Makefile output is very noisy and it can be difficult to
filter the interesting information from this noise.

In quiet mode the standard Makefile output will be suppressed and instead a
short human readable description of the current task is shown.

E.g.
	> make adv7511.zed
	Building axi_clkgen library [library/axi_clkgen/axi_clkgen_ip.log] ... OK
	Building axi_hdmi_tx library [library/axi_hdmi_tx/axi_hdmi_tx_ip.log] ... OK
	Building axi_i2s_adi library [library/axi_i2s_adi/axi_i2s_adi_ip.log] ... OK
	Building axi_spdif_tx library [library/axi_spdif_tx/axi_spdif_tx_ip.log] ... OK
	Building util_i2c_mixer library [library/util_i2c_mixer/util_i2c_mixer_ip.log] ... OK
	Building adv7511_zed project [projects/adv7511/zed/adv7511_zed_vivado.log] ... OK

Quiet mode is enabled by default since it generates a more human readable
output. It can be disabled by passing VERBOSE=1 to make or setting the
VERBOSE environment variable to 1 before calling make.

E.g.
	> make adv7511.zed VERBOSE=1
	make[1]: Entering directory 'library/axi_clkgen'
	rm -rf *.cache *.data *.xpr *.log component.xml *.jou xgui
	*.ip_user_files *.srcs *.hw *.sim .Xil .timestamp_altera
	vivado -mode batch -source axi_clkgen_ip.tcl >> axi_clkgen_ip.log 2>&1
	...

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
main
Lars-Peter Clausen 2018-03-25 09:21:37 +02:00 committed by István Csomortáni
parent d8916e681e
commit 1ea3ad28ae
8 changed files with 96 additions and 8 deletions

View File

@ -4,6 +4,9 @@
## Auto-generated, do not modify!
####################################################################################
####################################################################################
include quiet.mk
help:
@echo ""
@echo "Please specify a target."

View File

@ -5,6 +5,8 @@
####################################################################################
####################################################################################
include ../quiet.mk
.PHONY: all lib clean clean-all
all: lib

View File

@ -5,6 +5,8 @@
####################################################################################
####################################################################################
include ../../quiet.mk
M_DEPS := interfaces_ip.tcl
M_DEPS += ../scripts/adi_env.tcl
M_DEPS += ../scripts/adi_ip.tcl
@ -36,10 +38,15 @@ xilinx: if_xcvr_cm.xml if_xcvr_cm_rtl.xml if_xcvr_ch.xml if_xcvr_ch_rtl.xml if_g
clean:clean-all
clean-all:
rm -rf $(M_FLIST)
$(call clean, \
$(M_FLIST), \
interface definitions)
%.xml: $(M_DEPS)
$(M_VIVADO) interfaces_ip.tcl >> interfaces_ip.log 2>&1
$(call build, \
$(M_VIVADO) interfaces_ip.tcl, \
interfaces_ip.log, \
interface definitions)
####################################################################################
####################################################################################

View File

@ -5,6 +5,8 @@
# Assumes this file is in library/scripts/library.mk
HDL_LIBRARY_PATH := $(subst scripts/library.mk,,$(lastword $(MAKEFILE_LIST)))
include $(HDL_LIBRARY_PATH)../quiet.mk
VIVADO := vivado -mode batch -source
CLEAN_TARGET := *.cache
@ -30,7 +32,9 @@ all: altera xilinx
clean: clean-all
clean-all:
rm -rf $(CLEAN_TARGET)
$(call clean, \
$(CLEAN_TARGET), \
$(HL)$(LIBRARY_NAME)$(NC) library)
ifneq ($(ALTERA_DEPS),)
@ -59,7 +63,10 @@ xilinx: xilinx_dep component.xml
component.xml: $(XILINX_DEPS)
-rm -rf $(CLEAN_TARGET)
$(VIVADO) $(LIBRARY_NAME)_ip.tcl >> $(LIBRARY_NAME)_ip.log 2>&1
$(call build, \
$(VIVADO) $(LIBRARY_NAME)_ip.tcl, \
$(LIBRARY_NAME)_ip.log, \
$(HL)$(LIBRARY_NAME)$(NC) library)
xilinx_dep:
@for lib in $(XILINX_LIB_DEPS); do \

View File

@ -6,6 +6,8 @@
HDL_PROJECT_PATH := $(subst scripts/project-altera.mk,,$(lastword $(MAKEFILE_LIST)))
HDL_LIBRARY_PATH := $(HDL_PROJECT_PATH)../library/
include $(HDL_PROJECT_PATH)../quiet.mk
ifeq ($(NIOS2_MMU),)
NIOS2_MMU := 1
endif
@ -62,7 +64,9 @@ all: lib $(PROJECT_NAME).sof
clean:
rm -rf $(CLEAN_TARGET)
$(call clean, \
$(CLEAN_TARGET), \
$(HL)$(PROJECT_NAME)$(NC) project)
clean-all: clean
@for lib in $(LIB_DEPS); do \
@ -71,7 +75,10 @@ clean-all: clean
$(PROJECT_NAME).sof: $(M_DEPS)
-rm -rf $(CLEAN_TARGET)
$(ALTERA) system_project.tcl >> $(PROJECT_NAME)_quartus.log 2>&1
$(call build,\
$(ALTERA) system_project.tcl, \
$(PROJECT_NAME)_quartus.log, \
$(HL)$(PROJECT_NAME)$(NC))
lib:
@for lib in $(LIB_DEPS); do \

View File

@ -2,6 +2,11 @@
## Copyright 2018(c) Analog Devices, Inc.
####################################################################################
# Assumes this file is in projects/scripts/project-toplevel.mk
HDL_PROJECT_PATH := $(subst scripts/project-toplevel.mk,,$(lastword $(MAKEFILE_LIST)))
include $(HDL_PROJECT_PATH)../quiet.mk
SUBDIRS := $(dir $(wildcard */Makefile))
# Create virtual targets "$project/all", "$project/clean", "$project/clean-all"

View File

@ -6,6 +6,8 @@
HDL_PROJECT_PATH := $(subst scripts/project-xilinx.mk,,$(lastword $(MAKEFILE_LIST)))
HDL_LIBRARY_PATH := $(HDL_PROJECT_PATH)../library/
include $(HDL_PROJECT_PATH)../quiet.mk
VIVADO := vivado -mode batch -source
CLEAN_TARGET := *.cache
@ -38,7 +40,9 @@ M_DEPS += $(foreach dep,$(LIB_DEPS),$(HDL_LIBRARY_PATH)$(dep)/component.xml)
all: lib $(PROJECT_NAME).sdk/system_top.hdf
clean:
rm -rf $(CLEAN_TARGET)
$(call clean, \
$(CLEAN_TARGET), \
$(HL)$(PROJECT_NAME)$(NC) project)
clean-all: clean
@for lib in $(LIB_DEPS); do \
@ -47,7 +51,10 @@ clean-all: clean
$(PROJECT_NAME).sdk/system_top.hdf: $(M_DEPS)
-rm -rf $(CLEAN_TARGET)
$(VIVADO) system_project.tcl >> $(PROJECT_NAME)_vivado.log 2>&1
$(call build, \
$(VIVADO) system_project.tcl, \
$(PROJECT_NAME)_vivado.log, \
$(HL)$(PROJECT_NAME)$(NC) project)
lib:
@for lib in $(LIB_DEPS); do \

50
quiet.mk Normal file
View File

@ -0,0 +1,50 @@
####################################################################################
## Copyright 2018(c) Analog Devices, Inc.
####################################################################################
ifdef MAKE_TERMOUT
ESC:=$(shell printf '\033')
GREEN:=$(ESC)[1;32m
RED:=$(ESC)[1;31m
HL:=$(ESC)[0;33m
NC:=$(ESC)[0m
else
GREEN:=
RED:=
HL:=
NC:=
endif
ifneq ($(VERBOSE),1)
MAKEFLAGS += --quiet
# build - Run a build command
# $(1): Command to execute
# $(2): Logfile name
# $(3): Textual description of the task
define build
@echo -n "Building $(strip $(3)) [$(HL)$(CURDIR)/$(strip $(2))$(NC)] ..."
$(strip $(1)) >> $(strip $(2)) 2>&1; \
(ERR=$$?; if [ $$ERR = 0 ]; then \
echo " $(GREEN)OK$(NC)"; \
else \
echo " $(RED)FAILED$(NC)\nFor details see $(HL)$(CURDIR)/$(strip $(2))$(NC)\n"; \
fi; exit $$ERR)
endef
# clean - Run a clean command
# $(1): Files to remove
# $(2): Textural description of the task
define clean
@echo "Cleaning $(strip $(2)) ..."
-rm -rf $(strip $(1))
endef
else
define build
$(strip $(1)) >> $(strip $(2)) 2>&1
endef
define clean
-rm -rf $(strip $(1))
endef
endif