From 773e2df1b579341069eee47278a1de75f50b4cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Lebrun?= Date: Wed, 15 Oct 2025 11:37:50 +0200 Subject: [PATCH] lib.py: mark `.mk` files as makefiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenSBI uses `.mk` files. The tokenizer does not get ran on files without a family (sad). Adding this means we index references inside .mk files, eg: # opensbi/lib/utils/i2c/objects.mk libsbiutils-objs-$(CONFIG_I2C) += i2c/i2c.o Also, refactor the getFileFamily(): - All usage of name/ext do a .lower() on them, move it to the top. - Use `x == "A"` checks rather than `x in ["A"]`. Signed-off-by: Théo Lebrun --- elixir/lib.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/elixir/lib.py b/elixir/lib.py index 7d7d075..051285b 100755 --- a/elixir/lib.py +++ b/elixir/lib.py @@ -223,16 +223,17 @@ def validFamily(family): def getFileFamily(filename): name, ext = os.path.splitext(filename) + name, ext = name.lower(), ext.lower() - if ext.lower() in ['.c', '.cc', '.cpp', '.c++', '.cxx', '.h', '.s'] : + if ext in ['.c', '.cc', '.cpp', '.c++', '.cxx', '.h', '.s'] : return 'C' # C file family and ASM - elif ext.lower() in ['.dts', '.dtsi'] : + elif ext in ['.dts', '.dtsi'] : return 'D' # Devicetree files - elif name.lower()[:7] in ['kconfig'] and not ext.lower() in ['.rst']: + elif name[:7] == 'kconfig' and ext != '.rst': # Some files are named like Kconfig-nommu so we only check the first 7 letters # We also exclude documentation files that can be named kconfig return 'K' # Kconfig files - elif name.lower()[:8] in ['makefile'] and not ext.lower() in ['.rst']: + elif name[:8] == 'makefile' and ext != '.rst' or ext == '.mk': return 'M' # Makefiles else : return None