mirror of
https://github.com/tailix/kernel.git
synced 2025-09-04 22:42:59 -04:00
Build kernel in arch directory
This commit is contained in:
parent
26e2c2d063
commit
7865fdf85d
4 changed files with 7 additions and 11 deletions
8
Makefile
8
Makefile
|
@ -8,10 +8,8 @@ export INCLUDE = $(shell pwd)/include
|
||||||
export KERNEL = $(shell pwd)/kernelmq
|
export KERNEL = $(shell pwd)/kernelmq
|
||||||
|
|
||||||
export LIBSRC = $(shell pwd)/src/libsrc.a
|
export LIBSRC = $(shell pwd)/src/libsrc.a
|
||||||
export LIBARCH = $(shell pwd)/arch/$(ARCH)/libarch.a
|
|
||||||
export LIBK = $(shell pwd)/libk/libk.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 MODULES = $(addprefix $(shell pwd)/modules/, dummy1.bin dummy2.bin)
|
||||||
|
|
||||||
export CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I $(INCLUDE)
|
export CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I $(INCLUDE)
|
||||||
|
@ -32,8 +30,8 @@ test: run-test
|
||||||
# Kernel #
|
# Kernel #
|
||||||
##########
|
##########
|
||||||
|
|
||||||
all-kernel: all-src all-arch all-libk
|
all-kernel: all-arch
|
||||||
$(CC) -T $(LINKER) -o $(KERNEL) -ffreestanding -nostdlib -lgcc $(LIBARCH) $(LIBSRC) $(LIBK)
|
cp arch/$(ARCH)/kernel $(KERNEL)
|
||||||
|
|
||||||
clean-kernel:
|
clean-kernel:
|
||||||
rm -f $(KERNEL)
|
rm -f $(KERNEL)
|
||||||
|
@ -52,7 +50,7 @@ clean-src:
|
||||||
# arch #
|
# arch #
|
||||||
########
|
########
|
||||||
|
|
||||||
all-arch:
|
all-arch: all-src all-libk
|
||||||
make all -C arch
|
make all -C arch
|
||||||
|
|
||||||
clean-arch:
|
clean-arch:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
export OUTPUT = kernel
|
||||||
|
|
||||||
ARCHES = $(shell ls -d */)
|
ARCHES = $(shell ls -d */)
|
||||||
ARCHES := $(ARCHES:/=)
|
ARCHES := $(ARCHES:/=)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
OUTPUT = libarch.a
|
|
||||||
|
|
||||||
OBJS = dummy.c.o
|
OBJS = dummy.c.o
|
||||||
|
|
||||||
all: $(OUTPUT)
|
all: $(OUTPUT)
|
||||||
|
@ -8,7 +6,7 @@ clean:
|
||||||
rm -f $(OUTPUT) $(OBJS)
|
rm -f $(OUTPUT) $(OBJS)
|
||||||
|
|
||||||
$(OUTPUT): $(OBJS)
|
$(OUTPUT): $(OBJS)
|
||||||
$(AR) -rcs $@ $(OBJS)
|
$(CC) -T linker.ld -o $(OUTPUT) -ffreestanding -nostdlib -lgcc $(OBJS) $(LIBSRC) $(LIBK)
|
||||||
|
|
||||||
%.c.o: %.c
|
%.c.o: %.c
|
||||||
$(CC) -c $< -o $@ -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I "$(INCLUDE)"
|
$(CC) -c $< -o $@ -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I "$(INCLUDE)"
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
OUTPUT = libarch.a
|
|
||||||
|
|
||||||
# Architecture-dependent
|
# Architecture-dependent
|
||||||
OBJS = start.s.o
|
OBJS = start.s.o
|
||||||
OBJS += init.c.o
|
OBJS += init.c.o
|
||||||
|
@ -37,7 +35,7 @@ clean:
|
||||||
rm -f $(OUTPUT) $(OBJS)
|
rm -f $(OUTPUT) $(OBJS)
|
||||||
|
|
||||||
$(OUTPUT): $(OBJS)
|
$(OUTPUT): $(OBJS)
|
||||||
$(AR) -rcs $@ $(OBJS)
|
$(CC) -T linker.ld -o $(OUTPUT) -ffreestanding -nostdlib -lgcc $(OBJS) $(LIBSRC) $(LIBK)
|
||||||
|
|
||||||
%.c.o: %.c
|
%.c.o: %.c
|
||||||
$(CC) -c $< -o $@ $(CFLAGS)
|
$(CC) -c $< -o $@ $(CFLAGS)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue