Makefile: low verbosity by default
This commit is contained in:
parent
716b51bc2a
commit
8150199581
15
Makefile
15
Makefile
|
@ -53,7 +53,7 @@ else
|
||||||
$(MAKE) LD=$(CC) $(HANDLE_OUTPUT)
|
$(MAKE) LD=$(CC) $(HANDLE_OUTPUT)
|
||||||
EXE_SUFFIX :=
|
EXE_SUFFIX :=
|
||||||
endif
|
endif
|
||||||
BUILD_NIM := echo "Building the Nim compiler." && \
|
BUILD_NIM := echo -e $(BUILD_MSG) "Nim compiler" && \
|
||||||
cd $(NIM_DIR) && \
|
cd $(NIM_DIR) && \
|
||||||
rm -rf bin/nim_csources csources dist/nimble && \
|
rm -rf bin/nim_csources csources dist/nimble && \
|
||||||
ln -s ../Nim-csources csources && \
|
ln -s ../Nim-csources csources && \
|
||||||
|
@ -90,16 +90,21 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
|
||||||
# default target, because it's the first one that doesn't start with '.'
|
# default target, because it's the first one that doesn't start with '.'
|
||||||
all: $(TOOLS) nimbus
|
all: $(TOOLS) nimbus
|
||||||
|
|
||||||
|
#- when the special ".SILENT" target is present, all recipes are silenced as if they all had a "@" prefix
|
||||||
|
#- by setting SILENT_TARGET_PREFIX to a non-empty value, the name of this target becomes meaningless to `make`
|
||||||
|
#- idea stolen from http://make.mad-scientist.net/managing-recipe-echoing/
|
||||||
|
$(SILENT_TARGET_PREFIX).SILENT:
|
||||||
|
|
||||||
# builds the tools, wherever they are
|
# builds the tools, wherever they are
|
||||||
$(TOOLS): | build deps
|
$(TOOLS): | build deps
|
||||||
for D in $(TOOLS_DIRS); do [ -e "$${D}/$@.nim" ] && TOOL_DIR="$${D}" && break; done && \
|
for D in $(TOOLS_DIRS); do [ -e "$${D}/$@.nim" ] && TOOL_DIR="$${D}" && break; done && \
|
||||||
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -o:build/$@ "$${TOOL_DIR}/$@.nim" && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
echo -e "\nThe binary is in './build/$@'.\n"
|
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -o:build/$@ "$${TOOL_DIR}/$@.nim"
|
||||||
|
|
||||||
# a phony target, because teaching `make` how to do conditional recompilation of Nim projects is too complicated
|
# a phony target, because teaching `make` how to do conditional recompilation of Nim projects is too complicated
|
||||||
nimbus: | build deps
|
nimbus: | build deps
|
||||||
$(ENV_SCRIPT) nim nimbus $(NIM_PARAMS) nimbus.nims && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
echo -e "\nThe binary is in './build/nimbus'.\n"
|
$(ENV_SCRIPT) nim nimbus $(NIM_PARAMS) nimbus.nims
|
||||||
|
|
||||||
# dir
|
# dir
|
||||||
build:
|
build:
|
||||||
|
|
|
@ -124,11 +124,11 @@ You can now follow those instructions in the previous section by replacing `make
|
||||||
|
|
||||||
- the Premix debugging tools are [documented separately](premix/readme.md)
|
- the Premix debugging tools are [documented separately](premix/readme.md)
|
||||||
|
|
||||||
- you can control the Makefile's verbosity with the V variable (defaults to 1):
|
- you can control the Makefile's verbosity with the V variable (defaults to 0):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make V=0 # quiet
|
make V=1 # verbose
|
||||||
make V=2 test # more verbose than usual
|
make V=2 test # even more verbose
|
||||||
```
|
```
|
||||||
|
|
||||||
- same for the [Chronicles log level](https://github.com/status-im/nim-chronicles#chronicles_log_level):
|
- same for the [Chronicles log level](https://github.com/status-im/nim-chronicles#chronicles_log_level):
|
||||||
|
|
|
@ -3,14 +3,18 @@ SHELL := bash # the shell used internally by "make"
|
||||||
#- extra parameters for the Nim compiler
|
#- extra parameters for the Nim compiler
|
||||||
#- NIMFLAGS should come from the environment or make's command line
|
#- NIMFLAGS should come from the environment or make's command line
|
||||||
NIM_PARAMS := $(NIMFLAGS)
|
NIM_PARAMS := $(NIMFLAGS)
|
||||||
|
|
||||||
# verbosity level
|
# verbosity level
|
||||||
V := 1
|
V := 0
|
||||||
NIM_PARAMS := $(NIM_PARAMS) --verbosity:$(V)
|
NIM_PARAMS := $(NIM_PARAMS) --verbosity:$(V)
|
||||||
HANDLE_OUTPUT :=
|
HANDLE_OUTPUT :=
|
||||||
|
SILENT_TARGET_PREFIX := disabled
|
||||||
ifeq ($(V), 0)
|
ifeq ($(V), 0)
|
||||||
NIM_PARAMS := $(NIM_PARAMS) --hints:off --warnings:off
|
NIM_PARAMS := $(NIM_PARAMS) --hints:off --warnings:off
|
||||||
HANDLE_OUTPUT := &>/dev/null
|
HANDLE_OUTPUT := &>/dev/null
|
||||||
|
SILENT_TARGET_PREFIX :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Chronicles log level
|
# Chronicles log level
|
||||||
LOG_LEVEL :=
|
LOG_LEVEL :=
|
||||||
ifdef LOG_LEVEL
|
ifdef LOG_LEVEL
|
||||||
|
@ -22,3 +26,6 @@ COMMA := ,
|
||||||
EMPTY :=
|
EMPTY :=
|
||||||
SPACE := $(EMPTY) $(EMPTY)
|
SPACE := $(EMPTY) $(EMPTY)
|
||||||
|
|
||||||
|
# coloured messages
|
||||||
|
BUILD_MSG := "\\e[92mBuilding:\\e[39m"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue