add LLVM/clang-3.5+ support
This commit is contained in:
parent
529b9596e5
commit
52d573e68a
7
README
7
README
@ -86,6 +86,13 @@ OR
|
|||||||
6 handin your code
|
6 handin your code
|
||||||
$make handin
|
$make handin
|
||||||
|
|
||||||
|
OPTION
|
||||||
|
==============
|
||||||
|
Now, ucore suuport LLVM/Clang-3.5 +
|
||||||
|
in step4:
|
||||||
|
$ USELLVM=1 make
|
||||||
|
then you will use clang to compile ucore
|
||||||
|
|
||||||
GRADE/RANK
|
GRADE/RANK
|
||||||
==========
|
==========
|
||||||
Superman: Finish all OS labs in one month by yourself
|
Superman: Finish all OS labs in one month by yourself
|
||||||
|
@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
|
|||||||
SLASH := /
|
SLASH := /
|
||||||
|
|
||||||
V := @
|
V := @
|
||||||
|
#need llvm/cang-3.5+
|
||||||
|
#USELLVM := 1
|
||||||
# try to infer the correct GCCPREFX
|
# try to infer the correct GCCPREFX
|
||||||
ifndef GCCPREFIX
|
ifndef GCCPREFIX
|
||||||
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
||||||
@ -23,10 +24,12 @@ endif
|
|||||||
|
|
||||||
# try to infer the correct QEMU
|
# try to infer the correct QEMU
|
||||||
ifndef QEMU
|
ifndef QEMU
|
||||||
QEMU := $(shell if which qemu > /dev/null; \
|
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
|
||||||
then echo 'qemu'; exit; \
|
then echo 'qemu-system-i386'; exit; \
|
||||||
elif which i386-elf-qemu > /dev/null; \
|
elif which i386-elf-qemu > /dev/null; \
|
||||||
then echo 'i386-elf-qemu'; exit; \
|
then echo 'i386-elf-qemu'; exit; \
|
||||||
|
elif which qemu > /dev/null; \
|
||||||
|
then echo 'qemu'; exit; \
|
||||||
else \
|
else \
|
||||||
echo "***" 1>&2; \
|
echo "***" 1>&2; \
|
||||||
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
||||||
@ -41,13 +44,20 @@ endif
|
|||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# define compiler and flags
|
# define compiler and flags
|
||||||
|
ifndef USELLVM
|
||||||
HOSTCC := gcc
|
HOSTCC := gcc
|
||||||
HOSTCFLAGS := -g -Wall -O2
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
|
||||||
CC := $(GCCPREFIX)gcc
|
CC := $(GCCPREFIX)gcc
|
||||||
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
||||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
else
|
||||||
|
HOSTCC := clang
|
||||||
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)clang
|
||||||
|
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
|
||||||
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
endif
|
||||||
|
|
||||||
CTYPE := c S
|
CTYPE := c S
|
||||||
|
|
||||||
LD := $(GCCPREFIX)ld
|
LD := $(GCCPREFIX)ld
|
||||||
|
@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
|
|||||||
SLASH := /
|
SLASH := /
|
||||||
|
|
||||||
V := @
|
V := @
|
||||||
|
#need llvm/cang-3.5+
|
||||||
|
#USELLVM := 1
|
||||||
# try to infer the correct GCCPREFX
|
# try to infer the correct GCCPREFX
|
||||||
ifndef GCCPREFIX
|
ifndef GCCPREFIX
|
||||||
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
||||||
@ -23,10 +24,12 @@ endif
|
|||||||
|
|
||||||
# try to infer the correct QEMU
|
# try to infer the correct QEMU
|
||||||
ifndef QEMU
|
ifndef QEMU
|
||||||
QEMU := $(shell if which qemu > /dev/null; \
|
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
|
||||||
|
then echo 'qemu-system-i386'; exit; \
|
||||||
|
elif which i386-elf-qemu > /dev/null; \
|
||||||
|
then echo 'i386-elf-qemu'; exit; \
|
||||||
|
elif which qemu > /dev/null; \
|
||||||
then echo 'qemu'; exit; \
|
then echo 'qemu'; exit; \
|
||||||
elif which i386-ucore-elf-qemu > /dev/null; \
|
|
||||||
then echo 'i386-ucore-elf-qemu'; exit; \
|
|
||||||
else \
|
else \
|
||||||
echo "***" 1>&2; \
|
echo "***" 1>&2; \
|
||||||
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
||||||
@ -41,15 +44,21 @@ endif
|
|||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# define compiler and flags
|
# define compiler and flags
|
||||||
|
ifndef USELLVM
|
||||||
HOSTCC := gcc
|
HOSTCC := gcc
|
||||||
HOSTCFLAGS := -g -Wall -O2
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
|
||||||
GDB := $(GCCPREFIX)gdb
|
|
||||||
|
|
||||||
CC := $(GCCPREFIX)gcc
|
CC := $(GCCPREFIX)gcc
|
||||||
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
||||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
else
|
||||||
|
HOSTCC := clang
|
||||||
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)clang
|
||||||
|
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
|
||||||
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
endif
|
||||||
|
|
||||||
|
GDB := $(GCCPREFIX)gdb
|
||||||
CTYPE := c S
|
CTYPE := c S
|
||||||
|
|
||||||
LD := $(GCCPREFIX)ld
|
LD := $(GCCPREFIX)ld
|
||||||
|
@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
|
|||||||
SLASH := /
|
SLASH := /
|
||||||
|
|
||||||
V := @
|
V := @
|
||||||
|
#need llvm/cang-3.5+
|
||||||
|
#USELLVM := 1
|
||||||
# try to infer the correct GCCPREFX
|
# try to infer the correct GCCPREFX
|
||||||
ifndef GCCPREFIX
|
ifndef GCCPREFIX
|
||||||
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
||||||
@ -23,10 +24,12 @@ endif
|
|||||||
|
|
||||||
# try to infer the correct QEMU
|
# try to infer the correct QEMU
|
||||||
ifndef QEMU
|
ifndef QEMU
|
||||||
QEMU := $(shell if which qemu > /dev/null; \
|
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
|
||||||
|
then echo 'qemu-system-i386'; exit; \
|
||||||
|
elif which i386-elf-qemu > /dev/null; \
|
||||||
|
then echo 'i386-elf-qemu'; exit; \
|
||||||
|
elif which qemu > /dev/null; \
|
||||||
then echo 'qemu'; exit; \
|
then echo 'qemu'; exit; \
|
||||||
elif which i386-ucore-elf-qemu > /dev/null; \
|
|
||||||
then echo 'i386-ucore-elf-qemu'; exit; \
|
|
||||||
else \
|
else \
|
||||||
echo "***" 1>&2; \
|
echo "***" 1>&2; \
|
||||||
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
||||||
@ -41,15 +44,21 @@ endif
|
|||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# define compiler and flags
|
# define compiler and flags
|
||||||
|
ifndef USELLVM
|
||||||
HOSTCC := gcc
|
HOSTCC := gcc
|
||||||
HOSTCFLAGS := -g -Wall -O2
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)gcc
|
||||||
GDB := $(GCCPREFIX)gdb
|
|
||||||
|
|
||||||
CC ?= $(GCCPREFIX)gcc
|
|
||||||
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
||||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
else
|
||||||
|
HOSTCC := clang
|
||||||
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)clang
|
||||||
|
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
|
||||||
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
endif
|
||||||
|
|
||||||
|
GDB := $(GCCPREFIX)gdb
|
||||||
CTYPE := c S
|
CTYPE := c S
|
||||||
|
|
||||||
LD := $(GCCPREFIX)ld
|
LD := $(GCCPREFIX)ld
|
||||||
|
@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
|
|||||||
SLASH := /
|
SLASH := /
|
||||||
|
|
||||||
V := @
|
V := @
|
||||||
|
#need llvm/cang-3.5+
|
||||||
|
#USELLVM := 1
|
||||||
# try to infer the correct GCCPREFX
|
# try to infer the correct GCCPREFX
|
||||||
ifndef GCCPREFIX
|
ifndef GCCPREFIX
|
||||||
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
||||||
@ -23,10 +24,12 @@ endif
|
|||||||
|
|
||||||
# try to infer the correct QEMU
|
# try to infer the correct QEMU
|
||||||
ifndef QEMU
|
ifndef QEMU
|
||||||
QEMU := $(shell if which qemu > /dev/null; \
|
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
|
||||||
|
then echo 'qemu-system-i386'; exit; \
|
||||||
|
elif which i386-elf-qemu > /dev/null; \
|
||||||
|
then echo 'i386-elf-qemu'; exit; \
|
||||||
|
elif which qemu > /dev/null; \
|
||||||
then echo 'qemu'; exit; \
|
then echo 'qemu'; exit; \
|
||||||
elif which i386-ucore-elf-qemu > /dev/null; \
|
|
||||||
then echo 'i386-ucore-elf-qemu'; exit; \
|
|
||||||
else \
|
else \
|
||||||
echo "***" 1>&2; \
|
echo "***" 1>&2; \
|
||||||
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
||||||
@ -41,15 +44,21 @@ endif
|
|||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# define compiler and flags
|
# define compiler and flags
|
||||||
|
ifndef USELLVM
|
||||||
HOSTCC := gcc
|
HOSTCC := gcc
|
||||||
HOSTCFLAGS := -g -Wall -O2
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)gcc
|
||||||
GDB := $(GCCPREFIX)gdb
|
|
||||||
|
|
||||||
CC ?= $(GCCPREFIX)gcc
|
|
||||||
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
||||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
else
|
||||||
|
HOSTCC := clang
|
||||||
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)clang
|
||||||
|
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
|
||||||
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
endif
|
||||||
|
|
||||||
|
GDB := $(GCCPREFIX)gdb
|
||||||
CTYPE := c S
|
CTYPE := c S
|
||||||
|
|
||||||
LD := $(GCCPREFIX)ld
|
LD := $(GCCPREFIX)ld
|
||||||
|
@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
|
|||||||
SLASH := /
|
SLASH := /
|
||||||
|
|
||||||
V := @
|
V := @
|
||||||
|
#need llvm/cang-3.5+
|
||||||
|
#USELLVM := 1
|
||||||
# try to infer the correct GCCPREFX
|
# try to infer the correct GCCPREFX
|
||||||
ifndef GCCPREFIX
|
ifndef GCCPREFIX
|
||||||
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
||||||
@ -23,10 +24,12 @@ endif
|
|||||||
|
|
||||||
# try to infer the correct QEMU
|
# try to infer the correct QEMU
|
||||||
ifndef QEMU
|
ifndef QEMU
|
||||||
QEMU := $(shell if which qemu > /dev/null; \
|
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
|
||||||
|
then echo 'qemu-system-i386'; exit; \
|
||||||
|
elif which i386-elf-qemu > /dev/null; \
|
||||||
|
then echo 'i386-elf-qemu'; exit; \
|
||||||
|
elif which qemu > /dev/null; \
|
||||||
then echo 'qemu'; exit; \
|
then echo 'qemu'; exit; \
|
||||||
elif which i386-ucore-elf-qemu > /dev/null; \
|
|
||||||
then echo 'i386-ucore-elf-qemu'; exit; \
|
|
||||||
else \
|
else \
|
||||||
echo "***" 1>&2; \
|
echo "***" 1>&2; \
|
||||||
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
||||||
@ -41,15 +44,21 @@ endif
|
|||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# define compiler and flags
|
# define compiler and flags
|
||||||
|
ifndef USELLVM
|
||||||
HOSTCC := gcc
|
HOSTCC := gcc
|
||||||
HOSTCFLAGS := -g -Wall -O2
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)gcc
|
||||||
GDB := $(GCCPREFIX)gdb
|
|
||||||
|
|
||||||
CC ?= $(GCCPREFIX)gcc
|
|
||||||
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
||||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
else
|
||||||
|
HOSTCC := clang
|
||||||
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)clang
|
||||||
|
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
|
||||||
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
endif
|
||||||
|
|
||||||
|
GDB := $(GCCPREFIX)gdb
|
||||||
CTYPE := c S
|
CTYPE := c S
|
||||||
|
|
||||||
LD := $(GCCPREFIX)ld
|
LD := $(GCCPREFIX)ld
|
||||||
|
@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
|
|||||||
SLASH := /
|
SLASH := /
|
||||||
|
|
||||||
V := @
|
V := @
|
||||||
|
#need llvm/cang-3.5+
|
||||||
|
#USELLVM := 1
|
||||||
# try to infer the correct GCCPREFX
|
# try to infer the correct GCCPREFX
|
||||||
ifndef GCCPREFIX
|
ifndef GCCPREFIX
|
||||||
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
||||||
@ -23,10 +24,12 @@ endif
|
|||||||
|
|
||||||
# try to infer the correct QEMU
|
# try to infer the correct QEMU
|
||||||
ifndef QEMU
|
ifndef QEMU
|
||||||
QEMU := $(shell if which qemu > /dev/null; \
|
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
|
||||||
|
then echo 'qemu-system-i386'; exit; \
|
||||||
|
elif which i386-elf-qemu > /dev/null; \
|
||||||
|
then echo 'i386-elf-qemu'; exit; \
|
||||||
|
elif which qemu > /dev/null; \
|
||||||
then echo 'qemu'; exit; \
|
then echo 'qemu'; exit; \
|
||||||
elif which i386-ucore-elf-qemu > /dev/null; \
|
|
||||||
then echo 'i386-ucore-elf-qemu'; exit; \
|
|
||||||
else \
|
else \
|
||||||
echo "***" 1>&2; \
|
echo "***" 1>&2; \
|
||||||
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
||||||
@ -41,15 +44,21 @@ endif
|
|||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# define compiler and flags
|
# define compiler and flags
|
||||||
|
ifndef USELLVM
|
||||||
HOSTCC := gcc
|
HOSTCC := gcc
|
||||||
HOSTCFLAGS := -g -Wall -O2
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)gcc
|
||||||
GDB := $(GCCPREFIX)gdb
|
|
||||||
|
|
||||||
CC ?= $(GCCPREFIX)gcc
|
|
||||||
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
||||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
else
|
||||||
|
HOSTCC := clang
|
||||||
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)clang
|
||||||
|
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
|
||||||
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
endif
|
||||||
|
|
||||||
|
GDB := $(GCCPREFIX)gdb
|
||||||
CTYPE := c S
|
CTYPE := c S
|
||||||
|
|
||||||
LD := $(GCCPREFIX)ld
|
LD := $(GCCPREFIX)ld
|
||||||
|
@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
|
|||||||
SLASH := /
|
SLASH := /
|
||||||
|
|
||||||
V := @
|
V := @
|
||||||
|
#need llvm/cang-3.5+
|
||||||
|
#USELLVM := 1
|
||||||
# try to infer the correct GCCPREFX
|
# try to infer the correct GCCPREFX
|
||||||
ifndef GCCPREFIX
|
ifndef GCCPREFIX
|
||||||
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
||||||
@ -23,10 +24,12 @@ endif
|
|||||||
|
|
||||||
# try to infer the correct QEMU
|
# try to infer the correct QEMU
|
||||||
ifndef QEMU
|
ifndef QEMU
|
||||||
QEMU := $(shell if which qemu > /dev/null; \
|
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
|
||||||
|
then echo 'qemu-system-i386'; exit; \
|
||||||
|
elif which i386-elf-qemu > /dev/null; \
|
||||||
|
then echo 'i386-elf-qemu'; exit; \
|
||||||
|
elif which qemu > /dev/null; \
|
||||||
then echo 'qemu'; exit; \
|
then echo 'qemu'; exit; \
|
||||||
elif which i386-ucore-elf-qemu > /dev/null; \
|
|
||||||
then echo 'i386-ucore-elf-qemu'; exit; \
|
|
||||||
else \
|
else \
|
||||||
echo "***" 1>&2; \
|
echo "***" 1>&2; \
|
||||||
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
||||||
@ -41,15 +44,21 @@ endif
|
|||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# define compiler and flags
|
# define compiler and flags
|
||||||
|
ifndef USELLVM
|
||||||
HOSTCC := gcc
|
HOSTCC := gcc
|
||||||
HOSTCFLAGS := -g -Wall -O2
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)gcc
|
||||||
GDB := $(GCCPREFIX)gdb
|
|
||||||
|
|
||||||
CC ?= $(GCCPREFIX)gcc
|
|
||||||
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
||||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
else
|
||||||
|
HOSTCC := clang
|
||||||
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)clang
|
||||||
|
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
|
||||||
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
endif
|
||||||
|
|
||||||
|
GDB := $(GCCPREFIX)gdb
|
||||||
CTYPE := c S
|
CTYPE := c S
|
||||||
|
|
||||||
LD := $(GCCPREFIX)ld
|
LD := $(GCCPREFIX)ld
|
||||||
|
@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
|
|||||||
SLASH := /
|
SLASH := /
|
||||||
|
|
||||||
V := @
|
V := @
|
||||||
|
#need llvm/cang-3.5+
|
||||||
|
#USELLVM := 1
|
||||||
# try to infer the correct GCCPREFX
|
# try to infer the correct GCCPREFX
|
||||||
ifndef GCCPREFIX
|
ifndef GCCPREFIX
|
||||||
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
|
||||||
@ -23,10 +24,12 @@ endif
|
|||||||
|
|
||||||
# try to infer the correct QEMU
|
# try to infer the correct QEMU
|
||||||
ifndef QEMU
|
ifndef QEMU
|
||||||
QEMU := $(shell if which qemu > /dev/null; \
|
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
|
||||||
|
then echo 'qemu-system-i386'; exit; \
|
||||||
|
elif which i386-elf-qemu > /dev/null; \
|
||||||
|
then echo 'i386-elf-qemu'; exit; \
|
||||||
|
elif which qemu > /dev/null; \
|
||||||
then echo 'qemu'; exit; \
|
then echo 'qemu'; exit; \
|
||||||
elif which i386-ucore-elf-qemu > /dev/null; \
|
|
||||||
then echo 'i386-ucore-elf-qemu'; exit; \
|
|
||||||
else \
|
else \
|
||||||
echo "***" 1>&2; \
|
echo "***" 1>&2; \
|
||||||
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
|
||||||
@ -41,15 +44,21 @@ endif
|
|||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# define compiler and flags
|
# define compiler and flags
|
||||||
|
ifndef USELLVM
|
||||||
HOSTCC := gcc
|
HOSTCC := gcc
|
||||||
HOSTCFLAGS := -g -Wall -O2 -D_FILE_OFFSET_BITS=64
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)gcc
|
||||||
GDB := $(GCCPREFIX)gdb
|
|
||||||
|
|
||||||
CC ?= $(GCCPREFIX)gcc
|
|
||||||
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
|
||||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
else
|
||||||
|
HOSTCC := clang
|
||||||
|
HOSTCFLAGS := -g -Wall -O2
|
||||||
|
CC := $(GCCPREFIX)clang
|
||||||
|
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
|
||||||
|
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||||
|
endif
|
||||||
|
|
||||||
|
GDB := $(GCCPREFIX)gdb
|
||||||
CTYPE := c S
|
CTYPE := c S
|
||||||
|
|
||||||
LD := $(GCCPREFIX)ld
|
LD := $(GCCPREFIX)ld
|
||||||
|
Loading…
Reference in New Issue
Block a user