[ASM] How to compile ASM with C in macOS
- Install homebrew at https://github.com/kube/42homebrew or elsewhere.
- Next, put command below in your terminal.
brew install nasm
- If you successfully install nasm, you should restart your terminal.
Compile without Makefile
- To make object file and compile with C file, use command below.
nasm -f macho64 sourcefile.sgcc main.c sourcefile.o
Compile with Makefile
- If you have your own Makefile make it first and then,
gcc main.c -L ./ -lasm
- My Makefile was like below. If you want to see my assembly code tested with C language, visit my github.