构建此项目时出现了一个奇怪的错误。它成功地编译了所有内容,但最后,make告诉我:
make: *** No rule to make target `cc', needed by `game'. Stop.
这是makefile:
TARGET = game
SDL_INC_DIR = /usr/include/SDL
SDL_LIB_DIR = /usr/lib/SDL
CFLAGS = -D __SDL__ -O2 -g -Wall -I$(SDL_INC_DIR)
LDFLAGS = -L$(SDL_LIB_DIR) -lSDL
OBJECTS = game/ai/boost.o \
game/ai/bullet.o \
game/ai/death.o \
game/ai/explode.o \
game/ai/pickup.o \
game/ai/quad.o \
game/ai/sheba.o \
game/ai/static_model.o \
game/ai/static_sprite.o \
game/ai/teleporter.o \
game/ai/torch.o \
game/data.o \
game/entities.o \
game/game.o \
game/maps.o \
game/models.o \
game/screens.o \
game/sprites.o \
platform/main.o
$(TARGET): $(OBJECTS) $(CC) $(CFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJECTS)
clean:
rm -f *.o game/*.o game/ai/*.o
答案 0 :(得分:3)
您需要将$(CC)
和其余内容放在下一行的标签后面:
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJECTS)
无论如何都能使用默认规则成功编译目标。
答案 1 :(得分:0)
$(CC)未定义。添加$(CC)= gcc也将它放在一个新行上,否则它将把它们作为依赖项