update-makefiles.sh revision 877f4686954776b808a8a31a5c13548588a73a62
1#!/bin/bash 2 3#TODO(b/35916648) : Cleanup script to have a common implementation 4if [ ! -d system/hardware/interfaces ] ; then 5 echo "Where is system/hardware/interfaces?"; 6 exit 1; 7fi 8 9if [ ! -d system/libhidl/transport ] ; then 10 echo "Where is system/libhidl/transport?"; 11 exit 1; 12fi 13 14packages=$(pushd system/hardware/interfaces > /dev/null; \ 15 find . -type f -name \*.hal -exec dirname {} \; | sort -u | \ 16 cut -c3- | \ 17 awk -F'/' \ 18 '{printf("android.system"); for(i=1;i<NF;i++){printf(".%s", $i);}; printf("@%s\n", $NF);}'; \ 19 popd > /dev/null) 20 21for p in $packages; do 22 echo "Updating $p"; 23 hidl-gen -Lmakefile -r android.system:system/hardware/interfaces -r android.hidl:system/libhidl/transport $p; 24 rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi 25 hidl-gen -Landroidbp -r android.system:system/hardware/interfaces -r android.hidl:system/libhidl/transport $p; 26 rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi 27done 28 29# subdirectories of system/hardware/interfaces which contain an Android.bp file 30android_dirs=$(find system/hardware/interfaces/*/ \ 31 -name "Android.bp" \ 32 -printf "%h\n" \ 33 | cut -d "/" -f1-3 \ 34 | sort | uniq) 35 36echo "Updating Android.bp files." 37 38for bp_dir in $android_dirs; do 39 bp="$bp_dir/Android.bp" 40 # locations of Android.bp files in specific subdirectory of system/hardware/interfaces 41 android_bps=$(find $bp_dir \ 42 -name "Android.bp" \ 43 ! -path $bp_dir/Android.bp \ 44 -printf "%h\n" \ 45 | sort) 46 47 echo "// This is an autogenerated file, do not edit." > "$bp"; 48 echo "subdirs = [" >> "$bp"; 49 for a in $android_bps; do 50 echo " \"${a#$bp_dir/}\"," >> "$bp"; 51 done 52 echo "]" >> "$bp"; 53done 54