assemblymakefilecompilationnasm

Trying to create a Makefile file for an assembly/nasm application


I'm trying to create a simple make file, the commands I'm using now are:

$ nasm -f elf64 main.asm
$ ld -s -o test1 main.o

That's it. How can I create a Makefile from them? I've read the manuals but I haven't gotten any close to the solution.


Solution

  • you could build one, using the simplest rule:

    <target>: <source>
           <build command>
    

    your makefile would look like this:

    all: test1
    
    main.o:  main.asm
            nasm -f elf64 main.asm
    
    test1:   main.o
            ld -s -o test1 main.o