24 Star 27 Fork 0

wujingke / xinos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
make.syscfg 5.39 KB
一键复制 编辑 原始数据 按行查看 历史
Travis Geiselbrecht 提交于 2008-05-26 08:35 . welcome to memory model land.
# figure out a few things about the host build system
ifeq ($(HOSTTYPE),)
HOSTTYPE := $(shell uname -m)
endif
ifeq ($(OSTYPE),)
OSTYPE := $(shell uname -s | awk -F_ '{print $$1}' | tr A-Z a-z)
endif
ifeq ($(HOSTTYPE),i586)
HOSTTYPE := i386
endif
ifeq ($(HOSTTYPE),i686)
HOSTTYPE := i386
endif
ifeq ($(HOSTTYPE), )
HOSTTYPE := i386
endif
ifeq ($(findstring Macintosh,$(HOSTTYPE)),Macintosh)
HOSTTYPE := ppc
endif
ifeq ($(HOSTTYPE),macintosh)
ifeq ($(MACHTYPE),powerpc)
HOSTTYPE := ppc
endif
endif
# default platform and arch
ifeq ($(PLATFORM),)
ifeq ($(ARCH),)
# by default, build for a i386-pc
ARCH := i386
PLATFORM := pc
endif
endif
# some platforms only support one arch
ifeq ($(PLATFORM),pegasos)
ARCH := ppc
endif
ifeq ($(PLATFORM),mac)
ARCH := ppc
endif
ifeq ($(PLATFORM),xbox)
ARCH := i386
endif
ifeq ($(PLATFORM),dreamcast)
ARCH := sh4
endif
# some arches only support one platform
ifeq ($(ARCH),x86_64)
PLATFORM := pc
endif
ifeq ($(ARCH),sh4)
PLATFORM := dreamcast
endif
# build the TARGET variable
TARGET := $(ARCH)-$(PLATFORM)
# HOST_* is for local targets (tools)
HOST_CC := gcc
HOST_LD := $(LD)
HOST_AS := $(AS)
HOST_AR := $(AR)
HOST_OBJCOPY := objcopy
HOST_OBJDUMP := objdump
HOST_STRIP := strip
HOST_SIZE := size
# setup some local commands
ECHO := echo
AWK := awk
ifeq ($(OSTYPE),SunOS)
ECHO := /usr/ucb/echo
AWK := gawk
endif
ifeq ($(findstring solaris,$(OSTYPE)),solaris)
ECHO := /usr/ucb/echo
AWK := gawk
endif
# TOOLCHAIN_ARCH is usually ARCH, except in a few cases
TOOLCHAIN_ARCH := $(ARCH)
ifeq ($(ARCH),sh4)
TOOLCHAIN_ARCH := sh
endif
# try to detect if the user has ARCH-newos-gcc installed
#
# NOTE:
# the "| cat" below looks unnecesary, this is
# to avoid a bug in liberty in certain versions
# of gmake for BeOS
CC :=
FOO := $(shell $(TOOLCHAIN_ARCH)-newos-gcc --version | cat)
ifneq ($(FOO),)
$(warning found newos toolchain!)
CC = $(TOOLCHAIN_ARCH)-newos-gcc
LD = $(TOOLCHAIN_ARCH)-newos-ld
AS = $(TOOLCHAIN_ARCH)-newos-as
AR = $(TOOLCHAIN_ARCH)-newos-ar
OBJCOPY = $(TOOLCHAIN_ARCH)-newos-objcopy
OBJDUMP = $(TOOLCHAIN_ARCH)-newos-objdump
STRIP = $(TOOLCHAIN_ARCH)-newos-strip
SIZE = $(TOOLCHAIN_ARCH)-newos-size
endif
FOO := $(shell $(TOOLCHAIN_ARCH)-elf-gcc --version | cat)
ifneq ($(FOO),)
$(warning WARNING: custom newos toolchain not found!)
$(warning falling back to elf toolchain)
CC = $(TOOLCHAIN_ARCH)-elf-gcc
LD = $(TOOLCHAIN_ARCH)-elf-ld
AS = $(TOOLCHAIN_ARCH)-elf-as
AR = $(TOOLCHAIN_ARCH)-elf-ar
OBJCOPY = $(TOOLCHAIN_ARCH)-elf-objcopy
OBJDUMP = $(TOOLCHAIN_ARCH)-elf-objdump
STRIP = $(TOOLCHAIN_ARCH)-elf-strip
SIZE = $(TOOLCHAIN_ARCH)-elf-size
endif
ifeq ($(CC),)
$(warning WARNING: custom newos toolchain not found!)
$(warning This build will probably fail miserably)
$(warning Download the appropriate toolchain for your build environment)
$(warning at http://newos.sourceforge.net/download.php)
CC = $(HOST_CC)
LD = $(HOST_LD)
AS = $(HOST_AS)
AR = $(HOST_AR)
OBJCOPY = $(HOST_OBJCOPY)
OBJDUMP = $(HOST_OBJDUMP)
STRIP = $(HOST_STRIP)
SIZE = $(HOST_SIZE)
endif
# set up some particular options for various architectures
ifeq ($(ARCH),i386)
GLOBAL_CFLAGS = -O2 -g
KERNEL_CFLAGS = -fno-pic
USER_CFLAGS = -fpic
GLOBAL_LDFLAGS = -g
endif
ifeq ($(ARCH),x86_64)
GLOBAL_CFLAGS = -O2 -g
KERNEL_CFLAGS = -fno-pic -mcmodel=kernel
USER_CFLAGS = -fpic
GLOBAL_LDFLAGS = -g -m elf_x86_64
endif
ifeq ($(ARCH),ppc)
GLOBAL_CFLAGS = -fno-pic -O -D__PPC__ -mregnames
GLOBAL_LDFLAGS =
endif
ifeq ($(ARCH),ppc64)
GLOBAL_CFLAGS =
GLOBAL_LDFLAGS =
endif
ifeq ($(ARCH),arm)
GLOBAL_CFLAGS = -O2 -g
KERNEL_CFLAGS = -fno-pic
USER_CFLAGS = -fpic
GLOBAL_LDFLAGS =
endif
ifeq ($(ARCH),sh4)
GLOBAL_CFLAGS = -ml -m4-single-only -mhitachi -O2 -g -D__SH4__
KERNEL_CFLAGS = -fno-pic
USER_CFLAGS = -fpic
GLOBAL_LDFLAGS = -EL
endif
ifeq ($(ARCH),sparc64)
GLOBAL_CFLAGS =
GLOBAL_LDFLAGS =
endif
ifeq ($(ARCH),sparc)
GLOBAL_CFLAGS =
GLOBAL_LDFLAGS =
endif
ifeq ($(ARCH),m68k)
GLOBAL_CFLAGS = -O0 -g -m68040
KERNEL_CFLAGS = -fno-pic
USER_CFLAGS = -fpic
GLOBAL_LDFLAGS = -g
endif
ifeq ($(ARCH),alpha)
GLOBAL_CFLAGS =
GLOBAL_LDFLAGS =
endif
ifeq ($(ARCH),mips)
GLOBAL_CFLAGS = -fno-pic -mips4 -meb -G 0
GLOBAL_LDFLAGS =
endif
# check to see if we should use distcc and/or ccache
ifneq ($(USE_DISTCC),)
$(warning using distcc)
CC := distcc $(CC)
endif
ifneq ($(USE_CCACHE),)
$(warning using ccache)
CC := ccache $(CC)
endif
# these options are on for all architectures
GLOBAL_CFLAGS += -finline -fno-builtin
GLOBAL_CFLAGS += -Wall -W -Wno-multichar -Wno-unused-parameter -Wmissing-prototypes
GLOBAL_CFLAGS += -DNEWOS=1
GLOBAL_CFLAGS += -DARCH_$(ARCH)=1 -D__ARCH__=$(ARCH) -U$(ARCH)
GLOBAL_CFLAGS += -DPLATFORM_$(PLATFORM)=1
GLOBAL_CPPFLAGS = $(GLOBAL_CFLAGS)
GLOBAL_ASFLAGS += -D__ASSEMBLY__
# find libgcc
LIBGCC := -lgcc
LIBGCC_PATH := $(dir $(shell $(CC) $(GLOBAL_CFLAGS) -print-libgcc-file-name))
ifeq ($(ARCH),arm)
LIBGCC_PATH := /usr/local/arm-newos/lib/gcc-lib/arm-newos/3.3.3
endif
$(warning LIBGCC_PATH = $(LIBGCC_PATH))
ifneq ($(ARCH),sh4)
LIBGCC_INCLUDE += -I$(LIBGCC_PATH)/include
endif
ifeq ($(ARCH),x86_64)
LIBGCC32_PATH := $(dir $(shell $(CC) $(GLOBAL_CFLAGS) -m32 -print-libgcc-file-name))
$(warning LIBGCC32_PATH = $(LIBGCC32_PATH))
endif
# print some info
$(warning ARCH = $(ARCH))
$(warning PLATFORM = $(PLATFORM))
$(warning TARGET = $(TARGET))
# figure out where the build dir will be
BUILD_DIR = build/$(TARGET)
$(warning build dir will be $(BUILD_DIR))
$(shell mkdir -p $(BUILD_DIR))
C
1
https://gitee.com/wujingke/xinos.git
git@gitee.com:wujingke/xinos.git
wujingke
xinos
xinos
master

搜索帮助