• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env sh
2# The copyright in this software is being made available under the BSD License,
3# included below. This software may be subject to other third party and
4# contributor rights, including patent rights, and no such rights are granted
5# under this license.
6#
7# Copyright (c) Intel Corporation
8#
9# All rights reserved.
10#
11# BSD License
12#
13# Redistribution and use in source and binary forms, with or without modification,
14# are permitted provided that the following conditions are met:
15#
16# Redistributions of source code must retain the above copyright notice, this list
17# of conditions and the following disclaimer.
18#
19# Redistributions in binary form must reproduce the above copyright notice, this
20# list of conditions and the following disclaimer in the documentation and/or
21# other materials provided with the distribution.
22#
23# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
24# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34AUTORECONF=${AUTORECONF:-autoreconf}
35
36# generate list of source files for use in Makefile.am
37# if you add new source files, you must run ./bootstrap again
38src_listvar () {
39    basedir=$1
40    suffix=$2
41    var=$3
42
43    find "${basedir}" -name "${suffix}" | LC_ALL=C sort | tr '\n' ' ' | (printf "${var} = " && cat)
44    echo ""
45}
46
47echo "Generating file lists: src.mk"
48(
49    src_listvar "Platform" "*.c" "PLATFORM_C"
50    src_listvar "Platform" "*.h" "PLATFORM_H"
51    src_listvar "Simulator" "*.c" "SIMULATOR_C"
52    src_listvar "Simulator" "*.h" "SIMULATOR_H"
53    src_listvar "tpm" "*.c" "TPM_C"
54    src_listvar "tpm" "*.h" "TPM_H"
55) > src.mk
56
57echo "Setting up build"
58${AUTORECONF} --install --sym
59
60# A freshly checked out source tree will not build. VendorString.h must have
61# these symbols defined to build.
62echo "Setting default vendor strings"
63sed -i 's&^\/\/\(#define[[:space:]]\+FIRMWARE_V1.*\)&\1&;
64        s&^\/\/\(#define[[:space:]]\+MANUFACTURER.*\)&\1&;
65        s&^\/\/\(#define[[:space:]]\+VENDOR_STRING_1.*\)&\1&' \
66       tpm/include/VendorString.h
67