• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2#
3# Copyright 2016 - The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18TOOLS_DIR=$(realpath $(dirname $0))
19LTP_ANDROID_DIR=$(realpath $TOOLS_DIR/..)
20LTP_ROOT=$(realpath $LTP_ANDROID_DIR/..)
21CUSTOM_CFLAGS_PATH=$TOOLS_DIR/custom_cflags.json
22OUTPUT_MK=$LTP_ANDROID_DIR/Android.ltp.mk
23OUTPUT_PLIST=$LTP_ANDROID_DIR/ltp_package_list.mk
24OUTPUT_BP=$LTP_ROOT/gen.bp
25
26if ! [ -f $LTP_ROOT/include/config.h ]; then
27  echo "LTP has not been configured."
28  echo "Executing \"cd $LTP_ROOT; make autotools; ./configure\""
29  cd $LTP_ROOT
30  make autotools
31  $LTP_ROOT/configure
32fi
33
34cd $TOOLS_DIR
35
36case $1 in
37  -u|--update)
38    echo "Update option enabled. Regenerating..."
39    rm -rf *.dump
40    ./dump_make_dryrun.sh
41    ;;
42  -h|--help)
43    echo "Generate Android.ltp.mk / gen.bp."
44    echo "Please use \"--update\" option to update and regenerate Android.ltp.mk / gen.bp."
45    exit 0
46    ;;
47esac
48
49if ! [ -f $TOOLS_DIR/make_dry_run.dump ]; then
50  echo "LTP make dry_run not dumped. Dumping..."
51  ./dump_make_dryrun.sh
52fi
53
54cat $LTP_ANDROID_DIR/AOSP_license_text.txt > $OUTPUT_MK
55echo "" >> $OUTPUT_MK
56echo "# This file is autogenerated by $(basename $0)" >> $OUTPUT_MK
57echo "" >> $OUTPUT_MK
58
59cat $LTP_ANDROID_DIR/AOSP_license_text.txt > $OUTPUT_PLIST
60echo "" >> $OUTPUT_PLIST
61echo "# This file is autogenerated by $(basename $0)" >> $OUTPUT_PLIST
62echo "" >> $OUTPUT_PLIST
63
64sed "s%#%//%" $LTP_ANDROID_DIR/AOSP_license_text.txt > $OUTPUT_BP
65echo "" >> $OUTPUT_BP
66echo "// This file is autogenerated by $(basename $0)" >> $OUTPUT_BP
67echo "" >> $OUTPUT_BP
68
69python android_build_generator.py --ltp_root $LTP_ROOT --output_mk_path $OUTPUT_MK \
70    --output_bp_path $OUTPUT_BP --output_plist_path $OUTPUT_PLIST \
71    --custom_cflags_file $CUSTOM_CFLAGS_PATH
72