-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (31 loc) · 859 Bytes
/
Makefile
File metadata and controls
42 lines (31 loc) · 859 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
42
# Distributed under the terms of the GNU General Public License v2
ARMGNU ?= arm-none-eabi
ARMLD ?= $(ARMGNU)-ld
ARMAS ?= $(ARMGNU)-as
BUILD = build
SOURCE = src
TARGET = kernel.img
LIST = kernel.list
MAP = kernel.map
LINKER = kernel.ld
OBJECTS := $(patsubst $(SOURCE)/%.s,$(BUILD)/%.o,$(wildcard $(SOURCE)/*.s))
all: $(TARGET) $(LIST)
$(LIST): $(BUILD)/output.elf
$(ARMGNU)-objdump -d $< > $@
$(TARGET): $(BUILD)/output.elf
$(ARMGNU)-objcopy $< -O binary $@
$(BUILD)/output.elf: $(OBJECTS) $(LINKER)
$(ARMLD) --no-undefined $(OBJECTS) -Map $(MAP) -o $@ -T $(LINKER)
$(BUILD)/%.o: $(SOURCE)/%.s
$(ARMAS) -I $(SOURCE)/ $< -o $@
install: $(TARGET)
mount $(DEVICE) $(MNT)
cp $< $(MNT)
sync
umount $(MNT)
clean:
rm -f $(BUILD)/*.o
mrproper: clean
rm -f $(TARGET)
rm -f $(LIST)
rm -f $(MAP)