From 6a21963799575fa8a88ed55cde5408ef67c92d63 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 11 Sep 2013 01:20:52 -0400 Subject: scan source files for Makefile dependencies preprocessing should work with multiple object files now --- scan_includes.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scan_includes.py (limited to 'scan_includes.py') diff --git a/scan_includes.py b/scan_includes.py new file mode 100644 index 000000000..71b2e58a7 --- /dev/null +++ b/scan_includes.py @@ -0,0 +1,27 @@ +# coding: utf-8 + +# Recursively scan an asm file for rgbasm INCLUDEs and INCBINs. +# This is used to generate dependencies for each rgbasm object file. + +import sys + +def scan_for_includes(filename): + filenames = [] + for line in open(filename, 'r').readlines(): + if 'INCLUDE' in line or 'INCBIN' in line: + line = line.split(';')[0] + if 'INCLUDE' in line or 'INCBIN' in line: + filenames += [line.split('"')[1]] + return filenames + +def recursive_scan_for_includes(filename): + filenames = [] + if '.asm' in filename or '.tx' in filename: + for include in scan_for_includes(filename): + filenames += [include] + recursive_scan_for_includes(include) + return filenames + +if len(sys.argv) > 1: + for arg in sys.argv[1:]: + sys.stdout.write(' '.join(recursive_scan_for_includes(arg))) + -- cgit v1.2.3 From e11a56a1f654de05043eeefac0061e6d2c1b67ba Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 11 Sep 2013 01:40:53 -0400 Subject: use a docstring instead of comments in scan_includes --- scan_includes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scan_includes.py') diff --git a/scan_includes.py b/scan_includes.py index 71b2e58a7..3f006998c 100644 --- a/scan_includes.py +++ b/scan_includes.py @@ -1,7 +1,9 @@ # coding: utf-8 -# Recursively scan an asm file for rgbasm INCLUDEs and INCBINs. -# This is used to generate dependencies for each rgbasm object file. +""" +Recursively scan an asm file for rgbasm INCLUDEs and INCBINs. +This is used to generate dependencies for each rgbasm object file. +""" import sys -- cgit v1.2.3