Skip to content

Commit

Permalink
Add ccache support
Browse files Browse the repository at this point in the history
  • Loading branch information
rasky committed Nov 16, 2024
1 parent c9c142a commit dcff22d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ if [[ $OSTYPE == 'msys' ]]; then
fi
fi

# Check if ccache is installed, and if so, use it
if command -v ccache &> /dev/null; then
export CCACHE=ccache
fi

makeWithParams(){
make -j"${JOBS}" "$@"
}
Expand Down
4 changes: 2 additions & 2 deletions n64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ N64_GCCPREFIX_TRIPLET = $(N64_GCCPREFIX)/bin/mips64-elf-

COMMA:=,

N64_CC = $(N64_GCCPREFIX_TRIPLET)gcc
N64_CXX = $(N64_GCCPREFIX_TRIPLET)g++
N64_CC = $(CCACHE) $(N64_GCCPREFIX_TRIPLET)gcc
N64_CXX = $(CCACHE) $(N64_GCCPREFIX_TRIPLET)g++
N64_AS = $(N64_GCCPREFIX_TRIPLET)as
N64_AR = $(N64_GCCPREFIX_TRIPLET)ar
N64_LD = $(N64_GCCPREFIX_TRIPLET)ld
Expand Down
4 changes: 2 additions & 2 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ all:

%.o: %.c
@echo " [CC] $@"
$(CC) $(CFLAGS) -c -o $@ $<
$(CCACHE) $(CC) $(CFLAGS) -c -o $@ $<
%.o: %.cpp
@echo " [CXX] $@"
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(CCACHE) $(CXX) $(CXXFLAGS) -c -o $@ $<
%.a:
@echo " [AR] $@"
rm -f $@
Expand Down

0 comments on commit dcff22d

Please sign in to comment.