I have a Makefile, and I want make to run automatically when I double-click it (from the Ubuntu file manager). So, I made this Makefile executable, and added at its top the following shebang line:
#!/usr/bin/make -f
When I run /usr/bin/make -f Makefile, I get the desired result.
However, when I double-click the Makefile, or just run ./Makefile, I get an error:
: No such file or directory
clang-9 -o .o
clang: error: no input files
make: *** [<builtin>: .o] Error 1
What is the correct way to make my Makefile executable?
Here are the entire contents of my makefile:
#!/usr/bin/make -f
# A makefile for building pdf files from the text (odt files) and slides (odp files).
# Author: Erel Segal-Halevi
# Since: 2019-02
SOURCES_ODP=$(shell find . -name '*.odp')
TARGETS_ODP=$(subst .odp,.pdf,$(SOURCES_ODP))
SOURCES_ODT=$(shell find . -name '*.odt')
TARGETS_ODT=$(subst .odt,.pdf,$(SOURCES_ODT))
SOURCES_DOC=$(shell find . -name '*.doc*')
TARGETS_DOC=$(subst .doc,.pdf,$(subst .docx,.pdf,$(SOURCES_DOC)))
SOURCES_ODS=$(shell find . -name '*.ods')
TARGETS_XSLX=$(subst .ods,.xlsx,$(SOURCES_ODS))
all: $(TARGETS_ODP) $(TARGETS_ODT) $(TARGETS_DOC) $(TARGETS_XSLX)
#
-git commit -am "update pdf files"
-git push
echo Done!
sleep 86400
%.pdf: %.odt
#
libreoffice --headless --convert-to pdf $< --outdir $(@D)
-git add $@
-git add $<
%.pdf: %.doc*
#
libreoffice --headless --convert-to pdf $< --outdir $(@D)
-git add $@
-git add $<
%.pdf: %.odp
#
libreoffice --headless --convert-to pdf $< --outdir $(@D)
-git add $@
-git add $<
%.xlsx: %.ods
#
libreoffice --headless --convert-to xlsx $< --outdir $(@D)
-git add $@
-git add $<
clean:
rm -f *.pdf