bash makefile 给出意外的文件结尾错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41450665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 15:34:54  来源:igfitidea点击:

makefile giving unexpected end of file error

bashshellmakefilegnu-make

提问by apramc

HOMEDIR = $(shell pwd)
DEFAULT = 4.0.3
YESDIR = $(shell echo $(@:install-%=%) | tr A-Z a-z)
NODIR = $(shell echo $(@:clean-%=%) | tr A-Z a-z)
install:
@$(MAKE) install-$(DEFAULT)   
install-%:
@cd $(HOMEDIR);\
if [ ! -e $(YESDIR) ]; then \
  echo "Library $(@:install-%=%) Version=$(YESDIR) does not exist"; \
elif [ -e $(YESDIR)/Install.sh ]; then \
    echo "Installing $(PKGNAM) version=$(YESDIR)" ; \
    cd $(YESDIR) ;\
    $(SHELL) Install.sh $(HOMEDIR) 1 ;\   
elif [ -e $(YESDIR)/Makefile ]; then \
    cd $(YESDIR); \
    $(MAKE); \
else \
    echo "Installation instruction for $(@:install-%=%) Version=$(YESDIR) does not exist"; \
fi;

the above makefile gives me the following error line 6: syntax error: unexpected end of file

上面的makefile给了我以下错误行6:语法错误:文件意外结束

采纳答案by Cyrus

Remove trailing blanks in this line:

删除此行中的尾随空格:

    $(SHELL) Install.sh $(HOMEDIR) 1 ;\