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

StackOverflow https://stackoverflow.com/questions/13727912

  •  05-12-2021
  •  | 
  •  

سؤال

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

هل كانت مفيدة؟

المحلول

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) $<

نصائح أخرى

Well assuming boot.o and main.o are built using yasm your makefile lack a rule for .o

.o:
    yasm $(ASFLAGS) $
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top