OSDN Git Service

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