1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-11-20 11:16:10 -05:00

Build kernel in arch directory

This commit is contained in:
Braiden Vasco 2017-11-08 12:02:36 +00:00
parent 26e2c2d063
commit 7865fdf85d
4 changed files with 7 additions and 11 deletions

View file

@ -8,10 +8,8 @@ export INCLUDE = $(shell pwd)/include
export KERNEL = $(shell pwd)/kernelmq
export LIBSRC = $(shell pwd)/src/libsrc.a
export LIBARCH = $(shell pwd)/arch/$(ARCH)/libarch.a
export LIBK = $(shell pwd)/libk/libk.a
export LINKER = $(shell pwd)/arch/$(ARCH)/linker.ld
export MODULES = $(addprefix $(shell pwd)/modules/, dummy1.bin dummy2.bin)
export CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I $(INCLUDE)
@ -32,8 +30,8 @@ test: run-test
# Kernel #
##########
all-kernel: all-src all-arch all-libk
$(CC) -T $(LINKER) -o $(KERNEL) -ffreestanding -nostdlib -lgcc $(LIBARCH) $(LIBSRC) $(LIBK)
all-kernel: all-arch
cp arch/$(ARCH)/kernel $(KERNEL)
clean-kernel:
rm -f $(KERNEL)
@ -52,7 +50,7 @@ clean-src:
# arch #
########
all-arch:
all-arch: all-src all-libk
make all -C arch
clean-arch:

View file

@ -1,3 +1,5 @@
export OUTPUT = kernel
ARCHES = $(shell ls -d */)
ARCHES := $(ARCHES:/=)

View file

@ -1,5 +1,3 @@
OUTPUT = libarch.a
OBJS = dummy.c.o
all: $(OUTPUT)
@ -8,7 +6,7 @@ clean:
rm -f $(OUTPUT) $(OBJS)
$(OUTPUT): $(OBJS)
$(AR) -rcs $@ $(OBJS)
$(CC) -T linker.ld -o $(OUTPUT) -ffreestanding -nostdlib -lgcc $(OBJS) $(LIBSRC) $(LIBK)
%.c.o: %.c
$(CC) -c $< -o $@ -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I "$(INCLUDE)"

View file

@ -1,5 +1,3 @@
OUTPUT = libarch.a
# Architecture-dependent
OBJS = start.s.o
OBJS += init.c.o
@ -37,7 +35,7 @@ clean:
rm -f $(OUTPUT) $(OBJS)
$(OUTPUT): $(OBJS)
$(AR) -rcs $@ $(OBJS)
$(CC) -T linker.ld -o $(OUTPUT) -ffreestanding -nostdlib -lgcc $(OBJS) $(LIBSRC) $(LIBK)
%.c.o: %.c
$(CC) -c $< -o $@ $(CFLAGS)