From c3010935141fe60eabdd7dac60153af6281bc74c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 3 Oct 2017 17:16:37 +0200 Subject: Makefile: add non-verbose mode to tools --- src/Makefile | 5 ++++- src/tools/Makefile | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index fca65d2..d47473e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,7 +7,7 @@ DKMSDIR ?= $(SRCDIR)/wireguard PWD := $(shell pwd) all: module tools -debug: module-debug tools +debug: module-debug tools-debug version.h: @export GIT_CEILING_DIRECTORIES="$$(readlink -f ../..)" && \ @@ -58,6 +58,9 @@ dkms-install: $(DKMS_TOP_LEVEL) $(DKMS_SELFTEST_LEVEL) $(DKMS_CRYPTO_LEVEL) $(DK tools: $(MAKE) -C tools +tools-debug: + $(MAKE) -C tools V=1 DEBUG_TOOLS=y + check: $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__" CONFIG_WIREGUARD_DEBUG=y $(MAKE) -C tools check diff --git a/src/tools/Makefile b/src/tools/Makefile index 2dd7f6a..1407de4 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -36,6 +36,9 @@ CFLAGS += -std=gnu11 -D_GNU_SOURCE CFLAGS += -Wall -Wextra CFLAGS += -MMD -MP CFLAGS += -DRUNSTATEDIR="\"$(RUNSTATEDIR)\"" +ifeq ($(DEBUG_TOOLS),y) +CFLAGS += -g +endif ifeq ($(shell uname -s),Linux) LIBMNL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmnl 2>/dev/null) LIBMNL_LDLIBS := $(shell $(PKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl) @@ -43,10 +46,25 @@ CFLAGS += $(LIBMNL_CFLAGS) LDLIBS += $(LIBMNL_LDLIBS) endif +ifneq ($(V),1) +BUILT_IN_LINK.o := $(LINK.o) +LINK.o = @echo " LD $@"; +LINK.o += $(BUILT_IN_LINK.o) +BUILT_IN_COMPILE.c := $(COMPILE.c) +COMPILE.c = @echo " CC $@"; +COMPILE.c += $(BUILT_IN_COMPILE.c) +endif + wg: $(patsubst %.c,%.o,$(wildcard *.c)) +ifneq ($(V),1) clean: - rm -f wg *.o *.d + @echo " RM " 'wg *.o *.d' + @$(RM) wg *.o *.d +else +clean: + $(RM) wg *.o *.d +endif install: wg @install -v -d "$(DESTDIR)$(BINDIR)" && install -m 0755 -v wg "$(DESTDIR)$(BINDIR)/wg" -- cgit v1.2.3-59-g8ed1b