From: acevest Date: Fri, 29 Oct 2021 00:00:13 +0000 (+0800) Subject: fix compile under MacOS X-Git-Tag: 0.3.1~1^2 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=6f51029cf66445f8c08b14f3b7da9b30af805148;p=kernel.git fix compile under MacOS --- diff --git a/Makefile b/Makefile index 8814119..75dbf4a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,10 @@ CC = gcc +LD = ld +UNAME := $(shell uname -s) +ifeq ($(UNAME), Darwin) + CC = i686-elf-gcc + LD = i686-elf-ld +endif CFLAGS = -g -c -fno-builtin -m32 SYSTEMMAP = System.map KERNELBIN = KERNEL.BIN @@ -15,7 +21,7 @@ HEADER_FILES := $(foreach DIR, $(INC_DIRS), $(wildcard $(DIR)/*.h)) OBJS := $(patsubst %,%.o,$(SOURCE_FILES)) ${KERNELBIN}: ${OBJS} - ld -m elf_i386 -M -T$(LINKSCRIPT) $(OBJS) -o $@ > $(SYSTEMMAP) + ${LD} -m elf_i386 -M -T$(LINKSCRIPT) $(OBJS) -o $@ > $(SYSTEMMAP) rm kernel/setup.c.o %.S.o: %.S ${HEADER_FILES}