-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (24 loc) · 674 Bytes
/
Copy pathMakefile
File metadata and controls
35 lines (24 loc) · 674 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
NASM := nasm
LD := ld
STRIP := strip
NAFLAGS := -f elf64 -g -F dwarf
LDFLAGS := -nostdlib -static --nmagic
SRCDIR := src
OBJDIR := build
SRCS := $(wildcard $(SRCDIR)/*.asm)
OBJS := $(patsubst $(SRCDIR)/%.asm,$(OBJDIR)/%.o,$(SRCS))
TARGET := claw
.PHONY: all clean stripped
all: $(TARGET)
$(TARGET): $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^
$(OBJDIR)/%.o: $(SRCDIR)/%.asm $(wildcard $(SRCDIR)/*.inc) | $(OBJDIR)
$(NASM) $(NAFLAGS) -I$(SRCDIR)/ -o $@ $<
$(OBJDIR):
mkdir -p $(OBJDIR)
stripped: $(TARGET)
cp $(TARGET) $(TARGET)-stripped
$(STRIP) -s $(TARGET)-stripped
ls -lh $(TARGET)-stripped
clean:
rm -rf $(OBJDIR) $(TARGET) $(TARGET)-stripped