3 # Copyright (C) 2010 The Android Open Source Project
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # This script is used to automatically generate the <android/api-level.h>
18 # header files under development/ndk
20 . `dirname $0`/prebuilt-common.sh
22 PLATFORMS_DIR=`cd $ANDROID_NDK_ROOT/../development/ndk/platforms && pwd`
23 if [ ! -d "$PLATFORMS_DIR" ] ; then
24 PLATFORMS_DIR=`cd $ANDROID_NDK_ROOT/platforms && pwd`
26 register_var_option "--platform-dir=<path>" PLATFORMS_DIR "Specify target platforms directory."
29 register_var_option "--apis=<list>" APIS "Specify list of API levels."
31 if [ -z "$PLATFORMS_DIR" ] ; then
32 dump "ERROR: Please specify a platforms directory with --platform-dir=<path>"
36 if [ ! -d "$PLATFORMS_DIR" ] ; then
37 dump "ERROR: Your platforms directory does not exist: $PLATFORMS_DIR"
41 dump "Target directory: $PLATFORMS_DIR"
44 if [ ! -d "$PLATFORMS_DIR/android-$API" ] ; then
45 dump "ERROR: Missing platform directory: $PLATFORMS_DIR/android-$DIR"
48 HEADER="android-$API/include/android/api-level.h"
49 dump "Generating: $HEADER"
50 cat > "$PLATFORMS_DIR/$HEADER" <<EOF
52 * Copyright (C) 2008 The Android Open Source Project
53 * All rights reserved.
55 * Redistribution and use in source and binary forms, with or without
56 * modification, are permitted provided that the following conditions
58 * * Redistributions of source code must retain the above copyright
59 * notice, this list of conditions and the following disclaimer.
60 * * Redistributions in binary form must reproduce the above copyright
61 * notice, this list of conditions and the following disclaimer in
62 * the documentation and/or other materials provided with the
65 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
66 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
67 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
68 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
69 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
70 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
71 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
72 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
73 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
74 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
75 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
78 #ifndef ANDROID_API_LEVEL_H
79 #define ANDROID_API_LEVEL_H
81 #define __ANDROID_API__ $API
83 #endif /* ANDROID_API_LEVEL_H */