BINARIES=aha_write
all: $(BINARIES)

.SUFFIXES:
.SECONDARY: $(S_SRC)

%.s: %.c
    gcc -S -fno-asynchronous-unwind-tables $+ -o $@

%: %.s
    gcc -ggdb $+ -o $@

%: %.S
    # gcc -c bare_hello.s
    # ld bare_hello.o -o $@
    gcc -nostdlib $+ -o $@

C_SRC=$(wildcard *.c)
S_SRC=$(C_SRC:c=s)
clean:
    rm -f $(BINARIES) $(S_SRC) *.o
.PHONY: clean