From: acevest Date: Fri, 29 Oct 2021 00:00:13 +0000 (+0800) Subject: fix compile under MacOS X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=c6b7f7722169f06f8bd67be6649d8eb527f66a13;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}