2013-03-19 18:28:32 -04:00
|
|
|
COMPILER_MAK_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
|
|
|
include $(COMPILER_MAK_DIR)/platform.mak
|
|
|
|
|
|
|
|
# Warn if default target is used and the software shouldn't be built under Sortix.
|
|
|
|
ifeq ($(BUILD_IS_SORTIX),1)
|
|
|
|
ifeq ($(MAKEFILE_NOT_MEANT_FOR_SORTIX), 1)
|
|
|
|
makefile_not_meant_for_sortix:
|
|
|
|
@echo This makefile isn\'t meant to work under Sortix
|
|
|
|
@exit 1
|
|
|
|
endif
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
|
2013-03-19 18:28:32 -04:00
|
|
|
# Warn if default target is used and the software should be built under Sortix.
|
|
|
|
ifeq ($(BUILD_IS_SORTIX),0)
|
|
|
|
ifeq ($(MAKEFILE_MEANT_FOR_SORTIX), 1)
|
|
|
|
makefile_meant_for_sortix:
|
|
|
|
@echo This makefile is meant to work under Sortix, not $(BUILD)
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Warn if default target is used and the software shouldn't be built for Sortix.
|
|
|
|
ifeq ($(HOST_IS_SORTIX),1)
|
|
|
|
ifeq ($(SOFTWARE_NOT_MEANT_FOR_SORTIX), 1)
|
|
|
|
software_not_meant_for_sortix:
|
|
|
|
@echo This software isn\'t meant to work under Sortix
|
|
|
|
@exit 1
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2013-03-19 18:28:32 -04:00
|
|
|
# Warn if default target is used and the software should be built for Sortix.
|
|
|
|
ifeq ($(HOST_IS_SORTIX),0)
|
|
|
|
ifeq ($(SOFTWARE_MEANT_FOR_SORTIX), 1)
|
|
|
|
software_meant_for_sortix:
|
|
|
|
@echo This software is meant to work under Sortix, not $(HOST)
|
|
|
|
@echo Attempt was $(MAKE) $(MAKEFLAGS)
|
|
|
|
@echo Try: $(MAKE) $(MAKEFLAGS) HOST=$(UNAME_PLATFORM)-sortix
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Provide deprecated CPU variable so makefiles can select CPU-specific dirs.
|
2012-09-10 17:36:15 -04:00
|
|
|
ifeq ($(HOST),i486-sortix)
|
2013-03-19 18:28:32 -04:00
|
|
|
MACHINE:=i486
|
2012-09-10 17:36:15 -04:00
|
|
|
CPU:=x86
|
2013-01-29 14:01:46 -05:00
|
|
|
OTHER_PLATFORMS=x86-64-sortix
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifeq ($(HOST),x86_64-sortix)
|
2013-03-19 18:28:32 -04:00
|
|
|
MACHINE:=x86_64
|
2012-09-10 17:36:15 -04:00
|
|
|
CPU:=x64
|
2013-01-29 14:01:46 -05:00
|
|
|
OTHER_PLATFORMS=i486-sortix
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
|
2013-03-19 18:28:32 -04:00
|
|
|
# Determine the prefix for build tools.
|
|
|
|
ifndef BUILD_TOOL_PREFIX
|
|
|
|
BUILD_TOOL_PREFIX:=
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Determine the prefix for host tools.
|
|
|
|
ifndef HOST_TOOL_PREFIX
|
|
|
|
ifeq ($(BUILD),$(HOST))
|
|
|
|
HOST_TOOL_PREFIX:=$(BUILD_TOOL_PREFIX)
|
|
|
|
else
|
|
|
|
HOST_TOOL_PREFIX:=$(HOST)-
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Determine the names of the tools that target the build platform.
|
2012-09-10 17:36:15 -04:00
|
|
|
ifndef BUILDCC
|
2013-03-19 18:28:32 -04:00
|
|
|
BUILDCC:=$(BUILD_TOOL_PREFIX)gcc
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef BUILDCXX
|
2013-03-19 18:28:32 -04:00
|
|
|
BUILDCXX:=$(BUILD_TOOL_PREFIX)g++
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef BUILDAR
|
2013-03-19 18:28:32 -04:00
|
|
|
BUILDAR:=$(BUILD_TOOL_PREFIX)ar
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef BUILDAS
|
2013-03-19 18:28:32 -04:00
|
|
|
BUILDAS:=$(BUILD_TOOL_PREFIX)as
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef BUILDLD
|
2013-03-19 18:28:32 -04:00
|
|
|
BUILDAS:=$(BUILD_TOOL_PREFIX)ld
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef BUILDOBJCOPY
|
2013-03-19 18:28:32 -04:00
|
|
|
BUILDOBJCOPY:=$(BUILD_TOOL_PREFIX)objcopy
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
|
2013-03-19 18:28:32 -04:00
|
|
|
# Determine the names of the tools that target the host platform.
|
2012-09-10 17:36:15 -04:00
|
|
|
ifndef HOSTCC
|
2013-03-19 18:28:32 -04:00
|
|
|
HOSTCC:=$(HOST_TOOL_PREFIX)gcc
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef HOSTCXX
|
2013-03-19 18:28:32 -04:00
|
|
|
HOSTCXX:=$(HOST_TOOL_PREFIX)g++
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef HOSTAR
|
2013-03-19 18:28:32 -04:00
|
|
|
HOSTAR:=$(HOST_TOOL_PREFIX)ar
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef HOSTAS
|
2013-03-19 18:28:32 -04:00
|
|
|
HOSTAS:=$(HOST_TOOL_PREFIX)as
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef HOSTLD
|
2013-03-19 18:28:32 -04:00
|
|
|
HOSTLD:=$(HOST_TOOL_PREFIX)ld
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
ifndef HOSTOBJCOPY
|
2013-03-19 18:28:32 -04:00
|
|
|
HOSTOBJCOPY:=$(HOST_TOOL_PREFIX)objcopy
|
2012-09-10 17:36:15 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
CC:=$(HOSTCC)
|
|
|
|
CXX:=$(HOSTCXX)
|
2013-03-19 18:28:32 -04:00
|
|
|
AR:=$(HOSTAR)
|
2012-09-10 17:36:15 -04:00
|
|
|
AS:=$(HOSTAS)
|
|
|
|
LD:=$(HOSTLD)
|
|
|
|
OBJCOPY:=$(HOSTOBJCOPY)
|
|
|
|
|
2014-04-13 16:34:36 -04:00
|
|
|
# Determine default optimization level.
|
|
|
|
DEFAULT_GENERIC_OPTLEVEL_BASE:=-O2 -g
|
|
|
|
DEFAULT_BUILD_OPTLEVEL:=$(DEFAULT_GENERIC_OPTLEVEL_BASE)
|
|
|
|
ifeq ($(BUILD_IS_SORTIX),1)
|
|
|
|
DEFAULT_BUILD_OPTLEVEL+=
|
|
|
|
endif
|
|
|
|
DEFAULT_HOST_OPTLEVEL:=$(DEFAULT_GENERIC_OPTLEVEL_BASE)
|
|
|
|
DEFAULT_OPTLEVEL:=$(DEFAULT_GENERIC_OPTLEVEL_BASE)
|
|
|
|
ifeq ($(HOST_IS_SORTIX),1)
|
|
|
|
DEFAULT_HOST_OPTLEVEL+=
|
|
|
|
DEFAULT_OPTLEVEL+=
|
|
|
|
endif
|