Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / Makefile.defines
CommitLineData
920dae64
AT
1# ========== Copyright Header Begin ==========================================
2#
3# OpenSPARC T2 Processor File: Makefile.defines
4# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
5# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6#
7# The above named program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public
9# License version 2 as published by the Free Software Foundation.
10#
11# The above named program is distributed in the hope that it will be
12# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# General Public License for more details.
15#
16# You should have received a copy of the GNU General Public
17# License along with this work; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19#
20# ========== Copyright Header End ============================================
21#
22# "@(#)1.2 05/12/15 Makefile.defines"
23#
24
25include $(SIM_ROOT)/sam-t2/sam/Makefile.sitedefs
26
27# ---------------------------- mode flags -----------------------------
28# MODE=g compile for debug
29# MODE=opt compile for optimisation
30#
31# CHECK_MODE is non empty string when MODE is correctly specified
32
33MODE = opt
34
35CHECK_MODE.g = g
36CHECK_MODE.opt = opt
37CHECK_MODE = $(CHECK_MODE.$(MODE))
38
39# ---------------------------- arch flags -----------------------------
40#
41# The ARCH variable specifies which -xarch based flag for example is used
42# on the build tools. Currently v9, v8plus, and amd64 are supported. The default is
43# v9. The v8plus target is only used for the cosim targets. Some people
44# refer to this flag as the platform you are compiling for. When you change
45# this, look at the BITS, CFLAGS, and ASFLAGS below to see if change is
46# needed there too.# Note for the sparc v8 and v8plus we leave out the last
47# letter a b or c which tells which subset of the instructiuon set is
48# available (vis 1, vis2, ...). That part we assume to be fixed.
49#
50# CHECK_ARCH is non empty string when ARCH is correctly specified
51
52ARCH = v9
53
54CHECK_ARCH.v9 = v9
55CHECK_ARCH.v8plus = v8plus
56CHECK_ARCH.amd64 = amd64
57CHECK_ARCH = $(CHECK_ARCH.$(ARCH))
58
59# Old blaze used bits to specify v8plus or v9 ... we should change this.
60# as for amd64 this should say ... 64
61
62BITS.v8plus = 32
63BITS.v9 = 64
64BITS.amd64 = 64
65BITS = $(BITS.$(ARCH))
66
67# ---------------------------- passdown -----------------------------
68
69PWD:sh=/bin/pwd
70
71PASSDOWN = BITS=$(BITS) \
72 DEFINES="$(DEFINES)" \
73 TARG="$(TARG)" \
74 INSTALL_DIR=$(INSTALL_DIR) \
75 TOP_DIR=$(PWD) \
76 BUILD_ROOT=$(BUILD_ROOT) \
77 BUILD_DIR=$(BUILD_DIR) \
78 MODE=$(MODE) \
79 ARCH=$(ARCH) \
80 EXPORT_OK=$(EXPORT_OK)
81
82SOL10 = OK
83EXPORT_OK =
84
85#----------------- external references -----------------
86#
87# not for every compile, to be -I'ed on an as needed basis only.
88
89DEVTOOLS_HOME = $(SIM_ROOT)/sam-t2/devtools/$(ARCH)
90
91SPIX_HOME = $(DEVTOOLS_HOME)
92SPIX_LIB = $(SPIX_HOME)/lib
93SPIX_INC = $(SPIX_HOME)/include
94
95RST_HOME = $(SIM_ROOT)/sam-t2/devtools/rst
96
97# ----------------------- tools -------------------------
98
99COMPILER_PATH.v8plus = $(SUNSTUDIO)/bin
100COMPILER_PATH.v9 = $(SUNSTUDIO)/bin
101COMPILER_PATH.amd64 = $(SUNSTUDIO)/bin
102COMPILER_PATH = $(COMPILER_PATH.$(ARCH))
103
104# Note that we use prefer to use the Sun Make predefined macros:
105# COMPILE.cc, COMPILE.s
106# LINK.cc
107
108CC = $(COMPILER_PATH)/CC
109CCC = $(COMPILER_PATH)/CC
110AS = /usr/ccs/bin/as
111LD = /usr/ccs/bin/ld
112MCS = /usr/ccs/bin/mcs
113
114MKDIR = /usr/bin/mkdir -p
115RM = /usr/bin/rm -rf
116TEST = /usr/bin/test
117TESTDIR = $(TEST) -d $(@D) || $(MKDIR) $(@D)
118ECHO = /bin/echo
119CP = /usr/bin/cp -p
120LN = /usr/bin/ln -s
121XARGS = /bin/xargs
122
123
124# ---------------------------- tool flags -----------------------------
125# v9b - vonk required the b extension to use native assembler
126# for the Vis 2 instructions
127
128
129CFLAGS = -w -mt
130
131CFLAGS_opt = -xO3 # for release
132CFLAGS_g = -g # for developement
133CFLAGS += $(CFLAGS_$(MODE))
134
135CFLAGS.v8plus = -xarch=v8plusa
136CFLAGS.v9 = -xarch=v9b
137CFLAGS.amd64 = -xarch=amd64 -DARCH_X64
138CFLAGS += $(CFLAGS.$(ARCH))
139
140CCFLAGS = $(CFLAGS)
141CCFLAGS += -DIO_THREAD=1 -DV4_NUM_DEVICE_COMPAT
142CCCFLAGS = $(CCFLAGS)
143
144
145ASFLAGS.v8plus = -xarch=v8plusa
146ASFLAGS.v9 = -xarch=v9b
147ASFLAGS.amd64 = -xarch=amd64
148ASFLAGS = $(ASFLAGS.$(ARCH))
149
150
151POUND_SIGN:sh=echo \\043
152
153
154#------------------------build and install ----------------------
155
156# To build repeatedly for g and for opt in the same child workspace do
157#
158# make MODE=g BUILD_ROOT=`pwd`/build_g INSTALL_DIR=`pwd`/install_g <target>
159# make MODE=opt BUILD_ROOT=`pwd`/build_opt INSTALL_DIR=`pwd`/install_opt <target>
160
161# BUILD_DIR uses BUILD_TARGET and therefore causes these ""mksh: Warning:
162# Conditional macro `BUILD_TARGET' referenced in file `Makefile.rules', line 14
163
164BUILD_ROOT = $(PWD)/build
165BUILD_DIR = $(BUILD_ROOT)/$(BUILD_TARGET)
166INSTALL_DIR = $(PWD)/$(DEFAULT_INSTALL_DIR)
167
168OBJ_DIR = $(BUILD_DIR)/$(TREEPATH)
169
170# These are the top level directories in an install
171#
172# bin - executables like sam, sam-n2, ...
173# lib - libraries of cpu, devices, ...
174# etc - configuration files ...
175# pfe - all the python front end files and samfe
176# inc - exported api definitions like mmi etc
177# rtl - rtl support files
178# doc - support documents
179# man - man pages
180
181BIN_DIR = $(INSTALL_DIR)/bin
182LIB_DIR = $(INSTALL_DIR)/lib
183ETC_DIR = $(INSTALL_DIR)/etc
184PFE_DIR = $(INSTALL_DIR)/pfe
185MAN_DIR = $(INSTALL_DIR)/man
186DOC_DIR = $(INSTALL_DIR)/doc
187RTL_DIR = $(INSTALL_DIR)/rtl
188
189MAN1_DIR = $(MAN_DIR)/man1
190SAMFE_DIR = $(PFE_DIR)/samfe
191
192# All directories in a release
193INSTALL_DIRS = $(BIN_DIR)\
194 $(LIB_DIR)\
195 $(ETC_DIR)\
196 $(PFE_DIR)\
197 $(MAN_DIR)\
198 $(DOC_DIR)\
199 $(RTL_DIR)\
200 $(MAN1_DIR)\
201 $(SAMFE_DIR)
202
203# Build the directory path of the make target. We @ prefix the
204# rules as it is used for every build target in cpus/vonk
205
206TARGET_MKDIR = @if [ ! -d $(@D) ] ; then $(MKDIR) -p $(@D) ; fi
207
208
209COM_DIR = ../common
210
211
212# ----------------------- recursive make ------------------------
213
214MAKE_ENV = $(MAKEFLAGS) # <--- this really seems dubious...
215MAKE_ENV += "MAKE=$(MAKE)"
216
217
218# ------------------------- -=oOo=- ------------------------