Created
February 3, 2023 18:08
-
-
Save qguv/979053535b8d12d5e19ecf545b708bd2 to your computer and use it in GitHub Desktop.
build a C binary step-by-step
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libs = -lc | |
rule compile | |
command = gcc -Wall -Werror -Wpedantic -S -o $out $in | |
rule assemble | |
command = gcc -c -o $out $in | |
rule link | |
command = gcc $libs -o $out $in | |
build main.s: compile main.c | |
build main.o: assemble main.s | |
build main: link main.o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment