-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
38 lines (31 loc) · 938 Bytes
/
Makefile
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
NASM = nasm
CC = i686-elf-gcc
CFLAGS = -std=gnu99 -O2 -Wall -Wextra -g
OBJCOPY = i686-elf-objcopy
QEMU = qemu-system-i386
SUDO = sudo
QEMUFLAGS = -m 512 -hda disk/minixdisk -hdc disk/fat32disk -serial stdio -monitor telnet:127.0.0.1:11111,server,nowait
QEMUNETFLAGS = -net nic,model=rtl8139 -net tap,ifname=tap0,script=ifup.sh
RM = rm -f
BINDIR = bin
SYSDIR = sys
USRDIR = usr
CRTI_OBJ = crti.o
CRTBEGIN_OBJ := $(shell $(CC) $(CFLAGS) -print-file-name=crtbegin.o)
CRTEND_OBJ := $(shell $(CC) $(CFLAGS) -print-file-name=crtend.o)
CRTN_OBJ = crtn.o
KERN_ELF = $(BINDIR)/kernel.elf
.PHONY: all
all:
-mkdir -p $(BINDIR)
$(MAKE) -C $(SYSDIR)
.PHONY: clean
clean:
$(RM) $(BINDIR)/*.elf
$(MAKE) clean -C $(SYSDIR)
.PHONY: run
run: all
$(QEMU) -kernel $(KERN_ELF) -s $(QEMUFLAGS)
.PHONY: run-with-network
run-with-network: all
$(SUDO) $(QEMU) -kernel $(KERN_ELF) -s $(QEMUFLAGS) $(QEMUNETFLAGS)