Browse Source

Merge pull request #3035 from kaspar030/add_ccache_support

make: add ccache support
dev/timer
Kaspar Schleiser 8 years ago
parent
commit
26195bf275
  1. 4
      Makefile.base
  2. 3
      Makefile.buildtests
  3. 5
      Makefile.include
  4. 35
      dist/Dockerfile

4
Makefile.base

@ -57,13 +57,13 @@ CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS)
# compile and generate dependency info
$(OBJC): $(BINDIR)$(MODULE)/%.o: %.c
$(AD)$(CC) \
$(AD)$(CCACHE) $(CC) \
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \
-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
$(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
$(OBJCXX): $(BINDIR)$(MODULE)/%.o: %.cpp
$(AD)$(CXX) \
$(AD)$(CCACHE) $(CXX) \
-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \
-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
$(CXXFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)

3
Makefile.buildtests

@ -48,6 +48,9 @@ buildtest:
HOME=$${HOME} \
PATH=$${PATH} \
BOARD=$${BOARD} \
CCACHE=$${CCACHE} \
CCACHE_DIR=$${CCACHE_DIR} \
CCACHE_BASEDIR=$${CCACHE_BASEDIR} \
RIOTBASE=$${RIOTBASE} \
RIOTBOARD=$${RIOTBOARD} \
RIOTCPU=$${RIOTCPU} \

5
Makefile.include

@ -152,7 +152,12 @@ ifeq ($(origin RIOT_VERSION), undefined)
RIOT_VERSION := "UNKNOWN (builddir: $(RIOTBASE))"
endif
endif
ifneq (,$(RIOT_VERSION_OVERRIDE))
export CFLAGS += -DRIOT_VERSION=\"$(RIOT_VERSION_OVERRIDE)\"
else
export CFLAGS += -DRIOT_VERSION=\"$(RIOT_VERSION)\"
endif
# the binaries to link
BASELIBS += $(BINDIR)$(BOARD)_base.a

35
dist/Dockerfile vendored

@ -10,6 +10,14 @@
# Usage:
# 3. cd to riot root
# 4. # docker run -i -t -u $UID -v $(pwd):/data/riotbuild riotbuild ./dist/tools/compile_test/compile_test.py
#
# If you want to use a persistent ccache, map a directory to '/data/ccache'
# and set CCACHE=ccache:
#
# 4. # docker run -i -t -u $UID -v $(pwd):/data/riotbuild -v /tmp/riot_ccache:/data/ccache \
# -e CCACHE=ccache -e RIOT_VERSION_OVERRIDE=buildtest \
# riotbuild ./dist/tools/compile_test/compile_test.py
#
FROM ubuntu
@ -23,16 +31,23 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key FE324A81C208C89497EF
RUN apt-get update
RUN apt-get -y dist-upgrade
RUN apt-get -y install build-essential
RUN apt-get -y install git
RUN apt-get -y install gcc-multilib
RUN apt-get -y install gcc-arm-none-eabi
RUN apt-get -y install gcc-msp430
RUN apt-get -y install pcregrep libpcre3
RUN apt-get -y install qemu-system-x86 python3
RUN apt-get -y install g++-multilib
RUN apt-get -y install gcc-avr binutils-avr avr-libc
RUN apt-get -y install subversion curl wget python p7zip unzip
RUN apt-get -y install build-essential \
git \
gcc-multilib \
gcc-arm-none-eabi \
gcc-msp430 \
pcregrep libpcre3 \
qemu-system-x86 python3 \
g++-multilib \
gcc-avr binutils-avr avr-libc \
subversion curl wget python p7zip unzip
RUN wget http://launchpadlibrarian.net/206632429/ccache_3.2.2-2_amd64.deb \
-O /tmp/ccache_3.2.2-2_amd64.deb \
&& dpkg -i /tmp/ccache_3.2.2-2_amd64.deb
RUN mkdir -m 777 -p /data/ccache
ENV CCACHE_DIR /data/ccache
RUN mkdir -p /data/riotbuild
WORKDIR /data/riotbuild

Loading…
Cancel
Save