Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / hypervisor / src / Makefile.master
CommitLineData
920dae64
AT
1# ========== Copyright Header Begin ==========================================
2#
3# Hypervisor Software File: Makefile.master
4#
5# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6#
7# - Do no alter or remove copyright notices
8#
9# - Redistribution and use of this software in source and binary forms, with
10# or without modification, are permitted provided that the following
11# conditions are met:
12#
13# - Redistribution of source code must retain the above copyright notice,
14# this list of conditions and the following disclaimer.
15#
16# - Redistribution in binary form must reproduce the above copyright notice,
17# this list of conditions and the following disclaimer in the
18# documentation and/or other materials provided with the distribution.
19#
20# Neither the name of Sun Microsystems, Inc. or the names of contributors
21# may be used to endorse or promote products derived from this software
22# without specific prior written permission.
23#
24# This software is provided "AS IS," without a warranty of any kind.
25# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
26# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
27# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
28# MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
29# ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30# DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
31# OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
32# FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
33# DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
34# ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
35# SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36#
37# You acknowledge that this software is not designed, licensed or
38# intended for use in the design, construction, operation or maintenance of
39# any nuclear facility.
40#
41# ========== Copyright Header End ============================================
42#
43# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
44# Use is subject to license terms.
45#
46# ident "@(#)Makefile.master 1.16 07/06/07 SMI"
47#
48
49#COMPMT :sh =case "`/usr/bin/domainname`" in \
50 *East*) echo /ws/onnv-tools-burpen;; *) echo /ws/onnv-tools;; esac
51#COMPDIR = $(COMPMT)/SUNWspro
52COMPDIR = ${SUN_STUDIO}
53SPRODIR = $(COMPDIR)
54QTOOLS = $(TOP)/hypervisor-tools
55QBINDIR = $(QTOOLS)/bin
56
57
58STABS = $(QBINDIR)/stabs
59ASCHK = $(QBINDIR)/aschk
60OBJCOPY = $(QBINDIR)/objcopy
61AS = $(QBINDIR)/qas
62SAS = $(QBINDIR)/sas
63CC = $(SPRODIR)/bin/cc
64LINT= $(SPRODIR)/bin/lint
65CPP = /usr/ccs/lib/cpp
66LD = /usr/ccs/bin/ld
67MDGEN = $(QBINDIR)/mdgen-v1
68INS = /usr/sbin/install
69RM = /usr/bin/rm -f
70
71BUILD_ISA :sh= uname -p
72
73PROTODIR = $(TOP)/../proto
74
75PROTO_INC = $(PROTODIR)/include
76PROTO_LIB = $(PROTODIR)/$(BUILD_ISA)/lib
77PROTO_BIN = $(PROTODIR)/$(BUILD_ISA)/bin
78PROTO_PLAT = $(PROTODIR)/$(PLATFORM)/$(VARIANT)
79PROTO_PLAT_INC = $(PROTODIR)/$(PLATFORM)/include
80PROTO_GUEST_BIN = $(PROTODIR)/sun4v/
81
82SUN_INC = $(TOP)/include
83COMMON_INC = $(TOP)/common/include
84FAMILY_INC = $(TOP)/$(FAMILY)/common/include
85PLATFORM_INC = $(TOP)/$(FAMILY)/$(PLATFORM)/include
86COMMON_SRC = $(TOP)/common/src
87FAMILY_SRC = $(TOP)/$(FAMILY)/common/src
88PLATFORM_SRC = $(TOP)/$(FAMILY)/$(PLATFORM)/src
89OBJ_DIR = $(TOP)/$(FAMILY)/$(PLATFORM)/$(VARIANT)
90
91INCFLAGS = -I$(PLATFORM_INC) -I$(FAMILY_INC) -I$(COMMON_INC) -I$(SUN_INC)
92CFLAGS += -v $(INCFLAGS)
93
94.KEEP_STATE:
95
96TARGET = all
97
98TARGETS = all install clean clobber lint
99
100all := TARGET = all
101clean := TARGET = clean
102clobber := TARGET = clobber
103install := TARGET = install
104lint := TARGET = lint
105
106
107$(TARGETS) :: $(SUBDIRS)
108
109install :: all
110
111.PARALLEL:
112.NO_PARALLEL: $(SUBDIRS) .PHONY
113
114$(SUBDIRS) ::
115 @cd $@ && pwd && $(MAKE) $(TARGET)
116
117INS.file = $(RM) $@; $(INS) -s -m 644 -f $(@D) $<
118INS.execfile = $(RM) $@; $(INS) -s -m 644 -f $(@D) $<
119INS.dir = $(INS) -s -d -m 755 $@
120
121$(PROTO_LIB) $(PROTO_INC) $(PROTO_BIN) $(PROTO_PLAT) $(PROTO_GUEST_BIN) $(PROTO_PLAT_INC):
122 $(INS.dir)
123
124$(PROTO_PLAT)/%: % $(PROTO_PLAT)
125 $(INS.file)
126
127$(PROTO_PLAT_INC)/%: % $(PROTO_PLAT_INC)
128 $(INS.file)
129
130$(PROTO_LIB)/%: % $(PROTO_LIB)
131 $(INS.file)
132
133$(PROTO_INC)/%: % $(PROTO_INC)
134 $(INS.file)
135
136$(PROTO_BIN)/%: % $(PROTO_BIN)
137 $(INS.file)
138
139$(PROTO_GUEST_BIN)/%: % $(PROTO_GUEST_BIN)
140 $(INS.file)
141
142# Source browsing
143CSDIR = $(TOP)
144CSDIRS = $(TOP)/
145CSPATHS = $(CSDIRS:%=$(CSDIR)/%)
146CSINCS = -I$(TOP)
147CSCOPE = cscope
148CTAGS = ctags
149CSFLAGS = -b
150CTFLAGS = -wt
151
152.PRECIOUS: cscope.out
153
154cscope.out: cscope.files FRC
155 ${CSCOPE} ${CSFLAGS}
156
157cscope.files: FRC
158 @-$(RM) cscope.files cscope.files.raw
159 echo "$(CSINCS)" > cscope.files
160 -find $(CSDIRS) -name SCCS -prune -o \
161 -type d -name '.del-*' -prune -o -type f \
162 \( -name '*.[csh]' -o -name 'Makefile*' -o -name '*.il*' \) \
163 -print > cscope.files.raw
164 -grep -v Makefile cscope.files.raw >> cscope.files
165 -grep Makefile cscope.files.raw >> cscope.files
166 -$(RM) cscope.files.raw
167 @wc -l cscope.files
168
169tags: tags.list FRC
170 ${CTAGS} ${CTFLAGS} `cat tags.list`
171
172tags.list: cscope.files
173 @$(RM) tags.list
174 grep '\.[chs]$$' cscope.files > tags.list
175
176clean ::
177 $(RM) *.o *.ln offsets.h offsets.chk files.s
178
179clobber :: clean
180 $(RM) q q.bin q0 reset reset.bin
181 $(RM) cscope.* tags tags.list
182
183.PHONY : lintplus lintall
184
185# set the errors to report when running 'make lint'
186# all code should be clean with respect to this set
187LERRS0 = -erroff=%all
188LERRS1 = ,no%E_FUNC_VAR_UNUSED,no%E_FUNC_NO_RET_VAL
189LERRS2 = ,no%E_LABEL_NOT_USED,no%E_FUNC_SET_NOT_USED,no%E_NOP_IF_STMT
190LERRS3 = ,no%E_NO_IMPLICIT_DECL_ALLOWED,no%E_EXPR_NULL_EFFECT
191LERRS4 = ,no%E_CASE_FALLTHRU,no%E_USE_BEFORE_SET,no%E_EQUALITY_NOT_ASSIGNMENT
192LERRS5 = ,no%E_VAR_USED_BEFORE_SET,no%E_LOOP_EMPTY
193
194# add some extra potentially interesting errors to report when running
195# 'make lintplus'
196# code is not required to be clean with respect to these errors
197LPLUS1 = ,no%E_USE_BEFORE_SET_PSB,no%E_ASGN_RESET,no%E_ASGN_NEVER_USED
198LPLUS2 = ,no%E_P_REF_NULL_PSBL,no%E_P_REF_UNINI_PSBL,no%E_P_USE_UNINI_PSBL
199LPLUS3 = ,no%E_P_WRT_NULL_PSBL,no%E_BAD_FORMAT_ARG_TYPE,no%E_STATIC_UNUSED
200
201lintplus := LERRSPLUS = $(LPLUS1)$(LPLUS2)$(LPLUS3)
202
203#
204# Future: For now we only enable a small subset of the error checking.
205# We need to scrub the code and allow more checks for
206# lint checking to be really useful.
207#
208LINTERRS = $(LERRS0)$(LERRS1)$(LERRS2)$(LERRS3)$(LERRS4)$(LERRS5)$(LERRSPLUS)
209
210# report all errors plus security related ones when running 'make lintall'
211lintall := LINTERRS = -errsecurity=extended
212
213lintplus : lint
214
215lintall : lint
216
217
218LINT_SRCS = $(COMMON_SRC)/hvcontrol.c \
219 $(COMMON_SRC)/init.c \
220 $(COMMON_SRC)/mdsup.c \
221 $(COMMON_SRC)/reconf.c \
222 $(COMMON_SRC)/res_console.c \
223 $(COMMON_SRC)/res_guest.c \
224 $(COMMON_SRC)/res_ldc.c \
225 $(COMMON_SRC)/res_mau.c \
226 $(COMMON_SRC)/res_memory.c \
227 $(COMMON_SRC)/res_pcie.c \
228 $(COMMON_SRC)/res_vcpu.c \
229 $(COMMON_SRC)/support.c
230
231LINT_FLAGS =-D__sparcv9 -Xarch=v9 -Nlevel=4 -errtags -errchk=%all -h
232LINT_FLAGS += -Xc99
233LINT_FLAGS += -c
234LINT_FLAGS += $(CPPFLAGS)
235LINT_FLAGS += $(LINTERRS)
236
237.KEEP_STATE:
238
239FRC: