I want to automatically build assembly files into executable binaries. The following Makefile seems to be sufficient. I am sure I will add to it over time.
All I have to modify is the SRC_FILES line to add a new target
Note that html does not honor the tab characters.
EDIT: I swapped the SRC_ and B_ files so that the top list is the end result. This allows you to just run make and build all of your executables. It would also let you mix and match between assembly and other languages. But (most importantly) I like it better.
B_FILES=simple printer SRC_FILES = $(B_FILES:%=%.s) O_FILES = $(SRC_FILES:%.s=%.o) all: $(B_FILES) %: %.s as -o $@.o $< ld -o $@ $@.o clean: rm -f $(O_FILES) $(B_FILES) |