-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (28 loc) · 653 Bytes
/
Copy pathMakefile
File metadata and controls
41 lines (28 loc) · 653 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
AS := nasm
PREFIX ?= /usr/local
BINPREFIX = $(DESTDIR)${PREFIX}/bin
BUILDDIR := build
BIN := snake-asm
SRC := $(wildcard *.asm)
OBJ := ${SRC:%.asm=${BUILDDIR}/%.o}
DEP := ${OBJ:.o=.d}
BINTAR := ${BIN}.tar.gz
ASFLAGS += -felf64
${BIN}: ${OBJ}
$(LD) -o $@ $(LDFLAGS) $^
${BUILDDIR}/%.o: %.asm
@mkdir -p ${@D}
@$(AS) -o $@ -M -MF ${@:.o=.d} $<
$(AS) -o $@ $(ASFLAGS) $<
${BINTAR}: ${BIN}
tar czf $@ $^
dist: ${BINTAR}
install: ${BIN}
install -d ${BINPREFIX}
install ${BIN} ${BINPREFIX}
uninstall:
$(RM) ${BINPREFIX}/${BIN}
clean:
$(RM) ${BIN} ${OBJ} ${DEP} ${BINTAR}
-include ${DEP}
.PHONY: dist install uninstall clean