...
 
Commits (7)
......@@ -26,6 +26,7 @@ Makefile.out.2
build/bin/s**
.buildconfig
#.stylehlp
cross-cc*
# Linker output
*.ilk
......
......@@ -22,7 +22,7 @@
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
.PHONY: all test testnokvm testnosnd test32 debug gdb ddd gdbnokvm dddnokvm installonimage dust clean OS/K run
.PHONY: all test testnokvm testnosnd test32 debug gdb ddd gdbnokvm dddnokvm installonimage dust clean OS/K run update-cross-cc
.DELETE_ON_ERROR: $(BINDIR)/kaleid
.DEFAULT_GOAL := all
......@@ -33,6 +33,12 @@ mode ?= debug
ram ?= 4G
cpu ?= core2duo
# Cross-cc
CROSS-CC-DIR := $(shell pwd)/cross-cc
LATEST-CROSS-CC := https://gitlab.os-k.eu/os-k-team/cross-cc-builder/uploads/fcb43b0cc04c75ff89e40b4b24567484/cross-cc.tar.xz
export PATH := $(CROSS-CC-DIR)/bin:$(PATH)
NTHREADS := $(shell nproc)
# Programs
ASM=nasm
LD=x86_64-elf-ld
......@@ -45,7 +51,7 @@ LDFLAGS=-melf_x86_64
COPTIM=-O2
CWARNS=-Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror=implicit-function-declaration -Werror=return-type #-Wpadded
CINCLUDES=-Iinclude -Iinclude/drivers -Iinclude/kernel
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-all -fdump-rtl-expand
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-strong -fdump-rtl-expand
CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2
CFLAGS= $(CFLAGS1) $(CFLAGS2)
CFLAGS_MATHS= $(CFLAGS1) -c -mno-red-zone -mno-mmx
......@@ -138,6 +144,12 @@ DriverDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(DriverSources))
## MISC MAKEFILE ------------------------------------------------------------- #
$(CROSS-CC-DIR)/bin/x86_64-elf-gcc:
@echo ${CL2}[$@] ${NC} Downloading and extracting the cross-compiler...${CL3}
@wget $(LATEST-CROSS-CC) -O $(CROSS-CC-DIR).tar.xz -q -c --show-progress
@tar -xaf $(CROSS-CC-DIR).tar.xz --skip-old-files
@echo ${CL2}[$@] ${CL}Success.${CL3}
./ProjectTree: ./.stylehlp_sh
@cat ./.stylehlp_sh > ./ProjectTree
@echo "\n" >> ./ProjectTree
......@@ -242,7 +254,7 @@ $(KOBJDIR)/drivers/ata.o: $(KALEIDDIR)/drivers/ata.c $(KALEIDDIR)/drivers/ata.as
## DEPENDENCIES MAKEFILE ----------------------------------------------------- #
$(KOBJDIR)/%.d: %.c | $(KOBJDIR)
$(KOBJDIR)/%.d: %.c $(CROSS-CC-DIR)/bin/x86_64-elf-gcc | $(KOBJDIR)
@mkdir -p $(shell dirname $@)
@$(KCC) -MM -MT $(@:%.d=%.o) -MF $@ $<
@echo ${CL2}[$@] ${CL}Dependencies generated.${CL3}
......@@ -279,8 +291,8 @@ $(LOBJDIR)/loader.o: $(LOADERDIR)/loader.asm $(LOADERDIR)/*/*.inc
OS/K: $(dep) ./ProjectTree $(BINDIR)/kaleid
@echo ${CL2}[[$@]] ${NC} OS/K successfully made, $(mode) mode.${CL3}
all :
@make OS/K -j 8
all : $(CROSS-CC-DIR)/bin/x86_64-elf-gcc
@make OS/K -j $(NTHREADS)
## QEMU/DEBUG RELATED
test: all installonimage
......@@ -361,3 +373,7 @@ clean:
@rm -Rvf ./ProjectTree $(BUILDDIR)/*.log
@rm -Rvf $(BINDIR) $(OBJDIR)
@echo ${CL2}[$@] ${CL}Cleaned.${CL3}
update-cross-cc:
@rm -rf cross-cc
@echo ${CL2}[$@] ${CL}Ready to update.${CL3}
This diff is collapsed.
......@@ -23,13 +23,13 @@ apt update && apt upgrade
apt install grub-pc-bin dosfstools make nasm qemu tree libisl15 parted udisks2
```
You also need to have the [x86-64 ELF gcc cross-compiler](https://www.os-k.eu/build-tools/cross-cc.tar.xz) and its ``bin`` directory in your PATH.
To compile, simply use at the root of this project :
```
make
```
The OS/K cross-compiler will automatically be installed.
To compile and test, simply use at the root of this project :
```
make test
......