Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / legion / src / Makefile.top
CommitLineData
920dae64
AT
1# ========== Copyright Header Begin ==========================================
2#
3# OpenSPARC T2 Processor File: Makefile.top
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# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23# Use is subject to license terms.
24#
25# ident "@(#)Makefile.top 1.64 07/10/12 SMI"
26#
27# Top level Makefile for simulator
28#
29
30#
31# Use the RELEASE variable to determine which DIRS to build
32#
33COMMON_DIRS=\
34 simcore \
35 generic \
36 parser \
37 host \
38 support \
39 support/netcons \
40 devices/mmi \
41 devices/mem_bus/libgeneric \
42 devices/mem_bus/libio \
43 devices/mem_bus/libdumbserial \
44 devices/mem_bus/libdumbtod \
45 devices/mem_bus/libmemory \
46 devices/mem_bus/libmemsparse \
47 procs/sparcv9 \
48 procs/sunsparc/debug
49
50INTERNAL_DIRS=\
51 support/save_restore \
52 devices/mem_bus/libmbox \
53 devices/mem_bus/libosp_fpga \
54 devices/mem_bus/libfalls_fpga \
55 devices/mem_bus/libvfpga \
56 devices/mem_bus/libhole \
57 devices/mem_bus/libtomatillo \
58 devices/mem_bus/libxdcbridge \
59 devices/mem_bus/libpiu/vf \
60 devices/mem_bus/libsndebugchan \
61 devices/service_processor/libgeneric_sp \
62 devices/pcie/libbobo \
63 devices/hub/libzambezi \
64 procs/sunsparc/debug/tools \
65 procs/sunsparc/liblegion_crypto \
66 devices/mem_bus/libpiu \
67 procs/sunsparc/libniagara \
68 procs/sunsparc/libniagara2 \
69 procs/sunsparc/libvfalls \
70 procs/sunsparc/librock
71
72EXTERNAL_DIRS=\
73 devices/mem_bus/libpiu \
74 procs/sunsparc/libniagara \
75 procs/sunsparc/libniagara2
76
77DIRS= $(COMMON_DIRS) $($(RELEASE)_DIRS)
78
79
80ifdef BUILDFIRE
81 DIRS+= \
82 devices/mem_bus/libfire \
83 devices/pci/libbcm
84
85 FIRE_PATH=$(SRCDIR)/devices/mem_bus/libfire
86 FIRE_MODEL_PATH=$(FIRE_PATH)/libfiremodel
87 FIRE_INCLUDES=-I $(FIRE_MODEL_PATH)/Fire/src -I $(FIRE_PATH)
88
89 FIRE_MODEL_CLEAN=libfire_model_clean
90endif
91
92VPATH=$(OBJDIR):$(DIRS:%=$(SRCDIR)/%):$(DIRS:%=$(SRCDIR)/%/include)
93
94INCLUDES=-I$(OBJDIR) -I$(SRCDIR)/include -I$(SRCDIR)/devices/mem_bus/libgeneric
95INCLUDES+= -I$(SRCDIR)/devices/mem_bus/include $(DIRS:%=-I$(SRCDIR)/%/include)
96
97PLUGINS_DIR=./plugins
98
99CPPFLAGS=$(INCLUDES) $(DEFINES)
100
101#LFLAGS=-s
102LFLAGS=
103
104TARGET=sim
105
106OBJS=datestamp.o
107MADESRCS=datestamp.c
108MADEBINS=
109TOOLS=
110LIBS=
111ifdef INTERNAL_BUILD
112CONFIGURE_SCRIPT=configure
113else
114CONFIGURE_SCRIPT=configure.opensparc
115endif
116
117
118all : configuration support plugins $(TARGET) config
119
120plugins:
121 @mkdir -m 755 $(PLUGINS_DIR)
122
123
124ifdef INTERNAL_BUILD
125config: MAKE=/usr/ccs/bin/make
126config:
127 @cd $(SRCDIR)/config && $(MAKE) $(MFLAGS)
128
129config_clean: MAKE=/usr/ccs/bin/make
130config_clean:
131 cd $(SRCDIR)/config; $(MAKE) clean $(MFLAGS)
132else
133config:
134config_clean:
135endif
136
137configuration: $(SRCDIR)/$(CONFIGURE_SCRIPT)
138 /bin/sh $^ testconfigure $(CONFVER)
139
140#
141# Some more default rules:
142#
143
144FRC:
145
146# Delete the implicit .S->.o rule
147%.o : %.S
148
149# Delete the .S->.s rule
150%.s : %.S
151
152# Now create the intermediate rules
153
154%.i : %.S
155 $(CPP) -D_ASM $(CPPFLAGS) $< > $@
156
157%.s : %.i
158 ./lsplitter "NL" < $< > $@
159
160cscope.files: FRC
161 /usr/bin/find $(DESTDIR)/. $(SRCDIR)/. -name SCCS -prune -o \
162 -name built -prune -o \
163 -type f \( -name '*.[schS]' -o -name 'Makefile*' \
164 -o -name 'GNUmakefile*' \) \
165 -print > cscope.files
166
167tags: FRC
168 /usr/bin/ctags -uw `cat cscope.files`
169
170cscope.out: cscope.files tags FRC
171 $(CSCOPE) -bq
172
173
174
175# Now read and apply sub-makefiles, so we build all rules correctly
176
177include $(DIRS:%=$(SRCDIR)/%/Makefile.inc)
178
179
180$(TARGET) : $(TOOLS) $(OBJS) $(LIBS)
181 @echo "================> Making $@"
182 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LOADLIBS)
183
184.INTERMEDIATE: datestamp.c
185
186datestamp.c : $(SRCDIR)/Makefile.top
187 echo "const char datestamp[] = \""`date +%Y-%m-%d--%T`"\";" > datestamp.c
188
189
190clean: config_clean $(FIRE_MODEL_CLEAN)
191 @echo "================> Making clean in $$PWD"
192 rm -f $(OBJS) $(LIBS) $(MADEBINS) $(MADESRCS) $(TARGET) *.o temp_*
193 rm -rf $(PLUGINS_DIR)
194
195distclean: clean
196 rm -f Makefile hostcpu.h hostnative_asm.h hostnative.h hostnative_ua200x.h \
197 dumbblue.conf hostnative_asm.S hostnative.c hostnative_ua200x.c hostos.h \
198 GNUmakefile Makefile.tools
199
200clobber: clean distclean
201 rm -f tags cscope.*
202
203release:
204 tar -cvf release.tar sim plugins
205 compress -f release.tar