gpt4 book ai didi

debugging - 使看不到带有%标记的规则

转载 作者:行者123 更新时间:2023-12-02 10:54:14 26 4
gpt4 key购买 nike

我正在尝试将调试目标添加到all-dbg之类的项目中,但是收到错误消息:

    $ make all-dbg
make: *** No rule to make target 'tted.o-dbg', needed by 'tted-dbg'. Stop.

这是Makefile:
    TARGET=tted
CC=gcc
CFLAGS=-Wall -std=c99
CFLAGS-dbg=-g
LDFLAGS=-lncurses

all: $(TARGET)

all-dbg: $(TARGET)-dbg

SOURCES=$(wildcard *.c)
HEADERS=$(wildcard *.h)
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
OBJECTS-dbg=$(patsubst %.c, %.o-dbg, $(SOURCES))
PCHEADERS=$(HEADERS:=.gch)

%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

%.o-dbg: %c
$(CC) $(CFLAGS) $(CFLAGS-dbg) -c $< -o $@

%.h.gch: %.h
$(CC) $(CFLAGS) $<

$(TARGET): $(PCHEADERS) $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@

$(TARGET)-dbg: $(PCHEADERS) $(OBJECTS-dbg)
$(CC) $(OBJECTS-dbg) $(LDFLAGS) -o $@

clean:
-rm -f *.o
-rm -f *.o-dbg
-rm -f *.h.gch
-rm -f $(TARGET)
-rm -f $(TARGET)-dbg

有什么建议?

最佳答案

您缺少%.o-dbg: %c中的点。它可能应该改为读取%.o-dbg: %.c

关于debugging - 使看不到带有%标记的规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38623094/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com