-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
189 lines (165 loc) · 5.09 KB
/
Makefile.am
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
## Process this file with automake to generate Makefile.in
#
# Copyright 2012 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
#
AUTOMAKE_OPTIONS = foreign
SUBDIRS = doc testsuite
GUILE = "`if test -f ../guile/libguile/guile ; then echo ../guile/libguile/guile; else echo guile ; fi`" -l $(srcdir)/guile.scm -s
CGENFLAGS = -v
ARCH = @arch@
ARCHFILE = $(srcroot)/cpu/$(ARCH).cpu
# for various utility rules
MACHS = all
ISAS = all
# file generation options
OPTIONS =
# for the html rule
INSN_FILE_NAME = $(ARCH)-insn.html
srcroot = $(srcdir)/..
# Applications depend on stamp-cgen to tell them when .scm files have
# been changed (so files need to be regenerated).
# ??? Application specific files are kept with cgen for now, but may
# eventually go with the app. stamp-cgen might still be useful to track
# app-independent files.
all-local: stamp-cgen
install-pdf:
install-html:
stamp-cgen: $(CGENFILES)
rm -f stamp-cgen
echo timestamp > stamp-cgen
# Phony targets to run each of the applications,
# though most of these are for development purposes only.
# When actually building the toolchain, the Makefile in the appropriate
# directory will run cgen.
#
# NOTE: If running for a cpu other than the configured one you may wish to
# override ISAS and MACHS.
# Build the basic description support.
# We just stuff them in tmp-* files.
# Usage: make desc [ARCH=<arch>] [ARCHFILE=<arch-file>] OPTIONS="<option list>"
#
# -O tmp-opc.h -P tmp-opc.c -OPC $(dirname ${archfile})/${arch}.opc
.PHONY: desc
desc: desc.scm
rm -f tmp-desc.h tmp-desc.c
$(GUILE) $(srcdir)/cgen-opc.scm \
-s $(srcdir) \
$(CGENFLAGS) \
-f "$(OPTIONS)" \
-a $(ARCHFILE) \
-i "$(ISAS)" \
-m "$(MACHS)" \
-H tmp-desc.h -C tmp-desc.c
$(SHELL) $(srcroot)/move-if-change tmp-desc.h $(ARCH)-desc.h
$(SHELL) $(srcroot)/move-if-change tmp-desc.c $(ARCH)-desc.c
# Build the machine generated cpu documentation.
# Usage: make html [ARCH=<arch>] [ARCHFILE=<arch-file>]
.PHONY: html
html: desc.scm html.scm cgen-doc.scm
rm -f tmp-doc.html
$(GUILE) $(srcdir)/cgen-doc.scm \
-s $(srcdir) \
$(CGENFLAGS) \
-f "$(OPTIONS)" \
-a $(ARCHFILE) \
-i "$(ISAS)" \
-m "$(MACHS)" \
-N $(INSN_FILE_NAME) \
-H tmp.html \
-I tmp-insn.html
$(SHELL) $(srcroot)/move-if-change tmp.html $(ARCH).html
$(SHELL) $(srcroot)/move-if-change tmp-insn.html $(ARCH)-insn.html
# Build the opcodes files.
# We just stuff them in tmp-* files.
# Usage: make opcodes [ARCHFILE=<arch-file>] OPTIONS="<option list>"
.PHONY: opcodes
opcodes: opcodes.scm
rm -f tmp-opc.h tmp-itab.c
rm -f tmp-asm.in tmp-dis.in tmp-ibld.h tmp-ibld.in
$(GUILE) $(srcdir)/cgen-opc.scm \
-s $(srcdir) \
$(CGENFLAGS) \
-f "$(OPTIONS) opinst" \
-a $(ARCHFILE) \
-i "$(ISAS)" \
-m "$(MACHS)" \
-O tmp-opc.h -P tmp-opc.c -Q tmp-opinst.c \
-B tmp-ibld.h -L tmp-ibld.in \
-A tmp-asm.in -D tmp-dis.in
# Build the simulator files.
# We just stuff them in tmp-* files.
# Usage: make sim-arch [ARCHFILE=<arch-file>] OPTIONS="<option list>"
# make sim-cpu [ARCHFILE=<arch-file>] ISAS="<isa>" MACHS="<mach list>" \
# OPTIONS="<option list>"
.PHONY: sim-arch sim-cpu
sim-arch: sim.scm
rm -f tmp-arch.h tmp-arch.c tmp-cpuall.h
$(GUILE) $(srcdir)/cgen-sim.scm \
-s $(srcdir) \
$(CGENFLAGS) \
-f "$(OPTIONS)" \
-a $(ARCHFILE) \
-i "$(ISAS)" \
-m "$(MACHS)" \
-A tmp-arch.h -B tmp-arch.c -N tmp-cpuall.h
sim-cpu: sim.scm
rm -f tmp-cpu.h tmp-cpu.c tmp-decode.h tmp-decode.c
rm -f tmp-model.c tmp-sem.c tmp-sem-switch.c
$(GUILE) $(srcdir)/cgen-sim.scm \
-s $(srcdir) \
$(CGENFLAGS) \
-f "$(OPTIONS)" \
-a $(ARCHFILE) \
-i "$(ISAS)" \
-m "$(MACHS)" \
-C tmp-cpu.h -U tmp-cpu.c \
-T tmp-decode.h -D tmp-decode.c \
-M tmp-model.c \
-S tmp-semantics.c -X tmp-sem-switch.c
# Build GAS testcase generator.
# Usage: make gas-test [ARCHFILE=<arch-file>]
.PHONY: gas-test
gas-test: gas-test.scm cgen-gas.scm
@if test -z "$(ISAS)" ; then \
echo "ISAS not specified!" ;\
exit 1 ;\
fi
$(GUILE) $(srcdir)/cgen-gas.scm \
-s $(srcdir) \
$(CGENFLAGS) \
-a $(ARCHFILE) \
-i "$(ISAS)" \
-m "$(MACHS)" \
-B gas-build.sh \
-E gas-allinsn.exp
# Build simulator testcase generator.
# Usage: make sim-test [ARCHFILE=<arch-file>]
.PHONY: sim-test
sim-test: sim-test.scm cgen-stest.scm
@if test -z "$(ISAS)" ; then \
echo "ISAS not specified!" ;\
exit 1 ;\
fi
$(GUILE) $(srcdir)/cgen-stest.scm \
-s $(srcdir) \
$(CGENFLAGS) \
-a $(ARCHFILE) \
-i "$(ISAS)" \
-m "$(MACHS)" \
-B sim-build.sh \
-E sim-allinsn.exp
CLEANFILES = tmp-*