Windows中的Makefile语法错误:意外的文件末尾

时间:2018-04-14 14:15:09

标签: windows makefile mingw

我想使用MinGW使用下面的Makefile在 win10 中编译C ++代码:

# Include platform dependent makefiles
ifeq ($(OS),Windows_NT)
include Makefile.nt
else
include Makefile.unix
endif

PREFIX:=bin/

#############################################################################
# Default target
all: $(PREFIX)rdf3xdump$(EXEEXT) $(PREFIX)rdf3xload$(EXEEXT) $(PREFIX)rdf3xquery$(EXEEXT) $(PREFIX)rdf3xupdate$(EXEEXT) $(PREFIX)rdf3xembedded$(EXEEXT) $(PREFIX)rdf3xreorg$(EXEEXT) $(PREFIX)translatesparql$(EXEEXT) $(PREFIX)buildmonetdb$(EXEEXT) $(PREFIX)buildpostgresql$(EXEEXT)

#############################################################################
# Collect all sources

include cts/LocalMakefile
include infra/LocalMakefile
include makeutil/LocalMakefile
include rts/LocalMakefile
include gtest/LocalMakefile
include test/LocalMakefile
include api/LocalMakefile

ifeq ($(LINEEDITOR),1)
src_lineeditor:=lineeditor/LineInput.cpp lineeditor/LineEditor.cpp lineeditor/Terminal.cpp lineeditor/Display.cpp lineeditor/Buffer.cpp
endif

include tools/LocalMakefile


source:=$(src_cts) $(src_infra) $(src_rts) $(src_tools) $(src_lineeditor)

#############################################################################
# Dependencies

generatedependencies=$(call nativefile,$(PREFIX)makeutil/getdep) -o$(basename $@).d $(IFLAGS) $< $(basename $@)$(OBJEXT) $(genheaders) $(GENERATED-$<)

ifneq ($(IGNORE_DEPENDENCIES),1)
-include $(addprefix $(PREFIX),$(source:.cpp=.d)) $(addsuffix .d,$(basename $(wildcard $(generatedsource))))
endif

#############################################################################
# Compiling

compile=$(CXX) -c  $(TARGET)$(call nativefile,$@) $(CXXFLAGS) $(CXXFLAGS-$(firstword $(subst /, ,$<))) $(IFLAGS) $(IFLAGS-$(firstword $(subst /, ,$<))) $(call nativefile,$<)

$(PREFIX)%$(OBJEXT): %.cpp $(PREFIX)makeutil/getdep$(EXEEXT)
    $(checkdir)
    $(generatedependencies)
    $(compile)

#############################################################################
# Cleanup

clean:
    find bin -name '*.d' -delete -o -name '*.o' -delete -o '(' -perm -u=x '!' -type d ')' -delete

#############################################################################
# Executable

$(PREFIX)query: $(addprefix $(PREFIX),$(source:.cpp=$(OBJEXT)))

输入mingw32-make后,似乎出现了一些错误:

D:\rdf3x>mingw32-make
/usr/bin/sh: -c: line 1: syntax error: unexpected end of file
makeutil/LocalMakefile:3: recipe for target 'bin/makeutil/getdep.o' failed
mingw32-make: *** [bin/makeutil/getdep.o] Error 1

我也曾经通过dos2unix将Makefile转移到unix-style。 所有的makefile和代码都是从github克隆的:https://github.com/gh-rdf3x/gh-rdf3x。许多其他人完成了编码。

如何解决此问题?我的操作系统是windows10 64位版本,编译工具是MinGW

-------------更新--------------

感谢@ MadScientist提醒,文件makeutil/LocalMakefile附在下面:

# Separate build rules to avoid cyclic dependencies
$(PREFIX)makeutil/getdep$(OBJEXT): makeutil/getdep.cpp
    $(checkdir)
    $(compile)

$(PREFIX)makeutil/getdep$(EXEEXT): $(PREFIX)makeutil/getdep$(OBJEXT)
    $(buildexe)

1 个答案:

答案 0 :(得分:0)

$(checkdir)扩展为某些内容(您没有告诉我们什么),这不是一个完整的shell命令。