Commit | Line | Data |
---|---|---|
cb7a6892 MM |
1 | # |
2 | # This file is part of the program psim. | |
3 | # | |
4 | # Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> | |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify | |
7 | # it under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 | # | |
20 | ||
8e20a3ac MM |
21 | default: all |
22 | ||
cb7a6892 MM |
23 | VPATH = @srcdir@ |
24 | srcdir = @srcdir@ | |
25 | srcroot = $(srcdir)/../.. | |
26 | ||
27 | prefix = @prefix@ | |
28 | exec_prefix = @exec_prefix@ | |
29 | ||
30 | host_alias = @host_alias@ | |
31 | target_alias = @target_alias@ | |
32 | program_transform_name = @program_transform_name@ | |
33 | bindir = $(exec_prefix)/bin | |
34 | libdir = $(exec_prefix)/lib | |
35 | tooldir = $(libdir)/$(target_alias) | |
36 | ||
37 | datadir = $(prefix)/lib | |
38 | mandir = $(prefix)/man | |
39 | man1dir = $(mandir)/man1 | |
40 | man2dir = $(mandir)/man2 | |
41 | man3dir = $(mandir)/man3 | |
42 | man4dir = $(mandir)/man4 | |
43 | man5dir = $(mandir)/man5 | |
44 | man6dir = $(mandir)/man6 | |
45 | man7dir = $(mandir)/man7 | |
46 | man8dir = $(mandir)/man8 | |
47 | man9dir = $(mandir)/man9 | |
48 | infodir = $(prefix)/info | |
49 | includedir = $(prefix)/include | |
50 | docdir = $(datadir)/doc | |
51 | ||
52 | SHELL = /bin/sh | |
53 | ||
cb7a6892 MM |
54 | INSTALL = $(srcroot)/install.sh -c |
55 | INSTALL_PROGRAM = $(INSTALL) | |
56 | INSTALL_DATA = $(INSTALL) | |
57 | INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)' | |
58 | INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1 | |
59 | ||
8b3797aa | 60 | AR = @AR@ |
cb7a6892 | 61 | AR_FLAGS = rc |
8b3797aa MM |
62 | CC = @CC@ |
63 | CFLAGS = @CFLAGS@ | |
64 | CC_FOR_BUILD = @CC_FOR_BUILD@ | |
cb7a6892 MM |
65 | BISON = bison |
66 | MAKEINFO = makeinfo | |
8b3797aa MM |
67 | RANLIB = @RANLIB@ |
68 | ||
c494cadd MM |
69 | SIM_CFLAGS = @sim_cflags@ |
70 | INLINE_CFLAGS = @sim_inline@ | |
71 | BSWAP_CFLAGS = @sim_bswap@ | |
72 | ENDIAN_CFLAGS = @sim_endian@ | |
73 | HOSTENDIAN_CFLAGS = @sim_hostendian@ | |
74 | SMP_CFLAGS = @sim_smp@ | |
75 | BITSIZE_CFLAGS = @sim_bitsize@ | |
76 | HOSTBITSIZE_CFLAGS = @sim_hostbitsize@ | |
77 | ENV_CFLAGS = @sim_env@ | |
78 | TIMEBASE_CFLAGS = @sim_timebase@ | |
79 | ALIGNMENT_CFLAGS = @sim_alignment@ | |
80 | FLOAT_CFLAGS = @sim_float@ | |
81 | TRACE_CFLAGS = @sim_trace@ | |
82 | ASSERT_CFLAGS = @sim_assert@ | |
83 | MONITOR_CFLAGS = @sim_monitor@ | |
84 | CONFIG_CFLAGS = $(BSWAP_CFLAGS) \ | |
85 | $(ENDIAN_CFLAGS) \ | |
86 | $(HOSTENDIAN_CFLAGS) \ | |
87 | $(SMP_CFLAGS) \ | |
88 | $(BITSIZE_CFLAGS) \ | |
89 | $(HOSTBITSIZE_CFLAGS) \ | |
90 | $(ENV_CFLAGS) \ | |
91 | $(FLOAT_CFLAGS) \ | |
92 | $(TRACE_CFLAGS) \ | |
93 | $(ASSERT_CFLAGS) \ | |
94 | $(MONITOR_CFLAGS) | |
95 | ||
96 | CONFIG_FILE = @sim_config@ | |
97 | IGEN_OPCODE_RULES = @sim_opcode@ | |
98 | IGEN_DUPLICATE = @sim_dup@ | |
99 | IGEN_FILTER = @sim_filter@ | |
100 | IGEN_ICACHE = @sim_icache@ | |
101 | DGEN_FLAGS = @sim_switch@ | |
102 | ||
8b3797aa MM |
103 | HDEFINES = @HDEFINES@ |
104 | TDEFINES = | |
a983c8f0 | 105 | IGEN_FLAGS = $(IGEN_DUPLICATE) $(IGEN_FILTER) $(IGEN_ICACHE) |
cb7a6892 MM |
106 | |
107 | .NOEXPORT: | |
108 | MAKEOVERRIDES= | |
109 | ||
110 | LIB_INCLUDES = -I$(srcdir)/../../include | |
111 | BFD_INCLUDES = -I../../bfd -I$(srcdir)/../../bfd | |
112 | GDB_INCLUDES = -I../../gdb -I$(srcdir)/../../gdb -I$(srcdir)/../../gdb/config -I$(srcdir)/../../mmalloc | |
113 | INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES) | |
114 | ||
cb7a6892 MM |
115 | LIBIBERTY_LIB = ../../libiberty/libiberty.a |
116 | BFD_LIB = ../../bfd/libbfd.a | |
117 | ||
c143ef62 | 118 | TARGETLIB = libsim.a |
cb7a6892 | 119 | |
8e20a3ac | 120 | all: run $(TARGETLIB) $(GDB_OBJ) |
cb7a6892 MM |
121 | |
122 | .c.o: | |
c494cadd | 123 | $(CC) -c $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $< |
cb7a6892 MM |
124 | |
125 | ||
126 | ||
127 | BASICS_H = \ | |
cb7a6892 | 128 | config.h \ |
8b3797aa | 129 | ppc-config.h \ |
cb7a6892 MM |
130 | words.h \ |
131 | ppc-endian.h \ | |
132 | debug.h \ | |
c143ef62 | 133 | filter_filename.h \ |
cb7a6892 MM |
134 | bits.h \ |
135 | sim_callbacks.h | |
136 | ||
137 | PSIM_H = \ | |
138 | psim.h \ | |
139 | $(BASICS_H) | |
140 | ||
141 | IDECODE_H = \ | |
142 | idecode.h \ | |
cb7a6892 MM |
143 | idecode_expression.h \ |
144 | idecode_branch.h \ | |
145 | idecode_fields.h \ | |
146 | icache.h | |
147 | ||
148 | REGISTERS_H = \ | |
149 | registers.h \ | |
150 | spreg.h | |
151 | ||
152 | CPU_H = \ | |
153 | cpu.h \ | |
154 | $(BASICS_H) \ | |
155 | $(REGISTERS_H) \ | |
156 | device_tree.h \ | |
cb7a6892 MM |
157 | core.h \ |
158 | vm.h \ | |
159 | events.h \ | |
160 | interrupts.h \ | |
161 | psim.h \ | |
5b4d72dd MM |
162 | icache.h \ |
163 | itable.h \ | |
164 | mon.h | |
165 | ||
166 | EMUL_GENERIC_H = \ | |
167 | $(CPU_H) \ | |
168 | $(IDECODE_H) \ | |
169 | emul_generic.h \ | |
170 | os_emul.h | |
cb7a6892 MM |
171 | |
172 | ||
173 | INLINE = \ | |
174 | inline.h \ | |
175 | inline.c | |
176 | ||
177 | BUILT_SRC = \ | |
178 | icache.h \ | |
179 | idecode.h idecode.c \ | |
180 | semantics.h semantics.c \ | |
5b4d72dd | 181 | itable.h itable.c \ |
cb7a6892 | 182 | spreg.h spreg.c \ |
8b3797aa | 183 | config.h \ |
5b4d72dd | 184 | ppc-config.h |
cb7a6892 MM |
185 | |
186 | LIB_SRC = \ | |
187 | psim.c \ | |
188 | bits.c \ | |
cb7a6892 | 189 | debug.c \ |
5b4d72dd | 190 | ppc-endian.c \ |
cb7a6892 MM |
191 | vm.c \ |
192 | core.c \ | |
193 | events.c \ | |
5b4d72dd MM |
194 | os_emul.c \ |
195 | emul_generic.c \ | |
196 | emul_netbsd.c \ | |
cb7a6892 MM |
197 | registers.c \ |
198 | cpu.c \ | |
199 | interrupts.c \ | |
200 | devices.c \ | |
5b4d72dd MM |
201 | device_tree.c \ |
202 | mon.c | |
cb7a6892 MM |
203 | |
204 | MAIN_SRC = \ | |
205 | main.c \ | |
206 | sim_calls.c | |
207 | ||
208 | ||
5b4d72dd MM |
209 | # NOTE: semantics, idecode and psim put last so smaller files are compiled |
210 | # first | |
cb7a6892 MM |
211 | LIB_OBJ = \ |
212 | debug.o \ | |
c143ef62 | 213 | filter_filename.o \ |
cb7a6892 MM |
214 | bits.o \ |
215 | ppc-endian.o \ | |
5b4d72dd MM |
216 | os_emul.o \ |
217 | emul_generic.o \ | |
218 | emul_netbsd.o \ | |
cb7a6892 | 219 | registers.o \ |
cb7a6892 MM |
220 | vm.o \ |
221 | core.o \ | |
222 | spreg.o \ | |
223 | cpu.o \ | |
224 | interrupts.o \ | |
225 | events.o \ | |
226 | devices.o \ | |
227 | device_tree.o \ | |
5b4d72dd MM |
228 | itable.o \ |
229 | mon.o \ | |
cb7a6892 MM |
230 | semantics.o \ |
231 | idecode.o \ | |
232 | psim.o | |
233 | ||
234 | ||
235 | GDB_OBJ = sim_calls.o | |
236 | ||
237 | ||
8e20a3ac MM |
238 | psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS) |
239 | $(CC) $(CFLAGS) $(LDFLAGS) -o psim main.o $(TARGETLIB) $(BFD_LIB) $(LIBIBERTY_LIB) $(LIBS) | |
cb7a6892 MM |
240 | |
241 | run: psim | |
242 | rm -f run | |
243 | ln psim run | |
244 | ||
5b4d72dd | 245 | $(TARGETLIB): tmp-igen tmp-dgen $(LIB_OBJ) $(GDB_OBJ) |
cb7a6892 MM |
246 | rm -f $(TARGETLIB) |
247 | $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ) | |
248 | $(RANLIB) $(TARGETLIB) | |
249 | ||
9f5912cb MM |
250 | # Given that inlines are turned on now, rebuild psim whenever |
251 | # anything changes. | |
c143ef62 | 252 | psim.o: psim.c psim.h $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) |
cb7a6892 | 253 | |
5b4d72dd | 254 | bits.o: bits.c $(BASICS_H) |
cb7a6892 MM |
255 | |
256 | debug.o: debug.c $(BASICS_H) | |
c143ef62 | 257 | filter_filename.o: filter_filename.c $(BASICS_H) |
cb7a6892 MM |
258 | |
259 | ppc-endian.o: ppc-endian.c ppc-endian.h \ | |
8b3797aa | 260 | config.h ppc-config.h words.h sim_callbacks.h |
cb7a6892 | 261 | |
5b4d72dd MM |
262 | os_emul.o: os_emul.c $(EMUL_GENERIC_H) |
263 | emul_generic.o: emul_generic.c $(EMUL_GENERIC_H) | |
264 | emul_netbsd.o: emul_netbsd.c emul_netbsd.h $(EMUL_GENERIC_H) | |
cb7a6892 MM |
265 | |
266 | registers.o: registers.c $(REGISTERS_H) $(BASICS_H) | |
267 | ||
268 | cpu.o: cpu.c $(CPU_H) $(IDECODE_H) | |
269 | ||
5b4d72dd | 270 | interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) os_emul.h |
cb7a6892 MM |
271 | |
272 | idecode.o: idecode.c $(CPU_H) $(IDECODE_H) semantics.h | |
273 | ||
cb7a6892 MM |
274 | # double.o: double.c dp-bit.c |
275 | ||
8e20a3ac | 276 | vm.o: vm.c vm.h vm_n.h $(BASICS_H) $(REGISTERS_H) \ |
5b4d72dd | 277 | device_tree.h core.h interrupts.h itable.h mon.h |
cb7a6892 | 278 | |
8e20a3ac | 279 | core.o: core.c core.h $(BASICS_H) device_tree.h |
cb7a6892 MM |
280 | |
281 | events.o: events.c events.h $(BASICS_H) | |
282 | ||
283 | sim_calls.o: sim_calls.c $(PSIM_H) ../../gdb/tm.h devices.h | |
284 | ||
285 | spreg.o: spreg.h spreg.c words.h | |
286 | ||
287 | main.o: main.c $(PSIM_H) | |
288 | ||
289 | devices.o: devices.c devices.h $(BASICS_H) \ | |
290 | device_tree.h events.h | |
291 | ||
292 | device_tree.o: device_tree.c device_tree.h devices.h $(BASICS_H) | |
293 | ||
294 | semantics.o: semantics.c semantics.h $(CPU_H) $(IDECODE_H) | |
295 | ||
5b4d72dd MM |
296 | itable.o: itable.c itable.h |
297 | ||
298 | mon.o: $(CPU_H) | |
cb7a6892 MM |
299 | |
300 | # | |
301 | # Rules to create the built c source code files | |
302 | # | |
303 | ||
8b3797aa MM |
304 | ppc-config.h: $(CONFIG_FILE) |
305 | cp $(srcdir)/$(CONFIG_FILE) ppc-config.h | |
cb7a6892 MM |
306 | |
307 | ||
5b4d72dd MM |
308 | tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change |
309 | ./dgen $(DGEN_FLAGS) \ | |
310 | -r $(srcdir)/ppc-spr-table \ | |
8e20a3ac | 311 | -n spreg.h -P tmp-spreg.h \ |
5b4d72dd MM |
312 | -n spreg.c -p tmp-spreg.c |
313 | $(srcdir)/../../move-if-change tmp-spreg.h spreg.h | |
314 | $(srcdir)/../../move-if-change tmp-spreg.c spreg.c | |
315 | touch tmp-dgen | |
316 | ||
317 | ||
318 | tmp-igen: igen ppc-instructions $(IGEN_OPCODE_RULES) ppc-cache-rules $(srcdir)/../../move-if-change | |
319 | ./igen $(IGEN_FLAGS) \ | |
320 | -o $(srcdir)/$(IGEN_OPCODE_RULES) \ | |
321 | -k $(srcdir)/ppc-cache-rules \ | |
322 | -i $(srcdir)/ppc-instructions \ | |
8e20a3ac MM |
323 | -n icache.h -C tmp-icache.h \ |
324 | -n semantics.h -S tmp-semantics.h \ | |
325 | -n semantics.c -s tmp-semantics.c \ | |
326 | -n idecode.h -D tmp-idecode.h \ | |
5b4d72dd MM |
327 | -n idecode.c -d tmp-idecode.c \ |
328 | -n itable.h -T tmp-itable.h \ | |
329 | -n itable.c -t tmp-itable.c | |
cb7a6892 MM |
330 | $(srcdir)/../../move-if-change tmp-icache.h icache.h |
331 | $(srcdir)/../../move-if-change tmp-idecode.h idecode.h | |
332 | $(srcdir)/../../move-if-change tmp-idecode.c idecode.c | |
333 | $(srcdir)/../../move-if-change tmp-semantics.h semantics.h | |
334 | $(srcdir)/../../move-if-change tmp-semantics.c semantics.c | |
5b4d72dd MM |
335 | $(srcdir)/../../move-if-change tmp-itable.h itable.h |
336 | $(srcdir)/../../move-if-change tmp-itable.c itable.c | |
337 | touch tmp-igen | |
cb7a6892 | 338 | |
8e20a3ac MM |
339 | # NOTE: Some versions of make don't handle files created as side-effects |
340 | # uncomment the below if that is the case. | |
e61900e6 MM |
341 | |
342 | $(TARGETLIB): tmp-igen tmp-dgen | |
343 | itable.h itable.c icache.h idecode.h idecode.c semantics.h semantics.c: tmp-igen | |
344 | spreg.h spreg.c: tmp-dgen | |
cb7a6892 | 345 | |
c143ef62 MM |
346 | dgen: dgen.o table.o lf.o misc.o filter_filename.o |
347 | $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o dgen dgen.o table.o lf.o misc.o filter_filename.o $(LIBIBERTY_LIB) $(LIBS) | |
cb7a6892 | 348 | |
c143ef62 MM |
349 | igen: igen.o table.o lf.o misc.o filter_filename.o |
350 | $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o igen igen.o table.o lf.o misc.o filter_filename.o $(LIBIBERTY_LIB) $(LIBS) | |
64415b76 | 351 | |
c143ef62 MM |
352 | table.o: misc.h filter_filename.h lf.h table.h |
353 | lf.o: misc.h filter_filename.h lf.h | |
354 | dgen.o igen.o: misc.h filter_filename.h lf.h table.h | |
355 | misc.o: misc.h filter_filename.h | |
5b4d72dd | 356 | # With out this #, make thinks that misc.o doesn't have a rule |
cb7a6892 MM |
357 | |
358 | tags etags: TAGS | |
359 | ||
5b4d72dd | 360 | TAGS: tmp-igen tmp-dgen config.h ppc-config.h |
cb7a6892 MM |
361 | etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC) |
362 | ||
8b3797aa | 363 | clean mostlyclean: |
c494cadd | 364 | rm -f tmp-* *.[oas] core psim run igen dgen config.log $(BUILT_SRC) |
8b3797aa | 365 | |
8e20a3ac | 366 | distclean maintainer-clean realclean: clean |
c494cadd | 367 | rm -f TAGS Makefile config.cache config.status config.h stamp-h |
cb7a6892 | 368 | |
8b3797aa MM |
369 | Makefile: Makefile.in config.status |
370 | CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status | |
cb7a6892 | 371 | |
8b3797aa MM |
372 | config.h: stamp-h ; @true |
373 | stamp-h: config.in config.status | |
374 | CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status | |
cb7a6892 | 375 | |
c143ef62 | 376 | config.status: configure config.make config.hdr |
cb7a6892 MM |
377 | $(SHELL) ./config.status --recheck |
378 | ||
379 | install: | |
4f965b81 MM |
380 | $(INSTALL_XFORM) run $(bindir)/run |
381 |