Makefile: fix shell quoting

This commit is contained in:
Michele Guerini Rocco 2021-12-15 02:31:18 +01:00
parent 9a39251f44
commit 5a8e64a595
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
2 changed files with 12 additions and 12 deletions

View File

@ -102,11 +102,11 @@ install: $(BINARIES) $(LIBRARIES) $(SHAREDIR)/gray.1
# GRAY binary # GRAY binary
$(GRAY): $(shell ./depend $(OBJDIR)/main.o) | $(BINDIR) $(GRAY): $(shell ./depend $(OBJDIR)/main.o) | $(BINDIR)
$(LD) $(LDFLAGS) -o $@ $^ $(LD) $(LDFLAGS) -o '$@' $^
# GRAY shared library # GRAY shared library
$(LIBGRAY).so: $(MODULES) | $(LIBDIR) $(LIBGRAY).so: $(MODULES) | $(LIBDIR)
$(LD) -shared $(LDFLAGS) -o $@ $^ $(LD) -shared $(LDFLAGS) -o '$@' $^
# GRAY static library # GRAY static library
$(LIBGRAY).a($(MODULES)): | $(LIBDIR) $(LIBGRAY).a($(MODULES)): | $(LIBDIR)
@ -131,7 +131,7 @@ graph.svg: Makefile
/->/ {if (bad[$$1] || bad[$$2]) next} \ /->/ {if (bad[$$1] || bad[$$2]) next} \
{print $$0}' \ {print $$0}' \
| sed 's/label/fontsize=30,label/g; s/\.o//' \ | sed 's/label/fontsize=30,label/g; s/\.o//' \
| dot -Tsvg -o $@ | dot -Tsvg -o '$@'
## ##
## Generic rules ## Generic rules
@ -145,18 +145,18 @@ graph.svg: Makefile
# Note 2: this assumes matching module/file names and no circular # Note 2: this assumes matching module/file names and no circular
# dependencies (ie. the dependency graph is a DAG); # dependencies (ie. the dependency graph is a DAG);
$(OBJDIR)/%.d: $(SRCDIR)/%.f90 | $(OBJDIR) $(OBJDIR)/%.d: $(SRCDIR)/%.f90 | $(OBJDIR)
@printf '$(@:d=o): $< \\\n' > $@ @printf '$(@:d=o): $< \\\n' > '$@'
@grep -v 'use iso_' '$<' | \ @grep -v 'use iso_' '$<' | \
sed -n 's@^[^!].*use \([^,]\+\),.*@$(OBJDIR)/\1.o \\@p' | \ sed -n 's@^[^!].*use \([^,]\+\),.*@$(OBJDIR)/\1.o \\@p' | \
sort -u >> $@ sort -u >> '$@'
# Load the generated rules # Load the generated rules
include $(DEPS) include $(DEPS)
# Compile a generic Fortran source # Compile a generic Fortran source
$(OBJDIR)/%.o: $(SRCDIR)/%.f90 | $(OBJDIR) $(OBJDIR)/%.o: $(SRCDIR)/%.f90 | $(OBJDIR)
$(FC) -cpp $(CPPFLAGS) $(FFLAGS) -c $< -o $@ $(FC) -cpp $(CPPFLAGS) $(FFLAGS) -c '$<' -o '$@'
# Create directories # Create directories
$(DIRS): $(DIRS):
mkdir -p $@ mkdir -p '$@'

View File

@ -24,20 +24,20 @@ MANUALS = $(addprefix $(DOCDIR)/,manual.html manual.pdf res)
.PHONY: all clean .PHONY: all clean
all: $(MANUALS) all: $(MANUALS) $(MANPAGES)
clean: clean:
rm -r build rm -r build
$(DOCDIR)/manual.html: $(SECTIONS) res | $(DOCDIR) $(DOCDIR)/manual.html: $(SECTIONS) res | $(DOCDIR)
pandoc $(FLAGS) $(HTML_FLAGS) $(filter %.md, $^) -o $@ pandoc $(FLAGS) $(HTML_FLAGS) $(filter %.md, $^) -o '$@'
$(DOCDIR)/res: res | $(DOCDIR) $(DOCDIR)/res: res | $(DOCDIR)
cp -r $^ $@ cp -r $^ '$@'
$(DOCDIR)/manual.pdf: $(SECTIONS) | $(DOCDIR) $(DOCDIR)/manual.pdf: $(SECTIONS) | $(DOCDIR)
pandoc $(FLAGS) $(PDF_FLAGS) $^ -o $@ pandoc $(FLAGS) $(PDF_FLAGS) $^ -o '$@'
# Create directories # Create directories
$(DOCDIR): $(DOCDIR):
mkdir -p $@ mkdir -p '$@'