vinnylinux
vinnylinux

Reputation: 7024

Getting "No rule to make target" on a successful build

I'm getting a strange error when building this project. It compiles everything successfully, but on the end, make tells me:

make: *** No rule to make target `cc', needed by `game'.  Stop.

Here's the 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

Upvotes: 0

Views: 774

Answers (2)

user3287648
user3287648

Reputation: 87

$(CC) is not defined. Add $(CC)=gcc also put it on a new line otherwise it will take them as dependencies

Upvotes: 0

ooga
ooga

Reputation: 15501

You need to put $(CC) and the rest on the next line, after a tab:

$(TARGET): $(OBJECTS)
        $(CC) $(CFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJECTS)

It was able to compile the target successfully anyway using the default rule.

Upvotes: 3

Related Questions