-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile.simulator
155 lines (136 loc) · 5.93 KB
/
makefile.simulator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# DO-NOT-REMOVE begin-copyright-block
#
# Redistributions of any form whatsoever must retain and/or include the
# following acknowledgment, notices and disclaimer:
#
# This product includes software developed by Carnegie Mellon University.
#
# Copyright 2012 by Mohammad Alisafaee, Eric Chung, Michael Ferdman, Brian
# Gold, Jangwoo Kim, Pejman Lotfi-Kamran, Onur Kocberber, Djordje Jevdjic,
# Jared Smolens, Stephen Somogyi, Evangelos Vlachos, Stavros Volos, Jason
# Zebchuk, Babak Falsafi, Nikos Hardavellas and Tom Wenisch for the SimFlex
# Project, Computer Architecture Lab at Carnegie Mellon, Carnegie Mellon University.
#
# For more information, see the SimFlex project website at:
# http://www.ece.cmu.edu/~simflex
#
# You may not use the name "Carnegie Mellon University" or derivations
# thereof to endorse or promote products derived from this software.
#
# If you modify the software you must place a notice on or within any
# modified version provided or made available to any third party stating
# that you have modified the software. The notice shall include at least
# your name, address, phone number, email address and the date and purpose
# of the modification.
#
# THE SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY WARRANTY OF ANY KIND, EITHER
# EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO ANY WARRANTY
# THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS OR BE ERROR-FREE AND ANY
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
# TITLE, OR NON-INFRINGEMENT. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
# BE LIABLE FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO DIRECT, INDIRECT,
# SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN
# ANY WAY CONNECTED WITH THIS SOFTWARE (WHETHER OR NOT BASED UPON WARRANTY,
# CONTRACT, TORT OR OTHERWISE).
#
# DO-NOT-REMOVE end-copyright-block
# Get variables from Makefile.defs
###############
include $(FLEXUS_ROOT)/makefile.defs
.PHONY: default core install standalone simics standalone-x86 standalone-v9 simics-x86 simics-v9 depend
# Include simulator-specific variables
###############
include Makefile.$(SIMULATOR)
# Set the target to the default (standalone or simics) if none was passed in
###############
default: $(DEFAULT_TARGET)
# determine which platform we are building for
###############
ifeq ($(SELECTED_PLATFORM),default)
export TARGET_PLATFORM=$(DEFAULT_PLATFORM)
else
export TARGET_PLATFORM=$(SELECTED_PLATFORM)
endif
# Include variant-specific stuff
include $(FLEXUS_ROOT)/makefile.variant
# Ensure that we support the selected target and platform
###############
ifeq ($(SUPPORTS_STANDALONE),true)
standalone: standalone-$(TARGET_PLATFORM)
else
standalone:
echo "Standalone target not supported for $(SIMULATOR)"
endif
ifeq ($(SUPPORTS_SIMICS),true)
simics: simics-$(TARGET_PLATFORM)
else
simics:
echo "Simics target not supported for $(SIMULATOR)"
endif
ifeq ($(SUPPORTS_X86),true)
standalone-x86: depend
$(ECHO) "Building $(SIMULATOR) for x86 standalone"
$(MAKE) $(SILENT_MAKE) -f $(FLEXUS_ROOT)/makefile.simulator_$(SELECTED_CC) $(SIMULATOR).$(VARIANT_EXT).deps $(BUILD_OPTIONS) SIMULATOR=$(SIMULATOR)
$(MAKE) $(SILENT_MAKE) -f $(FLEXUS_ROOT)/makefile.simulator_$(SELECTED_CC) $(SIMULATOR).$(VARIANT_EXT) $(BUILD_OPTIONS) SIMULATOR=$(SIMULATOR)
simics-x86: depend
$(ECHO) "Building $(SIMULATOR) for x86 simics"
$(MAKE) $(SILENT_MAKE) -f $(FLEXUS_ROOT)/makefile.simulator_$(SELECTED_CC) libflexus_$(SIMULATOR)_$(VARIANT).so.deps $(BUILD_OPTIONS) SIMULATOR=$(SIMULATOR)
$(MAKE) $(SILENT_MAKE) -f $(FLEXUS_ROOT)/makefile.simulator_$(SELECTED_CC) libflexus_$(SIMULATOR)_$(VARIANT).so libflexus_$(SIMULATOR)_$(VARIANT).so $(BUILD_OPTIONS) SIMULATOR=$(SIMULATOR)
else
standalone-x86:
echo "x86 target platform not supported for $(SIMULATOR)"
simics-x86:
echo "x86 target platform not supported for $(SIMULATOR)"
endif
ifeq ($(SUPPORTS_V9),true)
standalone-v9: depend
$(ECHO) "Building $(SIMULATOR) for $(VARIANT) standalone"
$(MAKE) $(SILENT_MAKE) -f $(FLEXUS_ROOT)/makefile.simulator_$(SELECTED_CC) $(SIMULATOR).$(VARIANT_EXT).deps $(BUILD_OPTIONS) SIMULATOR=$(SIMULATOR)
$(MAKE) $(SILENT_MAKE) -f $(FLEXUS_ROOT)/makefile.simulator_$(SELECTED_CC) $(SIMULATOR).$(VARIANT_EXT) $(BUILD_OPTIONS) SIMULATOR=$(SIMULATOR)
simics-v9: depend
$(ECHO) "Building $(SIMULATOR) for $(VARIANT) simics"
$(MAKE) $(SILENT_MAKE) -f $(FLEXUS_ROOT)/makefile.simulator_$(SELECTED_CC) libflexus_$(SIMULATOR)_$(VARIANT).so.deps $(BUILD_OPTIONS) SIMULATOR=$(SIMULATOR)
$(MAKE) $(SILENT_MAKE) -f $(FLEXUS_ROOT)/makefile.simulator_$(SELECTED_CC) libflexus_$(SIMULATOR)_$(VARIANT).so $(BUILD_OPTIONS) SIMULATOR=$(SIMULATOR)
else
standalone-v9:
echo "v9 target platform not supported for $(SIMULATOR)"
simics-v9:
echo "v9 target platform not supported for $(SIMULATOR)"
endif
# Set up a depend target
###############
depend: Makefile.depend.$(VARIANT)
.SUFFIXES:
.SUFFIXES: .cpp .$(GCC_DEP_EXT)
.SUFFIXES: .cpp .$(ICC_DEP_EXT)
.cpp.$(GCC_DEP_EXT):
$(GCC) $(INCLUDES) $(VARIANT_DEFINES) $(GCC_DEPFLAGS) -MF $@ -MM -MT $*.$(GCC_OEXT) $<
Makefile.depend.$(GCC_VARIANT): $(patsubst %.cpp,%.$(GCC_DEP_EXT),$(wildcard *.cpp))
cat $^ > Makefile.depend.$(GCC_VARIANT)
.cpp.$(ICC_DEP_EXT):
$(GCC) $(INCLUDES) $(VARIANT_DEFINES) -MF $@ -MM -MT $(VARIANT_EXT).ipo_out.o $<
Makefile.depend.$(ICC_VARIANT): $(patsubst %.cpp,%.$(ICC_DEP_EXT),$(wildcard *.cpp))
cat $^ > Makefile.depend.$(ICC_VARIANT)
# Clean the simulator
###############
clean:
echo "Cleaning $(SIMULATOR)"
rm -f *.*cc_o
rm -f *.*_dep
rm -f Makefile.depend.*
rm -f *.ipo_out.o
rm -f module_id.icc_o
rm -f *.il
rm -f *.so
rm -f *.lst he.ps re.ps *.hex *.mcd_lnk
# Clobber the simulator
###############
clobber: clean
echo "Clobbering $(SIMULATOR)"
rm -f $(SIMULATOR).*.?cc
rm -f *.rom *.cnt
install:
$(MAKE) $(SILENT_MAKE) simics TARGET=simics
echo "This make target may not work anymore - I haven't fixed it. -twenisch"
echo "cp libflexus_$(SIMULATOR)_$(VARIANT).so $(SIMICS_LIB_DIR)"
cp libflexus_$(SIMULATOR)_$(VARIANT).so $(SIMICS_LIB_DIR)