我知道这个错误与缺少TAB有关,但我不知道怎么找不到第1行的标签缺失:
生成文件:
## -*- mode: make; tab-width: 8; -*-
##
## Simple Makefile
##
## TODO:
## proper configure for non-Debian file locations, [ Done ]
## allow RHOME to be set for non-default R etc
## comment this out if you need a different version of R,
## and set set R_HOME accordingly as an environment variable
R_HOME = $(shell R RHOME)
sources = $(wildcard *.cpp)
programs = $(sources:.cpp=)
## include headers and libraries for R
RCPPFLAGS = $(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS = $(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS = $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK = $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)
## if you need to set an rpath to R itself, also uncomment
#RRPATH := -Wl,-rpath,$(R_HOME)/lib
## include headers and libraries for Rcpp interface classes
RCPPINCL = $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RCPPLIBS = $(shell echo 'Rcpp:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave)
## include headers and libraries for RInside embedding classes
RINSIDEINCL = $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RINSIDELIBS = $(shell echo 'RInside:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave)
## compiler etc settings used in default make rules
CXX = $(shell $(R_HOME)/bin/R CMD config CXX)
CPPFLAGS = -Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
CXXFLAGS = $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R CMD
config CXXFLAGS)
LDLIBS = $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)
all: $(programs)
@test -x /usr/bin/strip && strip $^
run: $(programs)
@for p in $(programs); do echo; echo "Running $$p:"; ./$$p; done
clean:
rm -vf $(programs)
rm -vrf *.dSYM
runAll:
for p in $(programs); do echo "Running $$p"; ./$$p; done
答案 0 :(得分:3)
就个人而言,我遇到了一些由Windows上的某个编辑器保存的Makefile的问题。然后原因是Makefile中的BOM (Byte Order Mark),这让Make。感到困惑。
要检查是否可以(手动)将整个Makefile(或者除了标题注释之外)复制并粘贴到在其他编辑器/ IDE中创建的新文件中。此处还有a great answer有关如何在Windows上删除BOM的信息。
答案 1 :(得分:1)
如果你的“Makefile.win”是一个精确的副本,那么用命令替换命令前的所有空格:
全部:$(节目)
< 在此处插入标签,无空格> @test -x / usr / bin / strip&&剥离$ ^运行:$(程序)
< 在此处插入标签,没有空格> @for $ p(程序);回声; echo“Running $$ p:”; ./$$p;完成清洁:
< 在此处插入标签,无空格> rm -vf $(程序)
< 在此处插入标签,无空格> rm -vrf * .dSYMrunAll:
< 在此处插入标签,空格>表示$(程序)中的p;回声“Running $$ p”; ./$$p;完成
答案 2 :(得分:1)
LDLIBS
之前的一行显然是:
config CXXFLAGS)
这会产生一个makefile语法错误,但我希望它的行号大于1。