aboutsummaryrefslogtreecommitdiff
path: root/Marmot/Makefile
blob: c8340952275aada5f9a3dfa8a912f404a4de2581 (plain) (blame)
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
48
49
# Makefile for Marmot

CC = /usr/bin/gcc
LD = /usr/bin/ld
PERL = /usr/bin/perl

ASFLAGS = -Wa,--fatal-warnings
CFLAGS = -Wall -O2 -ffreestanding -funsigned-char -fno-common -I. -I.
LDFLAGS = -Map link.map --script=ld.conf

SFILES = boot.S loader.S interrupts.S vesa.S font.S util.S
CFILES = mm.c video.c irq.c task.c apic.c cpu.c pci.c alloc.c panic.c


.PHONY : all
all : marmot.iso

# Run this rule manually - should never need to be done
.PHONY : fonts
fonts :
	$(PERL) hexfont2data.pl basic_font.hex font.S

marmot.iso : boot.img
	mkdir -p iso_files
	cp -f boot.img marmot.bmp iso_files/
	genisoimage -b boot.img -o marmot.iso iso_files

boot.img : boot
	$(PERL) mksym.pl
	dd if=/dev/urandom of=$@ bs=512 count=2880
	dd if=boot of=$@ bs=512 seek=0 conv=notrunc
	$(PERL) cs.pl

boot : $(SFILES:.S=.o) $(CFILES:.c=.o)
	$(LD) $^ $(LDFLAGS) -o $@

.PHONY : asm
asm : $(CFILES:.c=.s)

%.o : %.S
	$(CC) $(CFLAGS) $(ASFLAGS) -c -o $@ $<

%.s : %.c
	$(CC) $(CFLAGS) -S $<

.PHONY : clean
clean :
	rm -fr iso_files
	rm -f boot boot.img marmot.iso link.map symbols.txt *.s *.o *~