Skip to content

Commit d261ba6

Browse files
zx2c4kuba-moo
authored andcommitted
wireguard: selftests: restore support for ccache
When moving to non-system toolchains, we inadvertantly killed the ability to use ccache. So instead, build ccache support into the test harness directly. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent d5d9b29 commit d261ba6

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
build/
33
distfiles/
4+
ccache/

tools/testing/selftests/wireguard/qemu/Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@ $(info Building for $(CHOST) using $(CBUILD))
266266
export CROSS_COMPILE := $(CHOST)-
267267
export PATH := $(TOOLCHAIN_PATH)/bin:$(PATH)
268268
export CC := $(CHOST)-gcc
269+
CCACHE_PATH := $(shell which ccache 2>/dev/null)
270+
ifneq ($(CCACHE_PATH),)
271+
export KBUILD_BUILD_TIMESTAMP := Fri Jun 5 15:58:00 CEST 2015
272+
export PATH := $(TOOLCHAIN_PATH)/bin/ccache:$(PATH)
273+
export CCACHE_SLOPPINESS := file_macro,time_macros
274+
export CCACHE_DIR ?= $(PWD)/ccache
275+
endif
269276

270277
USERSPACE_DEPS := $(TOOLCHAIN_PATH)/.installed $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.installed
271278

@@ -329,6 +336,10 @@ $(TOOLCHAIN_PATH)/.installed: $(TOOLCHAIN_TAR)
329336
mkdir -p $(BUILD_PATH)
330337
flock -s $<.lock tar -C $(BUILD_PATH) -xf $<
331338
$(STRIP) -s $(TOOLCHAIN_PATH)/$(CHOST)/lib/libc.so
339+
ifneq ($(CCACHE_PATH),)
340+
mkdir -p $(TOOLCHAIN_PATH)/bin/ccache
341+
ln -s $(CCACHE_PATH) $(TOOLCHAIN_PATH)/bin/ccache/$(CC)
342+
endif
332343
touch $@
333344

334345
$(IPERF_PATH)/.installed: $(IPERF_TAR)
@@ -421,8 +432,13 @@ clean:
421432
distclean: clean
422433
rm -rf $(DISTFILES_PATH)
423434

435+
cacheclean: clean
436+
ifneq ($(CCACHE_DIR),)
437+
rm -rf $(CCACHE_DIR)
438+
endif
439+
424440
menuconfig: $(KERNEL_BUILD_PATH)/.config
425441
$(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) menuconfig
426442

427-
.PHONY: qemu build clean distclean menuconfig
443+
.PHONY: qemu build clean distclean cacheclean menuconfig
428444
.DELETE_ON_ERROR:

0 commit comments

Comments
 (0)