From 6938d8c06177308760783c8457d06c8495369552 Mon Sep 17 00:00:00 2001 From: Michele Guerini Rocco Date: Wed, 22 Dec 2021 17:43:23 +0100 Subject: [PATCH] Makefile: make the .d rule portable The \+ syntax is not POSIX and supported only by GNU sed. This changes both the grep and sed commands to use extended regex. Note: sed -E option is not POSIX either, but widely supported. --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ae9c746..cc0ba7a 100644 --- a/Makefile +++ b/Makefile @@ -146,8 +146,9 @@ graph.svg: Makefile # dependencies (ie. the dependency graph is a DAG); $(OBJDIR)/%.d: $(SRCDIR)/%.f90 | $(OBJDIR) @printf '$(@:d=o): $< \\\n' > '$@' - @grep -v 'use iso_' '$<' | \ - sed -n 's@^[^!].*use \([^,]\+\),.*@$(OBJDIR)/\1.o \\@p' | \ + @grep -vE '^[[:blank:]]*use.*(intrinsic|iso_)' '$<' | \ + sed -nE 's@^[[:blank:]]*use[[:blank:]]+'\ + '([^,[:blank:]&]+).*@$(OBJDIR)/\1.o \\@p' | \ sort -u >> '$@' # Load the generated rules