diff --git a/Makefile b/Makefile index 66ccae01..1a2c1f09 100644 --- a/Makefile +++ b/Makefile @@ -32,12 +32,8 @@ ifeq ($(shell PATH='$(call SHESCAPE,$(PATH))' command -v $(TOOLCHAIN_CC) ; ), ) override TOOLCHAIN_CC := cc endif -ifeq ($(TOOLCHAIN_CC), clang) -TOOLCHAIN_CC += --target=x86_64-elf ifeq ($(TOOLCHAIN_CC), clang) override TOOLCHAIN_CC += --target=x86_64-elf -MAKEOVERRIDES += TOOLCHAIN_CC+=--target=x86_64-elf -endif endif override CC_MACHINE := $(shell PATH='$(call SHESCAPE,$(PATH))' $(TOOLCHAIN_CC) -dumpmachine | dd bs=6 count=1 2>/dev/null) @@ -54,6 +50,10 @@ endif endif endif +ifeq ($(TOOLCHAIN_CC), clang --target=x86_64-elf) +override TOOLCHAIN_CC := clang +endif + override STAGE1_FILES := $(shell find -L ./stage1 -type f -name '*.asm') .PHONY: all diff --git a/decompressor/Makefile b/decompressor/Makefile index 3ff3defd..6a18f4c9 100644 --- a/decompressor/Makefile +++ b/decompressor/Makefile @@ -30,6 +30,10 @@ ifeq ($(shell command -v $(TOOLCHAIN_OBJCOPY) ; ), ) override TOOLCHAIN_OBJCOPY := objcopy endif +ifeq ($(TOOLCHAIN_CC), clang) +override TOOLCHAIN_CC += --target=i686-elf +endif + WERROR = -Werror CFLAGS ?= -Os -pipe -Wall -Wextra $(WERROR) diff --git a/stage23/Makefile b/stage23/Makefile index 531b4108..c46e0ec1 100644 --- a/stage23/Makefile +++ b/stage23/Makefile @@ -55,6 +55,18 @@ ifeq ($(shell command -v $(TOOLCHAIN_READELF) ; ), ) override TOOLCHAIN_READELF := readelf endif +ifeq ($(TOOLCHAIN_CC), clang) +ifeq ($(TARGET), bios) +override TOOLCHAIN_CC += --target=i686-elf +endif +ifeq ($(TARGET), uefi) +override TOOLCHAIN_CC += --target=x86_64-elf +endif +ifeq ($(TARGET), uefi32) +override TOOLCHAIN_CC += --target=i686-elf +endif +endif + COM_OUTPUT = false E9_OUTPUT = false