blob: 3f71cefe2e8df5e23db43b5d459d5002972d3719 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001#!/bin/bash
2
Dave Barach8d0f2f02018-03-12 09:31:36 -04003# Copyright (c) 2015 Cisco and/or its affiliates.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at:
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
Ed Warnickecb9cada2015-12-08 15:45:58 -070016build_root=`pwd`
17cd ../
18wsroot=`pwd`
19
20# PATH
Ed Warnickec28b4742016-02-02 19:28:59 -080021if [[ ! $CCACHE_DIR ]];then
22 CCACHE_DIR="$build_root/.ccache"
23fi
Ed Warnickecb9cada2015-12-08 15:45:58 -070024ADD_TO_PATH="$build_root/tools/ccache-bin:$build_root/tools/bin"
25
26# Construct build-config.mk
27cd $build_root
Damjan Marion905a7f52016-07-07 20:27:49 +020028echo SOURCE_PATH = $wsroot > build-config.mk
Ed Warnickecb9cada2015-12-08 15:45:58 -070029echo
30echo Saving PATH settings in `pwd`/path_setup
31echo Source this file later, as needed
32cat >path_setup <<EOF
33#!/bin/bash
34
35export PATH=$ADD_TO_PATH:$PATH
36export CCACHE_DIR=$CCACHE_DIR
37EOF
38
39# regenerate tools/ccache-bin
40rm -rf tools/ccache-bin
41mkdir -p tools/ccache-bin
42
43if [ ! -f /usr/bin/ccache ] ; then
44 echo Please install ccache AYEC and re-run this script
45fi
46
47cd tools/ccache-bin
48for c in gcc g++
49 do
50 if [ -f /usr/bin/ccache ] ; then
51 ln -s /usr/bin/ccache $c
52 else
53 ln -s /usr/bin/gcc
54 fi
55done
56
57cd $wsroot
58
Ed Warnickecb9cada2015-12-08 15:45:58 -070059cd $build_root
60echo Compile native tools
Damjan Marion7cd468a2016-12-19 23:05:39 +010061for tool in tools
Ed Warnickecb9cada2015-12-08 15:45:58 -070062do
63 make V=0 is_build_tool=yes $tool-install
64done
65