Add option in Makefile for (s)ccache support.

This commit is contained in:
William D. Jones 2021-10-29 21:04:05 -04:00
parent 2a775e1493
commit 86ef4e95a5
2 changed files with 12 additions and 6 deletions

View File

@ -6,13 +6,14 @@ endif
RM ?= rm -f
PYTHON ?= python3
CCACHE ?=
ifeq ($(CLANG),1)
CC_normal := clang -target $(TRIPLE) -integrated-as
CX_normal := clang++ -target $(TRIPLE) -integrated-as
CC_normal := $(CCACHE) clang -target $(TRIPLE) -integrated-as
CX_normal := $(CCACHE) clang++ -target $(TRIPLE) -integrated-as
else
CC_normal := $(TARGET_PREFIX)gcc -std=gnu99
CX_normal := $(TARGET_PREFIX)g++
CC_normal := $(CCACHE) $(TARGET_PREFIX)gcc -std=gnu99
CX_normal := $(CCACHE) $(TARGET_PREFIX)g++
endif
AR_normal := $(TARGET_PREFIX)gcc-ar
LD_normal := $(TARGET_PREFIX)ld

View File

@ -9,9 +9,15 @@ ifeq ($(CPU), microwatt)
CFLAGS += -DLONG_LONG_MIN=LLONG_MIN -DLONG_LONG_MAX=LLONG_MAX -DLONG_LONG_MIN=LLONG_MIN -DULONG_LONG_MAX=ULLONG_MAX
endif
ifeq ($(CCACHE), )
MESON_CROSS_CC = '$(TRIPLE)-gcc'
else
MESON_CROSS_CC = ['$(CCACHE)', '$(TRIPLE)-gcc']
endif
define CROSSFILE
[binaries]
c = '$(TRIPLE)-gcc'
c = $(MESON_CROSS_CC)
ar = '$(TRIPLE)-gcc-ar'
as = '$(TRIPLE)-as'
nm = '$(TRIPLE)-gcc-nm'
@ -60,4 +66,3 @@ libc.a: $(LIBC_DIRECTORY)/missing.c _libc.a
$(compile)
$(AR) csr _libc.a $@
cp _libc.a libc.a