From 8b4f67dc3ea407521943bef5f7a8675d2c0e3227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Wed, 14 Mar 2018 18:31:58 +0100 Subject: [PATCH] Created toolchain file. --- Makefile | 61 --------------------------------------- toolchains/i686-elf.cmake | 6 ++++ 2 files changed, 6 insertions(+), 61 deletions(-) delete mode 100644 Makefile create mode 100644 toolchains/i686-elf.cmake diff --git a/Makefile b/Makefile deleted file mode 100644 index 445fb2d..0000000 --- a/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (C) 2018 Ortega Froysa, Nicolás -# Author: Ortega Froysa, Nicolás -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# General options -TARGET=i686 -ARCH=$(shell echo $(TARGET) | sed s/i.86/x86/) -CROSSFLAGS=--target=$(TARGET)-pc-none-elf -march=$(TARGET) -# Assembly options -AS=nasm -AFLAGS=-felf32 -Isrc/kernel/arch/$(ARCH)/ -Isrc/ -# C options -CC=clang -CFLAGS?=-O0 -g -CFLAGS:=$(CFLAGS) $(CROSSFLAGS) -std=c99 -ffreestanding -fno-builtin -nostdlibinc -Wall -Wextra -Isrc/ -# Linker options -LDFLAGS?=-O0 -LDFLAGS:=$(LDFLAGS) $(CROSSFLAGS) -ffreestanding -nostdlib -LIBS= - -# Binary variables -OBJS=src/kernel/arch/$(ARCH)/boot.o src/kernel/kernel.o src/kernel/arch/$(ARCH)/tty.o - -colonel.bin: $(OBJS) - $(CC) -T src/kernel/arch/$(ARCH)/linker.ld -o $@ $(LDFLAGS) $^ $(LIBS) - -%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - -%.o: %.s - $(AS) $(AFLAGS) $< -o $@ - -.PHONY: all build-iso clean clean-all -all: colonel.bin - -build-iso: colonel.iso - -clean: - rm -f $(OBJS) - rm -rf isodir - -clean-all: clean - rm -f *.iso *.bin - -colonel.iso: colonel.bin - mkdir -p isodir/boot/grub/ - cp configs/grub.cfg isodir/boot/grub/ - cp $< isodir/boot/ - grub-mkrescue -o $@ isodir diff --git a/toolchains/i686-elf.cmake b/toolchains/i686-elf.cmake new file mode 100644 index 0000000..008eeb5 --- /dev/null +++ b/toolchains/i686-elf.cmake @@ -0,0 +1,6 @@ +set(CMAKE_SYSTEM_NAME "Generic") +set(CMAKE_SYSTEM_PROCESSOR "i686") +set(triple "i686-elf") + +set(CMAKE_C_COMPILER clang) +set(CMAKE_C_COMPILER_TARGET ${triple})