mirror of
https://github.com/tailix/kernel.git
synced 2025-04-21 17:42:20 -04:00
Separate source tree for architecture-independent code
This commit is contained in:
parent
ddac5fcb06
commit
e2228ec347
4 changed files with 33 additions and 7 deletions
21
Makefile
21
Makefile
|
@ -6,11 +6,16 @@ export CC = $(CCPREFIX)gcc
|
|||
|
||||
export INCLUDE = $(shell pwd)/include
|
||||
export KERNEL = $(shell pwd)/kernelmq
|
||||
export LIBK = $(shell pwd)/libk/libk.a
|
||||
|
||||
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)
|
||||
|
||||
ifeq (none, $(ARCH))
|
||||
run: test
|
||||
else
|
||||
|
@ -27,12 +32,22 @@ test: run-test
|
|||
# Kernel #
|
||||
##########
|
||||
|
||||
all-kernel: all-arch all-libk
|
||||
$(CC) -T $(LINKER) -o $(KERNEL) -ffreestanding -nostdlib -lgcc $(LIBARCH) $(LIBK)
|
||||
all-kernel: all-src all-arch all-libk
|
||||
$(CC) -T $(LINKER) -o $(KERNEL) -ffreestanding -nostdlib -lgcc $(LIBARCH) $(LIBSRC) $(LIBK)
|
||||
|
||||
clean-kernel:
|
||||
rm -f $(KERNEL)
|
||||
|
||||
#######
|
||||
# src #
|
||||
#######
|
||||
|
||||
all-src:
|
||||
make all -C src
|
||||
|
||||
clean-src:
|
||||
make clean -C src
|
||||
|
||||
########
|
||||
# arch #
|
||||
########
|
||||
|
|
|
@ -9,7 +9,6 @@ OBJS += pfa.c.o
|
|||
OBJS += paging.c.o paging.asm.cpp.o
|
||||
|
||||
# Architecture-independent
|
||||
OBJS += ../../src/info.c.o
|
||||
OBJS += main.c.o
|
||||
|
||||
# Built-in drivers
|
||||
|
@ -41,7 +40,7 @@ $(OUTPUT): $(OBJS)
|
|||
$(AR) -rcs $@ $(OBJS)
|
||||
|
||||
%.c.o: %.c
|
||||
$(CC) -c $< -o $@ -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra -I "$(INCLUDE)"
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
||||
%.s.o: %.s
|
||||
$(AS) $< -o $@
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
OUTPUT = libk.a
|
||||
|
||||
CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra
|
||||
|
||||
OBJS = memset.o strlen.o itoa.o strncpy.o
|
||||
|
||||
all: $(OUTPUT)
|
||||
|
|
14
src/Makefile
Normal file
14
src/Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
OUTPUT = libsrc.a
|
||||
|
||||
OBJS = info.o
|
||||
|
||||
all: $(OUTPUT)
|
||||
|
||||
clean:
|
||||
rm -f $(OUTPUT) $(OBJS)
|
||||
|
||||
$(OUTPUT): $(OBJS)
|
||||
$(AR) -rcs $@ $(OBJS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
Loading…
Add table
Reference in a new issue