Makefile: fix .d generation for vendored libraries
This commit is contained in:
parent
850dc3a737
commit
624fbe3ec1
13
Makefile
13
Makefile
@ -208,11 +208,14 @@ graph.svg: Makefile
|
||||
# Rebuild everything if the makefile changed
|
||||
.EXTRA_PREREQS += Makefile
|
||||
|
||||
# Search for source code in vendor/ subdirectory
|
||||
vpath %.f90 $(SRCDIR):$(SRCDIR)/vendor
|
||||
|
||||
# Automatic generation of the Fortran prerequisites
|
||||
# Note 1: this is needed because gfortran -M flag doesn't properly work;
|
||||
# Note 2: this assumes matching module/file names and no circular
|
||||
# dependencies (ie. the dependency graph is a DAG);
|
||||
$(OBJDIR)/%.d: $(SRCDIR)/%.f90 | $(OBJDIR)
|
||||
$(OBJDIR)/%.d: %.f90 | $(OBJDIR)
|
||||
@printf '$(@:d=o): $< \\\n' > '$@'
|
||||
@grep -vE '^[[:blank:]]*use.*(intrinsic|iso_)' '$<' | \
|
||||
sed -nE 's@^[[:blank:]]*use[[:blank:]]+'\
|
||||
@ -221,14 +224,10 @@ $(OBJDIR)/%.d: $(SRCDIR)/%.f90 | $(OBJDIR)
|
||||
@sed -nE 's@^#include "(.+)"@$(INCDIR)/\1 \\@p' '$<' >> '$@'
|
||||
|
||||
# Load the generated rules
|
||||
-include $(DEPS)
|
||||
include $(DEPS)
|
||||
|
||||
# Compile a generic Fortran source
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.f90 | $(OBJDIR) $(INCDIR)
|
||||
$(FC) -cpp $(CPPFLAGS) $(FFLAGS) -c '$<' -o '$@'
|
||||
|
||||
# Compile vendored libraries
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/vendor/%.f90 | $(OBJDIR) $(INCDIR)
|
||||
$(OBJDIR)/%.o: %.f90 | $(OBJDIR) $(INCDIR)
|
||||
$(FC) -cpp $(CPPFLAGS) $(FFLAGS) -c '$<' -o '$@'
|
||||
|
||||
# Generate Fortran code from awk script
|
||||
|
Loading…
Reference in New Issue
Block a user