1#!/usr/bin/env bash
2
3# Copyright 2013 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# This script regenerates AllAudio.mk based on the content of the other
18# makefiles.
19
20# It needs to be run from its location in the source tree.
21
22cat > AllAudio.mk << EOF
23# Copyright 2013 The Android Open Source Project
24#
25# Licensed under the Apache License, Version 2.0 (the "License");
26# you may not use this file except in compliance with the License.
27# You may obtain a copy of the License at
28#
29#      http://www.apache.org/licenses/LICENSE-2.0
30#
31# Unless required by applicable law or agreed to in writing, software
32# distributed under the License is distributed on an "AS IS" BASIS,
33# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34# See the License for the specific language governing permissions and
35# limitations under the License.
36
37LOCAL_PATH := frameworks/base/data/sounds
38
39PRODUCT_COPY_FILES += \\
40EOF
41
42cat OriginalAudio.mk AudioPackage*.mk |
43  grep \\\$\(LOCAL_PATH\).*: |
44  cut -d : -f 2 |
45  cut -d \  -f 1 |
46  sort -u |
47  while read DEST
48  do
49    echo -n \ \ \ \  >> AllAudio.mk
50    cat *.mk |
51      grep \\\$\(LOCAL_PATH\).*:$DEST |
52      tr -d \ \\t |
53      cut -d : -f 1 |
54      sort -u |
55      tail -n 1 |
56      tr -d \\n >> AllAudio.mk
57    echo :$DEST\ \\ >> AllAudio.mk
58  done
59echo >> AllAudio.mk
60