From 8d45903dc2a10ad59a9b8594d16ca331bd1d6392 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Mon, 22 Aug 2022 18:13:48 -0700 Subject: [PATCH] [script] makefile for vpr arch --- openfpga_flow/vpr_arch/Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 openfpga_flow/vpr_arch/Makefile diff --git a/openfpga_flow/vpr_arch/Makefile b/openfpga_flow/vpr_arch/Makefile new file mode 100644 index 000000000..c9710ba7c --- /dev/null +++ b/openfpga_flow/vpr_arch/Makefile @@ -0,0 +1,30 @@ +# +# Arch Makefile +# ============= +# +# This makefile is designed to process architecture files +# +SHELL = bash +PYTHON_EXEC ?= python3 +ARCH_UPDATER = ../scripts/arch_file_updater.py + +# Put it first so that "make" without argument is like "make help". +export COMMENT_EXTRACT + +# Put it first so that "make" without argument is like "make help". +help: + @${PYTHON_EXEC} -c "$$COMMENT_EXTRACT" + +v1p1_to_v1p2: +# This commands will update all the architecture file from v1.1 to v1.2 + for f in `ls .`; do ${PYTHON_EXEC} ${ARCH_UPDATER} --input_file $${f} --output_file $${f}; done; + +# Functions to extract comments from Makefiles +define COMMENT_EXTRACT +import re +with open ('Makefile', 'r' ) as f: + matches = re.finditer('^([a-zA-Z-_]*):.*\n#(.*)', f.read(), flags=re.M) + for _, match in enumerate(matches, start=1): + header, content = match[1], match[2] + print(f" {header:10} {content}") +endef