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 18 TOOLS_DIR=$(realpath $(dirname $0)) 19 LTP_ANDROID_DIR=$(realpath $TOOLS_DIR/..) 20 LTP_ROOT=$(realpath $LTP_ANDROID_DIR/..) 21 CUSTOM_CFLAGS_PATH=$TOOLS_DIR/custom_cflags.json 22 OUTPUT_MK=$LTP_ANDROID_DIR/Android.ltp.mk 23 OUTPUT_PLIST=$LTP_ANDROID_DIR/ltp_package_list.mk 24 OUTPUT_BP=$LTP_ROOT/gen.bp 25 26 if ! [ -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 32 fi 33 34 cd $TOOLS_DIR 35 36 case $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 ;; 47 esac 48 49 if ! [ -f $TOOLS_DIR/make_dry_run.dump ]; then 50 echo "LTP make dry_run not dumped. Dumping..." 51 ./dump_make_dryrun.sh 52 fi 53 54 cat $LTP_ANDROID_DIR/AOSP_license_text.txt > $OUTPUT_MK 55 echo "" >> $OUTPUT_MK 56 echo "# This file is autogenerated by $(basename $0)" >> $OUTPUT_MK 57 echo "" >> $OUTPUT_MK 58 59 cat $LTP_ANDROID_DIR/AOSP_license_text.txt > $OUTPUT_PLIST 60 echo "" >> $OUTPUT_PLIST 61 echo "# This file is autogenerated by $(basename $0)" >> $OUTPUT_PLIST 62 echo "" >> $OUTPUT_PLIST 63 64 sed "s%#%//%" $LTP_ANDROID_DIR/AOSP_license_text.txt > $OUTPUT_BP 65 echo "" >> $OUTPUT_BP 66 echo "// This file is autogenerated by $(basename $0)" >> $OUTPUT_BP 67 echo "" >> $OUTPUT_BP 68 69 python 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