aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-10-07 13:43:33 -0700
committerDavid 'Digit' Turner <digit@google.com>2009-10-07 13:43:33 -0700
commit065242de51ba1e18387ce22a99eb091a859990f7 (patch)
tree7d53cb54f3f68805de82a5ab48ee6040bcf25d80 /android
parent48ed3267dfffedb65385b0a1f1462fdd46d049bb (diff)
downloadexternal_qemu-065242de51ba1e18387ce22a99eb091a859990f7.zip
external_qemu-065242de51ba1e18387ce22a99eb091a859990f7.tar.gz
external_qemu-065242de51ba1e18387ce22a99eb091a859990f7.tar.bz2
Ensure android/avd/hw-config-defs.h is properly regenerated as needed.
This modifies the emulator's build system to ensure that the file at android/avd/hw-config-defs.h is regenerated automatically each time that android/avd/hardware-properties.ini is itself changed. Tested with both the Android build system, and the standalone one.
Diffstat (limited to 'android')
-rw-r--r--android/main.c2
-rwxr-xr-xandroid/tools/gen-hw-config.py33
2 files changed, 23 insertions, 12 deletions
diff --git a/android/main.c b/android/main.c
index 682cfce..ee1cbdb 100644
--- a/android/main.c
+++ b/android/main.c
@@ -2399,7 +2399,7 @@ int main(int argc, char **argv)
}
/* Check the size of the /data partition. The only interesting cases here are:
- * - when the USERDATA image already exists and is larger than the deffault
+ * - when the USERDATA image already exists and is larger than the default
* - when we're wiping data and the INITDATA is larger than the default.
*/
diff --git a/android/tools/gen-hw-config.py b/android/tools/gen-hw-config.py
index 928ccc5..3822485 100755
--- a/android/tools/gen-hw-config.py
+++ b/android/tools/gen-hw-config.py
@@ -43,12 +43,17 @@ macroNames = typesToMacros.values()
targetHeader = """\
/* this file is automatically generated from 'hardware-properties.ini'
* DO NOT EDIT IT. To re-generate it, use android/tools/gen-hw-config.py'
- */"""
+ */
+"""
# locate source and target
programDir = os.path.dirname(sys.argv[0])
-sourceFile = os.path.normpath(os.path.join(programDir,relativeSourcePath))
-targetFile = os.path.normpath(os.path.join(programDir,relativeTargetPath))
+if len(sys.argv) != 3:
+ print "Usage: %s source target\n" % os.path.basename(sys.argv[0])
+ sys.exit(1)
+
+sourceFile = sys.argv[1]
+targetFile = sys.argv[2]
# parse the source file and record items
# I would love to use Python's ConfigParser, but it doesn't
@@ -94,16 +99,21 @@ for line in open(sourceFile):
if lastItem:
items.append(lastItem)
+if targetFile == '--':
+ out = sys.stdout
+else:
+ out = open(targetFile,"wb")
-print targetHeader
+out.write(targetHeader)
# write guards to prevent bad compiles
for m in macroNames:
- print """\
+ out.write("""\
#ifndef %(macro)s
#error %(macro)s not defined
-#endif""" % { 'macro':m }
-print ""
+#endif
+""" % { 'macro':m })
+out.write("\n")
for item in items:
if item.type == None:
@@ -131,11 +141,12 @@ for item in items:
# quote default value for strings
varDefault = quoteStringForC(varDefault)
- print "%s(\n %s,\n %s,\n %s,\n %s,\n %s)\n" % \
- (varMacro,varName,varNameStr,varDefault,varAbstract,varDesc)
+ out.write("%s(\n %s,\n %s,\n %s,\n %s,\n %s)\n\n" % \
+ (varMacro,varName,varNameStr,varDefault,varAbstract,varDesc))
for m in macroNames:
- print "#undef %s" % m
+ out.write("#undef %s\n" % m)
-print "/* end of auto-generated file */"
+out.write("/* end of auto-generated file */\n")
+out.close()