Search code examples
makefileoperating-systemninja

ninja: error: build.ninja:6: expected 'command =' line


im making a operating system i im using makefile but im trying migrate to ninja-build but im receiving this error:

ninja: error: build.ninja:6: expected 'command =' line

build.ninja

GPPPARAMS = -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti - 
fno-exceptions -fno-leading-underscore
ASPARAMS = --32
LDPARAMS = -melf_i386 -T

rule compile-cpp
  command = gcc $GPPPARAMS -o $out -c $in

rule compile-asm
  command = as $ASPARAMS -o $out -c $in

rule link
  command = ld $LDPARAMS -c $in 
rule kernel
  command = sudo cp $in /boot/kernel.bin 

build ./src/kernel.o:  compile-cpp ./src/kernel.cpp
build ./src/loader.o:  compile-asm ./src/loader.s
build fgos: link ./src/linker.ld

makefile

'GPPPARAMS = -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore
ASPARAMS = --32
LDPARAMS = -melf_i386
objects = loader.o kernel.o

%.o: %.cpp
    g++ $(GPPPARAMS) -o $@ -c $<
%.o: %.s
    as $(ASPARAMS) -o $@ $<

kernel.bin: linker.ld $(objects)
    ld $(LDPARAMS) -T $< -o $@ $(objects)

install: kernel.bin
    sudo cp $< /boot/kernel.bin

repository

github

gitlab


Solution

  • i solve this giving 2 ident spaces instead of 4 and giving space at the end of ninja files