aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: a1586e1b663f0cad6c6896ad524959d6d5eaeb4a (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
include config.mk

.PHONY: all clean distclean emulate install

all: $(kernel)

clean:
	@echo "  (RM)    iso"
	$(QUIET)$(RM) -r iso
	@echo "  (RM)    $(kernel_iso)"
	$(QUIET)$(RM) $(kernel_iso)
	@echo "  (RM)    $(objects)"
	$(QUIET)$(RM) $(objects)
	@echo "  (RM)    $(dependencies)"
	$(QUIET)$(RM) $(dependencies)

emulate: $(kernel_iso)
	@echo "  (QEMU)  $^"
	$(QUIET)$(QEMU) -cdrom $^

distclean: clean
	@echo "  (RM)    $(kernel)"
	$(QUIET)$(RM) $(kernel)

install: $(kernel)
	@echo "  (CP)    $^"
	$(QUIET)$(CP) $< $(INSTALL_DIR)

%.o: %.c
	@echo "  (CC)    $@"
	$(QUIET)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@

%.o: %.s
	@echo "  (AS)    $@"
	$(QUIET)$(AS) $(ASFLAGS) $< -o $@

$(kernel): $(memmap) $(objects)
	@echo "  (LD)    $@"
	$(QUIET) $(LD) $(LDFLAGS) -T $< -o $@ $(objects)

$(kernel_iso): $(kernel) misc/grub.cfg
	mkdir -p iso/boot/grub
	cp $^ iso/boot
	cp misc/grub.cfg iso/boot/grub
	grub-mkrescue --output=$@ iso

-include $(dependencies)