blob: 4d8a82ad61cf3596e27386927c3831406b9abade [file] [log] [blame]
#*******************************************************************************
# $Id: Makerules.env,v 2.34 2009-04-10 04:27:33 Exp $
# Top-level Makerules for defining environment variables
# can be included by anyone doing software at Epigram
#*******************************************************************************
# HOSTOS is either unix or Windows_NT.
# HOSTENV differentiates HOSTOS and is either freebsd, sun4, or Windows_NT.
# This refers to the *BUILD* environment. All environments use "GNU C"
# except Windows_NT which may use "GNU C" or "Microsoft C".
ifndef HOSTENV
# Figure what type of host we are in.
UNAME = $(shell uname)
ifneq ($(findstring "$(UNAME)", "FreeBSD" "NetBSD"), )
HOSTENV = freebsd
HOSTOS = unix
else
ifneq ($(findstring "$(UNAME)", "sun4" "SunOS"), )
HOSTENV = sun4
HOSTOS = unix
else
ifeq ($(UNAME), Linux)
HOSTENV = linux
HOSTOS = unix
else
ifneq ($(findstring "$(UNAME)", "CYGWIN32_NT" "CYGWIN32/NT" "i386" "CYGWIN_NT-4.0" "CYGWIN_NT-5.0" "CYGWIN_NT-5.1" "CYGWIN_NT-5.2" "i586" "i686"), )
HOSTENV = Windows_NT
HOSTOS = Windows_NT
else
ifeq ($(UNAME), Darwin)
HOSTENV = macos
HOSTOS = unix
else
HOSTENV = unknown
HOSTOS = unknown
endif
endif
endif
endif
endif
endif
# In case we just defined them, make sure they are known
export HOSTENV
export HOSTOS
# TARGETENV is one of freebsd, sun4, linux, linuxarm, android, linuxmips, linuxmips_be, cygwin32, win32, or macos
# TARGETENV defaults to HOSTENV unless HOSTENV is Windows_NT, in
# which case it defaults to win32.
ifndef TARGETENV
ifeq ($(HOSTENV), Windows_NT)
TARGETENV = win32
else
TARGETENV = $(HOSTENV)
endif
endif
export TARGETENV
# TARGETOS defaults to HOSTOS in most cases
ifneq ($(findstring "$(TARGETENV)", "freebsd" "linux" "linuxarm" "linuxarm_le" "android" "linuxmips" "linux26mips" "linuxmips_be" "sun4" "cygwin32" "win32" "macos"), )
TARGETOS = $(HOSTOS)
endif
ifeq ($(TARGETENV), bcmmips)
TARGETOS = bcmmips
endif
ifeq ($(TARGETENV), klsi)
TARGETOS = klsi
endif
ifeq ($(TARGETENV), nucleusarm)
TARGETOS = nucleus
endif
ifndef TARGETOS
TARGETOS = unknown
endif
export TARGETOS
# TARGETARCH is the target processor architecture
# Currently valid values are: x86, x86_mmx, sparc, unknown, or a list of any
# of the valid values.
# For the x86* family, a generic x86 is assuemd if not otherwise specified
# Order is important since "linux" matches both linuxmips and linux.
ifndef TARGETARCH
ifneq ($(findstring "$(TARGETENV)", "android"), )
TARGETARCH = arm_android
endif
ifneq ($(findstring "$(TARGETENV)", "linuxarm_le"), )
TARGETARCH = arm_le
endif
ifneq ($(findstring "$(TARGETENV)", "linuxarm nucleusarm"), )
TARGETARCH = arm
endif
ifneq ($(findstring "$(TARGETENV)", "bcmmips" "linuxmips" "linuxmips_be" "linux26mips"), )
TARGETARCH = mips
endif
ifneq ($(findstring "$(TARGETENV)", "sun4"), )
TARGETARCH = sparc
endif
ifneq ($(findstring "$(TARGETENV)", "freebsd" "linux" "cygwin32" "win32"), )
TARGETCPU = $(shell uname -m)
ifneq ($(findstring "$(TARGETCPU)", "sparc" "sparc64"), )
TARGETARCH = $(TARGETCPU)
else
TARGETARCH = x86_mmx
endif
endif
ifeq ($(TARGETENV), macos)
TARGETCPU = $(shell uname -p)
ifneq ($(findstring "$(TARGETCPU)", "powerpc"), )
TARGETARCH = PPC
else
TARGETARCH = x86
endif
endif
ifeq ($(TARGETENV), klsi)
TARGETARCH = klsi
endif
ifndef TARGETARCH
TARGETARCH = unknown
endif
endif
export TARGETARCH
# TARGET_TYPE is either "all" or one or more of: float64, float32, int16
# default is int16. "all" will get expanded into a list of all possible types
ifndef TARGET_TYPE
TARGET_TYPE = int16
endif
ifeq ($(TARGET_TYPE), all)
TARGET_TYPE = int16 float32 float64
endif
export TARGET_TYPE