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.
This commit is contained in:
Michele Guerini Rocco 2021-12-22 17:43:23 +01:00
parent a30cd09e8e
commit 6938d8c061
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450

View File

@ -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