-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (50 loc) · 1.13 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
VERSION=0
PATCHLEVEL=0
SUBLEVEL=1
PWD=$(shell pwd)
export KERNELDIR=$(PWD)
HOST?=$(ARCH)
CROSS-COMPILE=$(ARCH)-elf-
CC=$(CROSS-COMPILE)gcc
CFLAGS?=-O2
LDFLAGS?=
LIBS?=
ARCHDIR?=$(KERNELDIR)/arch/$(HOST)
DESTDIR?=$(KERNELDIR)/iso/boot
INITTDIR?=$(KERNELDIR)/init
INCLUDEDIR?=$(KERNELDIR)/include
SRCDIR?=$(KERNELDIR)/kernel
include $(KERNELDIR)/Kconfig
include $(ARCHDIR)/Kconfig
include $(INITTDIR)/Kconfig
include $(SRCDIR)/Kconfig
#CFLAGS:=-I $(INCLUDEDIR)
CFLAGS:=$(CFLAGS) -ffreestanding -fbuiltin -Wall -Wextra -isystem $(INCLUDEDIR)
LDFLAGS:=$(LDFLAGS)
LIBS:=$(LIBS) -nostdlib -lgcc -lk
CFLAGS:=$(CFLAGS) $(ARCH_CFLAGS)
LDFLAGS:=$(LDFLAGS) $(ARCH_LDFLAGS)
LIBS:=$(LIBS) $(ARCH_LIBS)
export CC
export ARCHDIR
export DESTDIR
export INITTDIR
export INCLUDEDIR
export SRCDIR
export CFLAGS
export LDFLAGS
export LIBS
all: default
default:
make -C $(SRCDIR)
make -C $(ARCHDIR)
make -C $(INITTDIR)
#make -C $(INCLUDEDIR)
mkdir -p $(DESTDIR)/grub
cp $(INITTDIR)/*.o $(ARCHDIR)/*.ld $(ARCHDIR)/*.o $(DESTDIR)
cp grub.cfg $(DESTDIR)/grub
grub-mkrescue -o kernel.iso iso
clean:
make -C arch/i686 clean
make -C init clean
rm -rf iso *.iso