1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 #############################################################################
12 # Cache operations - only used when building through ci/build.sh
14 # This is the global cache implementation, providing the main target "cache"
15 # which is called from ci/build.sh, and recursively calling the cache
16 # operations clean-cache, get-cache and put-cache on all $(SUBDIRS).
17 #############################################################################
20 export CACHETOOL := $(BUILD_BASE)/cache.sh
23 SUBGETCACHE = $(addsuffix .getcache,$(SUBDIRS))
24 $(SUBGETCACHE): %.getcache:
25 $(MAKE) -C $* -f Makefile get-cache
27 SUBPUTCACHE = $(addsuffix .putcache,$(SUBDIRS))
28 $(SUBPUTCACHE): %.putcache:
29 $(MAKE) -C $* -f Makefile put-cache
31 SUBCLEANCACHE = $(addsuffix .cleancache,$(SUBDIRS))
32 $(SUBCLEANCACHE): %.cleancache:
33 $(MAKE) -C $* -f Makefile clean-cache
35 # Overlay implementation:
37 # - clean cache identities
42 cached-all: clean clean-cache $(SUBCLEANCACHE) get-cache $(SUBGETCACHE) iso put-cache $(SUBPUTCACHE)
43 @echo "Cached build is complete"
46 # cache: The target for ci/build.sh
49 @if [ -z "${CACHEBASE}" ]; then \
50 echo "CACHEBASE not set, are you really building through build.sh?"; \
53 @docker version >/dev/null 2>&1 || (echo 'No Docker installation available'; exit 1)
54 @make -C docker get-cache all
55 docker/runcontext $(DOCKERIMG) $(MAKE) $(MAKEFLAGS) cached-all