• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#*******************************************************************************
2# $Id: Makerules.env,v 2.30.208.4 2009/01/27 01:22:16 Exp $
3# Top-level Makerules for defining environment variables
4# can be included by anyone doing software at Epigram
5#*******************************************************************************
6
7# HOSTOS is either unix or Windows_NT.
8# HOSTENV differentiates HOSTOS and is either freebsd, sun4, or Windows_NT.
9# This refers to the *BUILD* environment. All environments use "GNU C"
10# except Windows_NT which may use "GNU C" or "Microsoft C".
11
12ifndef	HOSTENV
13    # Figure what type of host we are in.
14    UNAME = $(shell uname)
15
16    ifneq ($(findstring "$(UNAME)", "FreeBSD" "NetBSD"), )
17	HOSTENV = freebsd
18	HOSTOS = unix
19    else
20	ifneq ($(findstring "$(UNAME)", "sun4" "SunOS"), )
21	    HOSTENV = sun4
22	    HOSTOS = unix
23	else
24	    ifeq ($(UNAME), Linux)
25		HOSTENV = linux
26		HOSTOS = unix
27	    else
28		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"), )
29		    HOSTENV = Windows_NT
30		    HOSTOS = Windows_NT
31		else
32		    ifeq ($(UNAME), Darwin)
33			HOSTENV = macos
34			HOSTOS = unix
35		    else
36		    	HOSTENV = unknown
37		    	HOSTOS = unknown
38		    endif
39		endif
40	    endif
41	endif
42    endif
43endif
44# In case we just defined them, make sure they are known
45export HOSTENV
46export HOSTOS
47
48# TARGETENV is one of freebsd, sun4, linux, linuxarm, linuxmips, android, cygwin32, win32, or macos
49# TARGETENV defaults to HOSTENV unless HOSTENV is Windows_NT, in
50# which case it defaults to win32.
51
52ifndef	TARGETENV
53    ifeq ($(HOSTENV), Windows_NT)
54	TARGETENV = win32
55    else
56        TARGETENV = $(HOSTENV)
57    endif
58endif
59export TARGETENV
60
61# TARGETOS defaults to HOSTOS in most cases
62ifneq ($(findstring "$(TARGETENV)", "freebsd" "linux" "linuxarm" "linuxarm_le" "android" "linuxmips" "sun4" "cygwin32" "win32" "macos"), )
63    TARGETOS = $(HOSTOS)
64endif
65ifeq	($(TARGETENV), bcmmips)
66    TARGETOS = bcmmips
67endif
68ifeq	($(TARGETENV), klsi)
69    TARGETOS = klsi
70endif
71ifeq	($(TARGETENV), nucleusarm)
72    TARGETOS = nucleus
73endif
74ifndef TARGETOS
75    TARGETOS = unknown
76endif
77export TARGETOS
78
79# TARGETARCH is the target processor architecture
80# Currently valid values are: x86, x86_mmx, sparc, unknown, or a list of any
81# of the valid values.
82# For the x86* family, a generic x86 is assuemd if not otherwise specified
83# Order is important since "linux" matches both linuxmips and linux.
84ifndef TARGETARCH
85    ifneq ($(findstring "$(TARGETENV)", "android"), )
86	TARGETARCH = arm_android
87    endif
88    ifneq ($(findstring "$(TARGETENV)", "linuxarm_le"), )
89	TARGETARCH = arm_le
90    endif
91    ifneq ($(findstring "$(TARGETENV)", "linuxarm" "nucleusarm"), )
92	TARGETARCH = arm
93    endif
94    ifneq ($(findstring "$(TARGETENV)", "bcmmips" "linuxmips"), )
95	TARGETARCH = mips
96    endif
97    ifneq ($(findstring "$(TARGETENV)", "sun4"), )
98	TARGETARCH = sparc
99    endif
100    ifneq ($(findstring "$(TARGETENV)", "freebsd" "linux" "cygwin32" "win32"), )
101	TARGETCPU = $(shell uname -m)
102	ifneq ($(findstring "$(TARGETCPU)", "sparc" "sparc64"), )
103		TARGETARCH = $(TARGETCPU)
104	else
105		TARGETARCH = x86_mmx
106	endif
107    endif
108    ifeq	($(TARGETENV), macos)
109	TARGETCPU = $(shell uname -p)
110	ifneq ($(findstring "$(TARGETCPU)", "powerpc"), )
111		TARGETARCH = PPC
112	else
113		TARGETARCH = x86
114	endif
115    endif
116    ifeq	($(TARGETENV), klsi)
117	TARGETARCH = klsi
118    endif
119    ifndef TARGETARCH
120	TARGETARCH = unknown
121    endif
122endif
123export TARGETARCH
124
125# TARGET_TYPE is either "all" or one or more of: float64, float32, int16
126# default is int16.  "all" will get expanded into a list of all possible types
127ifndef  TARGET_TYPE
128	TARGET_TYPE = int16
129endif
130
131ifeq ($(TARGET_TYPE), all)
132	TARGET_TYPE = int16 float32 float64
133endif
134export TARGET_TYPE
135