Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
Makefile: Allow forcing ccache only if KERNEL_USE_CCACHE is defined
Browse files Browse the repository at this point in the history
In order to use ccache, export KERNEL_USE_CCACHE=1

Signed-off-by: Shashank Baghel <[email protected]>
  • Loading branch information
radcolor committed Apr 24, 2021
1 parent 3c765bb commit 73f2fce
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))

export srctree objtree VPATH

ifdef KERNEL_USE_CCACHE
CCACHE := $(shell which ccache)
endif

# SUBARCH tells the usermode build what the underlying arch is. That is set
# first, and if a usermode build is happening, the "ARCH=um" on the command
Expand Down Expand Up @@ -303,8 +305,13 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)

ifdef KERNEL_USE_CCACHE
HOSTCC = $(CCACHE) gcc
HOSTCXX = $(CCACHE) g++
else
HOSTCC = gcc
HOSTCXX = g++
endif
HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
HOSTCXXFLAGS = -O2

Expand Down Expand Up @@ -341,7 +348,11 @@ include scripts/Kbuild.include
# Make variables (CC, etc...)
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
ifdef KERNEL_USE_CCACHE
CC = $(CCACHE) $(CROSS_COMPILE)gcc
else
CC = $(CROSS_COMPILE)gcc
endif
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
Expand Down

0 comments on commit 73f2fce

Please sign in to comment.