mirror of
https://github.com/tailix/kernel.git
synced 2024-10-30 12:03:52 -04:00
Make kernel in separate directory
This commit is contained in:
parent
57c2a09944
commit
3e47427b06
4 changed files with 78 additions and 65 deletions
74
Makefile
74
Makefile
|
@ -1,65 +1,15 @@
|
|||
CCPREFIX = i686-elf-
|
||||
|
||||
AR = $(CCPREFIX)ar
|
||||
AS = $(CCPREFIX)as
|
||||
CC = $(CCPREFIX)gcc
|
||||
|
||||
GRUBCFG = rootfs/boot/grub/grub.cfg
|
||||
KERNEL = rootfs/boot/kernelmq.multiboot2
|
||||
PROCMAN = rootfs/boot/procman
|
||||
|
||||
CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra
|
||||
|
||||
IMAGE = image.iso
|
||||
|
||||
# Architecture-dependent
|
||||
OBJS = start.s.o
|
||||
OBJS += main.c.o
|
||||
OBJS += init.c.o
|
||||
OBJS += multiboot.c.o
|
||||
OBJS += panic.c.o panic.asm.cpp.o
|
||||
OBJS += pfa.c.o
|
||||
OBJS += paging.c.o paging.asm.cpp.o
|
||||
OBJS += pagedir.c.o
|
||||
|
||||
# Architecture-independent
|
||||
OBJS += info.c.o
|
||||
|
||||
# Stdlib
|
||||
OBJS += memset.c.o
|
||||
OBJS += strlen.c.o
|
||||
OBJS += itoa.c.o
|
||||
OBJS += strncpy.c.o
|
||||
|
||||
# Built-in drivers
|
||||
OBJS += console.c.o
|
||||
OBJS += pic.c.o
|
||||
OBJS += timer.c.o
|
||||
|
||||
# For debugging
|
||||
OBJS += logger.c.o
|
||||
|
||||
OBJS += protected.c.o protected.asm.cpp.o
|
||||
|
||||
OBJS += tss.c.o tss.asm.cpp.o
|
||||
OBJS += tasks.asm.cpp.o
|
||||
|
||||
OBJS += interrupt.asm.cpp.o
|
||||
|
||||
OBJS += exception.c.o
|
||||
OBJS += hwint.c.o
|
||||
OBJS += syscall.c.o
|
||||
|
||||
OBJS := $(addprefix src/, $(OBJS))
|
||||
|
||||
run: $(IMAGE)
|
||||
qemu-system-i386 -cdrom $< -display none -serial stdio
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
rm -f $(IMAGE)
|
||||
rm -f $(KERNEL)
|
||||
rm -f $(PROCMAN)
|
||||
rm -f $(KERNEL) $(PROCMAN)
|
||||
make -C src clean
|
||||
make -C procman clean
|
||||
|
||||
$(IMAGE): $(GRUBCFG) $(KERNEL) $(PROCMAN)
|
||||
|
@ -69,20 +19,14 @@ $(KERNEL): $(OBJS)
|
|||
$(CC) -T linker.ld -o $@ -ffreestanding -nostdlib -lgcc $^
|
||||
grub-file --is-x86-multiboot2 $@
|
||||
|
||||
$(KERNEL): src/kernelmq.multiboot2
|
||||
cp $< $@
|
||||
|
||||
$(PROCMAN): procman/procman
|
||||
cp procman/procman $(PROCMAN)
|
||||
cp $< $@
|
||||
|
||||
src/kernelmq.multiboot2:
|
||||
make -C src kernelmq.multiboot2
|
||||
|
||||
procman/procman:
|
||||
make -C procman procman
|
||||
|
||||
%.c.o: %.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
||||
%.s.o: %.s
|
||||
$(AS) $< -o $@
|
||||
|
||||
%.asm.cpp.o: %.asm.cpp
|
||||
nasm -felf32 -o $@ $<
|
||||
|
||||
%.asm.cpp: %.asm
|
||||
cpp -P $< $@
|
||||
|
|
1
src/.gitignore
vendored
Normal file
1
src/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/kernelmq.multiboot2
|
68
src/Makefile
Normal file
68
src/Makefile
Normal file
|
@ -0,0 +1,68 @@
|
|||
CCPREFIX = i686-elf-
|
||||
|
||||
AR = $(CCPREFIX)ar
|
||||
AS = $(CCPREFIX)as
|
||||
CC = $(CCPREFIX)gcc
|
||||
|
||||
KERNEL = kernelmq.multiboot2
|
||||
|
||||
CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra
|
||||
|
||||
# Architecture-dependent
|
||||
OBJS = start.s.o
|
||||
OBJS += main.c.o
|
||||
OBJS += init.c.o
|
||||
OBJS += multiboot.c.o
|
||||
OBJS += panic.c.o panic.asm.cpp.o
|
||||
OBJS += pfa.c.o
|
||||
OBJS += paging.c.o paging.asm.cpp.o
|
||||
OBJS += pagedir.c.o
|
||||
|
||||
# Architecture-independent
|
||||
OBJS += info.c.o
|
||||
|
||||
# Stdlib
|
||||
OBJS += memset.c.o
|
||||
OBJS += strlen.c.o
|
||||
OBJS += itoa.c.o
|
||||
OBJS += strncpy.c.o
|
||||
|
||||
# Built-in drivers
|
||||
OBJS += console.c.o
|
||||
OBJS += pic.c.o
|
||||
OBJS += timer.c.o
|
||||
|
||||
# For debugging
|
||||
OBJS += logger.c.o
|
||||
|
||||
OBJS += protected.c.o protected.asm.cpp.o
|
||||
|
||||
OBJS += tss.c.o tss.asm.cpp.o
|
||||
OBJS += tasks.asm.cpp.o
|
||||
|
||||
OBJS += interrupt.asm.cpp.o
|
||||
|
||||
OBJS += exception.c.o
|
||||
OBJS += hwint.c.o
|
||||
OBJS += syscall.c.o
|
||||
|
||||
all: $(KERNEL)
|
||||
|
||||
clean:
|
||||
rm -f $(KERNEL) $(OBJS)
|
||||
|
||||
$(KERNEL): $(OBJS)
|
||||
$(CC) -T linker.ld -o $@ -ffreestanding -nostdlib -lgcc $^
|
||||
grub-file --is-x86-multiboot2 $@
|
||||
|
||||
%.c.o: %.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
||||
%.s.o: %.s
|
||||
$(AS) $< -o $@
|
||||
|
||||
%.asm.cpp.o: %.asm.cpp
|
||||
nasm -felf32 -o $@ $<
|
||||
|
||||
%.asm.cpp: %.asm
|
||||
cpp -P $< $@
|
Loading…
Reference in a new issue