Mac:“无法找到制定目标的规则”(C,CodeLite)

时间:2022-02-08 02:44:25

GNU Make v. 2.4.1

GNU Make v.2.4.1

MacOS High Sierra

MacOS High Sierra

Compiling executable with clang

使用clang编译可执行文件

I have a peculiar problem with a make file. I spliced a make file generated by the CodeLite IDE with the make file I had successfully used to compile the C library to which I'm trying to add a function. I wrapped some code around the library to make an executable for testing. I had compiled it successfully until yesterday. I believe the only difference I made was to add "$(OtherFlags)" to get the flags right. Now, make doesn't work, even when I delete this addition. I get the error

我有一个make文件的特殊问题。我拼接了一个由CodeLite IDE生成的make文件和我成功用于编译我正在尝试添加函数的C库的make文件。我在库周围包装了一些代码来制作可执行文件以进行测试。我成功地编译了它直到昨天。我相信我唯一的区别就是添加“$(OtherFlags)”以使旗帜正确。现在,即使我删除了这个添加,make也不起作用。我收到了错误

No rule to make target 'Debug/main.c.o', needed by 'Debug/iceemdan-clang'. Stop.

没有规则来制作目标'Debug / main.c.o','Debug / iceemdan-clang'需要。停止。

This is produced by line 93 of the makefile

这是由makefile的第93行产生的

$(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(Libpath) $(Libs) $(IncludeSwitch) $(IncludePath) $(OtherFlags)

This is gibberish outside of its context, which is below (code commented out at bottom comes from original makefile)

这是在其上下文之外的乱码,如下所示(底部注释的代码来自原始makefile)

##
## Auto Generated makefile by CodeLite IDE
## any manual changes will be erased      
##
## Debug
ProjectName            :=iceemdan-clang
ConfigurationName      :=Debug
WorkspacePath          :=/Users/Common/iceemdan-dev/iceemdan-dev
ProjectPath            :=/Users/Common/iceemdan-dev/iceemdan-dev/iceemdan-clang
IntermediateDirectory  :=./Debug
OutDir                 := $(IntermediateDirectory)
CurrentFileName        :=
CurrentFilePath        :=
CurrentFileFullPath    :=
User                   :=Coleman Family
Date                   :=08/08/2018
CodeLitePath           :="/Users/Common/Library/Application Support/CodeLite"
LinkerName             :=clang
SharedObjectLinkerName :=clang -shared -fPIC
ObjectSuffix           :=.o
DependSuffix           :=
PreprocessSuffix       :=.o.i
DebugSwitch            :=-gstab
IncludeSwitch          :=-I
LibrarySwitch          :=-l
OutputSwitch           :=-o 
LibraryPathSwitch      :=-L
PreprocessorSwitch     :=-D
SourceSwitch           :=-c 
OutputFile             :=$(IntermediateDirectory)/$(ProjectName)
Preprocessors          :=
ObjectSwitch           :=-o 
ArchiveOutputSwitch    := 
PreprocessOnlySwitch   :=-E 
ObjectsFileList        :="iceemdan-clang.txt"
PCHCompileFlags        :=
MakeDirCommand         :=mkdir -p
LinkOptions            :=  
IncludePath            :=  /opt/local/include
IncludePCH             := 
RcIncludePath          := 
Libs                   := -lgsl -lgslcblas -lm
ArLibs                 :=  
LibPath                := $(LibraryPathSwitch) /opt/local/lib
OtherFlags             :=-DHAVE_INLINE -Wall -Wextra -std=c99 -pedantic -Wno-unknown-pragmas -Wshadow -Wpointer-arith -DCLANG

##
## Common variables
## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables
##
AR       := ar rcus
CXX      := clang++
CC       := clang
CXXFLAGS :=  -g -O0 -Wall $(Preprocessors)
CFLAGS   :=  $(commonflags) $< -fPIC -shared -Wl $@ $(gsl_flags) -o $@ $(Preprocessors)
ASFLAGS  := 
AS       := llvm-as


##
## User defined environment variables
##
CodeLiteDir:=/Applications/codelite.app/Contents/SharedSupport/
PATH:=/Users/Common/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/opt/local/include
Srcs=main.c 

Objects0=$(IntermediateDirectory)/main.c$(ObjectSuffix) 



Objects=$(Objects0) 

##
## Main Build Targets 
##
.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs
all: $(OutputFile)

PreBuild:
    @echo Executing Pre Build commands ...
    $(eval gsl_flags = -L/opt/local/lib -lgsl -lgslcblas -lm -I/opt/local/include -DHAVE_INLINE)
    $(eval commonflags := -Wall -Wextra -std=c99 -pedantic -Wno-unknown-pragmas -Wshadow -Wpointer-arith)
#   $(eval commonflags += $(CFLAGS))
#   $(eval commonflags += -g -DEEMD_DEBUG=0)
    $(eval commonflags += -DCLANG)
    $(eval PREFIX ?= /usr)
    @echo Done

$(OutputFile): $(IntermediateDirectory)/.d $(Objects) 
    @$(MakeDirCommand) $(@D)
    @echo "" > $(IntermediateDirectory)/.d
    @echo $(Objects0)  > $(ObjectsFileList)
    $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(Libpath) $(Libs) $(IncludeSwitch) $(IncludePath) $(OtherFlags)

#   clang $(gsl_flags) $(commonflags) -o ./Debug/main.c.o

MakeIntermediateDirs:
    @test -d ./Debug || $(MakeDirCommand) ./Debug


$(IntermediateDirectory)/.d:
    @test -d ./Debug || $(MakeDirCommand) ./Debug

#PreBuild:

# all

#Debug/main.c.o: main.c 
#src/eemd.h | Debug
#   clang $(commonflags) -c $< $(gsl_flags) -o $@

#Debug/main.c.a: Debug/main.c.o
#   $(AR) rcs $@ $^

#eemd: main.c src/eemd.h
#   clang $(commonflags) $< -fPIC -shared -Wl, ,$@ $(gsl_flags) -o $@

The complaint is that main.c.o can't be built, even though main.c exists. main -d seems to indicate that it searching for main.c.*, but not bothering to look for main.c itself.

抱怨是main.c.o无法构建,即使main.c存在。 main -d似乎表明它正在搜索main.c. *,但没有费心去寻找main.c本身。

Trying pattern rule with stem 'main.c'.

尝试使用词干'main.c'的模式规则。

This occurs several times within several different directories. I see responses like

这在几个不同的目录中发生了好几次。我看到的答案就像

Rejecting impossible implicit prerequisite 'Debug/main.c.l'.

拒绝不可能的隐式先决条件'Debug / main.c.l'。

Never do I see an attempt to find main.c.

我从来没有看到过尝试找到main.c.

1 个解决方案

#1


0  

Your intermediate should be called main.o not main.c.o. The problem is probably here:

你的中间人应该被称为main.o而不是main.c.o.问题可能在这里:

Objects0=$(IntermediateDirectory)/main.c$(ObjectSuffix) 

It should be

它应该是

Objects0=$(IntermediateDirectory)/main$(ObjectSuffix) 

I think...

我认为...

#1


0  

Your intermediate should be called main.o not main.c.o. The problem is probably here:

你的中间人应该被称为main.o而不是main.c.o.问题可能在这里:

Objects0=$(IntermediateDirectory)/main.c$(ObjectSuffix) 

It should be

它应该是

Objects0=$(IntermediateDirectory)/main$(ObjectSuffix) 

I think...

我认为...