-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgenerate-makefiles.py
More file actions
executable file
·59 lines (47 loc) · 1.47 KB
/
generate-makefiles.py
File metadata and controls
executable file
·59 lines (47 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python3
"""
Simple makefile generator for vicky vendor tree
"""
import os
from pathlib import Path
def generate_android_bp():
"""Generate Android.bp for vendor tree"""
vendor_path = "vendor/motorola/vicky"
# Find all .so files
so_files = []
for root, dirs, files in os.walk(vendor_path):
for file in files:
if file.endswith('.so'):
rel_path = os.path.relpath(os.path.join(root, file), vendor_path)
so_files.append(rel_path)
# Generate Android.bp content
content = """//
// Copyright (C) 2025 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
soong_namespace {
}
// Prebuilt libraries
"""
for so_file in sorted(so_files):
module_name = so_file.replace('/', '_').replace('.so', '').replace('-', '_').replace('.', '_')
relative_path = f"motorola/vicky/{so_file}"
content += f"""
prebuilt_etc {{
name: "{module_name}",
src: "{relative_path}",
vendor: true,
relative_install_path: "{os.path.dirname(so_file)}",
}}
"""
return content
def main():
android_bp_content = generate_android_bp()
# Write Android.bp
with open("vendor/motorola/vicky/Android.bp", "w") as f:
f.write(android_bp_content)
print("✅ Generated vendor/motorola/vicky/Android.bp")
print(f"📊 Found {len(android_bp_content.split('prebuilt_etc')) - 1} prebuilt libraries")
if __name__ == "__main__":
main()