Search code examples
makefilekernelyasm

Makefile error - make: *** No rule to make target `boot.o', needed by `all'. Stop


I am working through a unix-like kernel development tutorial, and have come across a total noob problem I am sure: can anyone tell me what is wrong with this?

SOURCES=boot.o main.o

CFLAGS=-nostdlib -nostdinc -fno-builtin -fno-stack-protector
LDFLAGS=-Tlink.ld
ASFLAGS=-felf

all: $(SOURCES) link 

clean:
    -rm *.o kernel

link:
    ld $(LDFLAGS) -o kernel $(SOURCES)

.s.o:
    yasm $(ASFLAGS) $

Thanks in advance


Solution

  • You're using old-fashioned suffix rules, and missing some setup for that (plus an error in the very last line).

    Switch to a normal pattern rule instead, no point in trying to fix the old style rule:

    %.o: %.s
        yasm $(ASFLAGS) $<