ifeq ($(shell uname -s),Darwin) AFLAGS += -fmacho64 LDFLAGS += -lSystem LD = clang AS = nasm endif ifeq ($(shell uname -s),Linux) AFLAGS += -felf64 LD = ld AS = nasm endif OUT_BIN=build .PHONY: clean $(OUT_BIN) default: clean $(OUT_BIN) $(OUT_BIN): main.o $(LD) $(LDFLAGS) -o $@ $^ %.o: %.asm $(AS) $(AFLAGS) $< -o $@ clean: -rm *.o $(OUT_BIN)