Makefile:没有规则做目标。停止 [英] Makefile: No rule to make target. Stop
问题描述
我是 Makefile
的新用户。我必须写一个Makefile来建立一个共享库。
CC = g ++
CFLAGS = -fPIC -Wall -Wextra -c
LDFLAGS = -shared
RM = rm -rf
TARGET_LIB = lib / Automat.so
SRC_DIR = src /
LIB_DIR = lib /
DEP_DIR = dep /
SRCS = IFSM.h IState.h ITransition.h FSM.h State.h Transition.h Wildcard.h PrimeTransition.h SingleTransition.h Exception.h Type.h Error.h
OBJS = $(SRCS:.h = .o)
.PHONY:all
all:$(TARGET_LIB)
$(TARGET_LIB):$(SRC_DIR)$(OBJS)
$(CC)$(LDFLAGS)-o $ @ $ ^
$(SRC_DIR)$ h = .d):%d:$(SRC_DIR)%。h
$(CC)$(CFLAGS)-MM $& > $(DEP_DIR)$ @
包括$(SRCS:.h = .d)
$ b b
我的问题是,我得到错误
没有规则制定目标`IFSM.d'。停止。
如果我从 SRCS
code> IState.d 。所有其他.d文件正在生成(11/12)。
所有文件都存在,并且它们都是正确的(case-sensitive)。
我不知道错误在哪里,我现在正在搜索2小时。
任何帮助将是巨大的。 / p>
最好的问候
Alex
/ p>
$(SRCS:.h = .d)
,即在本地目录中名为 whatever.d
的文件;但你有一个规则
$(SRC_DIR)$(SRCS:.h = .d)
这就是名为 src / whatever.d
p>
您需要决定这些文件应该居住的位置,并使两个规则匹配。
i'm new to Makefile
. I've to write a Makefile to build a shared libary.
CC =g++
CFLAGS =-fPIC -Wall -Wextra -c
LDFLAGS =-shared
RM =rm -rf
TARGET_LIB =lib/Automat.so
SRC_DIR =src/
LIB_DIR =lib/
DEP_DIR =dep/
SRCS=IFSM.h IState.h ITransition.h FSM.h State.h Transition.h Wildcard.h PrimeTransition.h SingleTransition.h Exception.h Type.h Error.h
OBJS=$(SRCS:.h=.o)
.PHONY: all
all: $(TARGET_LIB)
$(TARGET_LIB): $(SRC_DIR)$(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
$(SRC_DIR)$(SRCS:.h=.d):%.d:$(SRC_DIR)%.h
$(CC) $(CFLAGS) -MM $< > $(DEP_DIR)$@
include $(SRCS:.h=.d)
My problem is that i get the error
No rule to make target `IFSM.d'. Stop.
If i remove to file from SRCS
the problem occurs with IState.d
. All other .d files where builded correct (11 of 12).
All files exists and they are written correct (case-sensitiv).
I rly don't know where the error could be and i was searching for 2 hours now.
Any help would be great.
Best regards Alex
You are including
$(SRCS:.h=.d)
that is, files called whatever.d
in the local directory; but you have a rule to make
$(SRC_DIR)$(SRCS:.h=.d)
that is, files called src/whatever.d
.
You need to decide where these files should live, and make both rules match.
这篇关于Makefile:没有规则做目标。停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!