build.ninja

rule kompile
   command = as -c $in -o $out

rule linkkaa
   command = gcc $in -o $out -nostdlib -static

build test3.o: kompile test3.s
build test3: linkkaa test3.o
default test3

test3.s

.global _start
.intel_syntax noprefix

_start:
        mov rax, 1
        mov rdi, 1
        lea rsi, [hello_world]
        mov rdx, 14
        syscall

        mov rax, 1
        mov rdi, 1
        lea rsi, [toinenrivi]
        mov rdx, 12
        syscall

        //exit
        mov rax, 60
        mov rdi, 69
        syscall

hello_world:
        .asciz "Hello, World!\n"


toinenrivi:
        .asciz "toinen rivi\n"