aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 4f9c04bb1f8b8570bd166b198c55be33feca9f82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)