aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorchrysn2012-10-23 01:38:27 +0200
committerchrysn2012-10-23 01:38:27 +0200
commitefce73f815ddbfb5f06fc45d34e6fe62b014d8e4 (patch)
tree5d902628401a804c55aa2594a60f607eb819c17d /scripts
parent2ad04777bf63a1324afe2b65d689aa210928bfea (diff)
make `make clean` work again
the irq2nvic_h generates files in a way make doesn't understand, so it now also provides an option to clean up again
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/irq2nvic_h10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/irq2nvic_h b/scripts/irq2nvic_h
index 903af15..cddbfc3 100755
--- a/scripts/irq2nvic_h
+++ b/scripts/irq2nvic_h
@@ -130,12 +130,22 @@ def needs_update(infiles, outfiles):
return any(not os.path.exists(o) for o in outfiles) or max(map(timestamp, infiles)) > min(map(timestamp, outfiles))
def main():
+ if sys.argv[1] == '--remove':
+ remove = True
+ del sys.argv[1]
+ else:
+ remove = False
infile = sys.argv[1]
if not infile.startswith('./include/libopencm3/') or not infile.endswith('/irq.yaml'):
raise ValueError("Arguent must match ./include/libopencm3/**/irq.yaml")
nvic_h = infile.replace('irq.yaml', 'nvic.h')
vector_nvic_c = infile.replace('./include/libopencm3/', './lib/').replace('irq.yaml', 'vector_nvic.c')
+ if remove:
+ os.unlink(nvic_h)
+ os.unlink(vector_nvic_c)
+ sys.exit(0)
+
if not needs_update([__file__, infile], [nvic_h, vector_nvic_c]):
sys.exit(0)