diff options
author | pikalaxalt <PikalaxALT@gmail.com> | 2016-04-10 20:42:14 -0400 |
---|---|---|
committer | pikalaxalt <PikalaxALT@gmail.com> | 2016-04-10 20:42:14 -0400 |
commit | b11a8be88c5823133b6bf992cfe3f34d93462bfd (patch) | |
tree | c5fab66d2422abb5e4c402dbe6a81e0d5d8228c4 | |
parent | 0bcd725e6ad697b6f3bdf58268857d3b3df7404f (diff) | |
parent | c5fb2c947ffcdd0ddd80319a24a6acbe828d9598 (diff) |
Merge branch 'master' of https://github.com/pret/pokecrystal
-rw-r--r-- | Makefile | 3 | ||||
m--------- | extras | 0 | ||||
-rw-r--r-- | scan_includes.py | 35 |
3 files changed, 36 insertions, 2 deletions
@@ -6,9 +6,8 @@ MD5 := md5sum -c --quiet .SECONDEXPANSION: .PRECIOUS: %.2bpp %.1bpp -poketools := extras/pokemontools gfx := $(PYTHON) gfx.py -includes := $(PYTHON) $(poketools)/scan_includes.py +includes := $(PYTHON) scan_includes.py crystal_obj := \ diff --git a/extras b/extras -Subproject dfe657177453423987544798d9763b2938874b4 +Subproject 2ae1ae2f19c842da965cd3db1b0da8bf108ac23 diff --git a/scan_includes.py b/scan_includes.py new file mode 100644 index 000000000..60929d3fe --- /dev/null +++ b/scan_includes.py @@ -0,0 +1,35 @@ +#!/bin/python +# coding: utf-8 + +""" +Recursively scan an asm file for dependencies. +""" + +import sys +import argparse + +includes = set() + +def scan_file(filename): + for line in open(filename): + if 'INC' not in line: + continue + line = line.split(';')[0] + if 'INCLUDE' in line: + include = line.split('"')[1] + includes.add(include) + scan_file(include) + elif 'INCBIN' in line: + include = line.split('"')[1] + includes.add(include) + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('filenames', nargs='*') + args = ap.parse_args() + for filename in set(args.filenames): + scan_file(filename) + sys.stdout.write(' '.join(includes)) + +if __name__ == '__main__': + main() |