blob: 85cae29ecd4e9d67dc95e591431dbeb15cee9a29 (
plain)
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
|
EXEC := bringelle
CC := gcc -c -m32 -fno-pie -fno-builtin -fno-stack-protector -I ./
LD_SCRIPT := linker.ld
# Note that BOOT_OBJ do not match boot.S
# Indeed boot.o generated by boot.S should appear
# first in the kernel binary (thus it must be linked first, cf the $(EXEC) rule)
BOOT_OBJ := $(addsuffix .o,$(basename $(shell find ./boot -name "*.[c|S]" ! -name "boot.S")))
CORE_OBJ := $(addsuffix .o,$(basename $(shell find ./core -name "*.[c|S]")))
LIBC_OBJ := $(addsuffix .o,$(basename $(shell find ./libc -name "*.[c|S]")))
DRIVERS_OBJ := $(addsuffix .o,$(basename $(shell find ./drivers -name "*.[c|S]")))
all: $(EXEC)
$(EXEC): boot/boot.o $(BOOT_OBJ) $(CORE_OBJ) $(LIBC_OBJ) $(DRIVERS_OBJ) bringelle.o
ld -n -T $(LD_SCRIPT) -nostdlib -o bringelle $^
%.o: %.S
as --32 -o $@ $^
%.o: %.c
$(CC) -o $@ $<
clean:
rm -f $(EXEC)
find ./ -name "*.o" -delete
.PHONY: clean cdrom
|