forked from PoliEcho-holding-org/kern
Commited some old changes, idk what they were
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Variables
|
||||
CC = i386-elf-gcc
|
||||
LD = i386-elf-ld
|
||||
CC = i686-elf-gcc
|
||||
LD = i686-elf-ld
|
||||
AS = nasm
|
||||
|
||||
CFLAGS = -std=c17 -ffreestanding -fno-builtin -fno-stack-protector -fno-pie \
|
||||
@@ -8,51 +8,51 @@ CFLAGS = -std=c17 -ffreestanding -fno-builtin -fno-stack-protector -fno-pie \
|
||||
LDFLAGS = -z notext -melf_i386
|
||||
|
||||
SRC = ./src
|
||||
BUILD = ./build
|
||||
BIN = ./bin
|
||||
C_FILES = calc editor
|
||||
FONTS = testfont term16n
|
||||
|
||||
.PHONY: os clean run
|
||||
|
||||
# Main compilation target
|
||||
os: $(BUILD) bootloader kernel $(C_FILES) $(FONTS)
|
||||
os: $(BIN) bootloader kernel $(C_FILES) $(FONTS)
|
||||
@cc ./makedisk.c -o ./makedisk
|
||||
@./makedisk # TODO: List of files
|
||||
@echo "\nDone!\n"
|
||||
|
||||
$(BUILD):
|
||||
@[ -d $(BUILD) ] || mkdir $(BUILD)
|
||||
@rm -rf $(BUILD)/*
|
||||
$(BIN):
|
||||
@[ -d $(BIN) ] || mkdir $(BIN)
|
||||
@rm -rf $(BIN)/*
|
||||
|
||||
# Bootloader: This target is responsible for creating stage?.bin (1,2,3)
|
||||
bootloader: $(SRC)/stage1.asm $(SRC)/stage2.asm
|
||||
@echo "Assembling $(SRC)/stage1.asm..."
|
||||
@$(AS) -fbin -o $(BUILD)/stage1.bin $(SRC)/stage1.asm
|
||||
@$(AS) -fbin -o $(BIN)/stage1.bin $(SRC)/stage1.asm
|
||||
@echo "Assembling $(SRC)/stage2.asm..."
|
||||
@$(AS) -fbin -o $(BUILD)/stage2.bin $(SRC)/stage2.asm
|
||||
@$(AS) -fbin -o $(BIN)/stage2.bin $(SRC)/stage2.asm
|
||||
@echo "Compiling $(SRC)/stage3.c..."
|
||||
@$(CC) $(CFLAGS) -Iinclude -o $(BUILD)/stage3.o -c $(SRC)/stage3.c
|
||||
@$(LD) $(LDFLAGS) -T$(SRC)/stage3.ld --oformat binary -o $(BUILD)/stage3.bin $(BUILD)/stage3.o
|
||||
@rm $(BUILD)/stage3.o
|
||||
@$(CC) $(CFLAGS) -Iinclude -o $(BIN)/stage3.o -c $(SRC)/stage3.c
|
||||
@$(LD) $(LDFLAGS) -T$(SRC)/stage3.ld --oformat binary -o $(BIN)/stage3.bin $(BIN)/stage3.o
|
||||
@rm $(BIN)/stage3.o
|
||||
|
||||
# Kernel: This target is responsible for creating kernel.bin
|
||||
kernel: $(SRC)/kernel.c
|
||||
@echo "Compiling $(SRC)/kernel.c..."
|
||||
@$(CC) $(CFLAGS) -Iinclude -o $(BUILD)/kernel.o -c $(SRC)/kernel.c
|
||||
@$(LD) $(LDFLAGS) -T$(SRC)/kernel.ld --oformat binary -o $(BUILD)/kernel.bin $(BUILD)/kernel.o
|
||||
@rm $(BUILD)/kernel.o
|
||||
@$(CC) $(CFLAGS) -Iinclude -o $(BIN)/kernel.o -c $(SRC)/kernel.c
|
||||
@$(LD) $(LDFLAGS) -T$(SRC)/kernel.ld --oformat binary -o $(BIN)/kernel.bin $(BIN)/kernel.o
|
||||
@rm $(BIN)/kernel.o
|
||||
|
||||
# This target compiles *.c (except kernel.c)
|
||||
$(C_FILES):
|
||||
@echo "Compiling $(SRC)/$@.c..."
|
||||
@$(CC) $(CFLAGS) -o $(BUILD)/$@.o -c $(SRC)/$@.c
|
||||
@$(LD) $(LDFLAGS) -T$(SRC)/$@.ld --oformat binary -o $(BUILD)/$@.bin $(BUILD)/$@.o
|
||||
@rm $(BUILD)/$@.o
|
||||
@$(CC) $(CFLAGS) -o $(BIN)/$@.o -c $(SRC)/$@.c
|
||||
@$(LD) $(LDFLAGS) -T$(SRC)/$@.ld --oformat binary -o $(BIN)/$@.bin $(BIN)/$@.o
|
||||
@rm $(BIN)/$@.o
|
||||
|
||||
# This target builds all fonts inside src/fonts
|
||||
$(FONTS):
|
||||
@echo "Assembling $(SRC)/fonts/$@.asm..."
|
||||
@$(AS) -fbin -o $(BUILD)/$@.fnt $(SRC)/fonts/$@.asm
|
||||
@$(AS) -fbin -o $(BIN)/$@.fnt $(SRC)/fonts/$@.asm
|
||||
|
||||
# Run QEMU
|
||||
run:
|
||||
@@ -64,7 +64,7 @@ run:
|
||||
|
||||
# Clean all build files
|
||||
clean:
|
||||
@rm -rf $(BUILD)
|
||||
@rm -rf $(BIN)
|
||||
@rm -f kern.iso
|
||||
@rm makedisk
|
||||
|
||||
|
||||
Reference in New Issue
Block a user