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 RM ?= rm -f
PYTHON ?= python3 PYTHON ?= python3
CCACHE ?=
ifeq ($(CLANG),1) ifeq ($(CLANG),1)
CC_normal := clang -target $(TRIPLE) -integrated-as CC_normal := $(CCACHE) clang -target $(TRIPLE) -integrated-as
CX_normal := clang++ -target $(TRIPLE) -integrated-as CX_normal := $(CCACHE) clang++ -target $(TRIPLE) -integrated-as
else else
CC_normal := $(TARGET_PREFIX)gcc -std=gnu99 CC_normal := $(CCACHE) $(TARGET_PREFIX)gcc -std=gnu99
CX_normal := $(TARGET_PREFIX)g++ CX_normal := $(CCACHE) $(TARGET_PREFIX)g++
endif endif
AR_normal := $(TARGET_PREFIX)gcc-ar AR_normal := $(TARGET_PREFIX)gcc-ar
LD_normal := $(TARGET_PREFIX)ld 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 CFLAGS += -DLONG_LONG_MIN=LLONG_MIN -DLONG_LONG_MAX=LLONG_MAX -DLONG_LONG_MIN=LLONG_MIN -DULONG_LONG_MAX=ULLONG_MAX
endif endif
ifeq ($(CCACHE), )
MESON_CROSS_CC = '$(TRIPLE)-gcc'
else
MESON_CROSS_CC = ['$(CCACHE)', '$(TRIPLE)-gcc']
endif
define CROSSFILE define CROSSFILE
[binaries] [binaries]
c = '$(TRIPLE)-gcc' c = $(MESON_CROSS_CC)
ar = '$(TRIPLE)-gcc-ar' ar = '$(TRIPLE)-gcc-ar'
as = '$(TRIPLE)-as' as = '$(TRIPLE)-as'
nm = '$(TRIPLE)-gcc-nm' nm = '$(TRIPLE)-gcc-nm'
@ -60,4 +66,3 @@ libc.a: $(LIBC_DIRECTORY)/missing.c _libc.a
$(compile) $(compile)
$(AR) csr _libc.a $@ $(AR) csr _libc.a $@
cp _libc.a libc.a cp _libc.a libc.a