]>
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@ | |
73c4941b MM |
84 | FUNC_CFLAGS = @sim_func@ |
85 | MODEL_CFLAGS = @sim_model@ @sim_default_model@ | |
86 | WARNING_CFLAGS = @sim_warnings@ | |
c494cadd MM |
87 | CONFIG_CFLAGS = $(BSWAP_CFLAGS) \ |
88 | $(ENDIAN_CFLAGS) \ | |
89 | $(HOSTENDIAN_CFLAGS) \ | |
90 | $(SMP_CFLAGS) \ | |
91 | $(BITSIZE_CFLAGS) \ | |
92 | $(HOSTBITSIZE_CFLAGS) \ | |
93 | $(ENV_CFLAGS) \ | |
056e975c MM |
94 | $(TIMEBASE_CFLAGS) \ |
95 | $(ALIGNMENT_CFLAGS) \ | |
c494cadd MM |
96 | $(FLOAT_CFLAGS) \ |
97 | $(TRACE_CFLAGS) \ | |
98 | $(ASSERT_CFLAGS) \ | |
73c4941b MM |
99 | $(MONITOR_CFLAGS) \ |
100 | $(FUNC_CFLAGS) \ | |
101 | $(MODEL_CFLAGS) | |
c494cadd | 102 | |
ba62bb1c MM |
103 | STD_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) |
104 | NOWARN_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) | |
105 | ||
c494cadd MM |
106 | CONFIG_FILE = @sim_config@ |
107 | IGEN_OPCODE_RULES = @sim_opcode@ | |
108 | IGEN_DUPLICATE = @sim_dup@ | |
109 | IGEN_FILTER = @sim_filter@ | |
110 | IGEN_ICACHE = @sim_icache@ | |
111 | DGEN_FLAGS = @sim_switch@ | |
112 | ||
8b3797aa MM |
113 | HDEFINES = @HDEFINES@ |
114 | TDEFINES = | |
a983c8f0 | 115 | IGEN_FLAGS = $(IGEN_DUPLICATE) $(IGEN_FILTER) $(IGEN_ICACHE) |
cb7a6892 MM |
116 | |
117 | .NOEXPORT: | |
118 | MAKEOVERRIDES= | |
119 | ||
120 | LIB_INCLUDES = -I$(srcdir)/../../include | |
121 | BFD_INCLUDES = -I../../bfd -I$(srcdir)/../../bfd | |
122 | GDB_INCLUDES = -I../../gdb -I$(srcdir)/../../gdb -I$(srcdir)/../../gdb/config -I$(srcdir)/../../mmalloc | |
123 | INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES) | |
124 | ||
cb7a6892 MM |
125 | LIBIBERTY_LIB = ../../libiberty/libiberty.a |
126 | BFD_LIB = ../../bfd/libbfd.a | |
127 | ||
c143ef62 | 128 | TARGETLIB = libsim.a |
cb7a6892 | 129 | |
8e20a3ac | 130 | all: run $(TARGETLIB) $(GDB_OBJ) |
cb7a6892 MM |
131 | |
132 | .c.o: | |
ba62bb1c | 133 | $(CC) -c $(STD_CFLAGS) $< |
cb7a6892 MM |
134 | |
135 | ||
136 | ||
137 | BASICS_H = \ | |
cb7a6892 | 138 | config.h \ |
8b3797aa | 139 | ppc-config.h \ |
cb7a6892 | 140 | words.h \ |
73c4941b | 141 | sim-endian.h \ |
cb7a6892 | 142 | debug.h \ |
c143ef62 | 143 | filter_filename.h \ |
cb7a6892 MM |
144 | bits.h \ |
145 | sim_callbacks.h | |
146 | ||
147 | PSIM_H = \ | |
148 | psim.h \ | |
149 | $(BASICS_H) | |
150 | ||
151 | IDECODE_H = \ | |
152 | idecode.h \ | |
cb7a6892 MM |
153 | idecode_expression.h \ |
154 | idecode_branch.h \ | |
155 | idecode_fields.h \ | |
156 | icache.h | |
157 | ||
158 | REGISTERS_H = \ | |
159 | registers.h \ | |
160 | spreg.h | |
161 | ||
162 | CPU_H = \ | |
163 | cpu.h \ | |
164 | $(BASICS_H) \ | |
165 | $(REGISTERS_H) \ | |
166 | device_tree.h \ | |
01860b7e | 167 | corefile.h \ |
cb7a6892 MM |
168 | vm.h \ |
169 | events.h \ | |
170 | interrupts.h \ | |
171 | psim.h \ | |
5b4d72dd MM |
172 | icache.h \ |
173 | itable.h \ | |
73c4941b MM |
174 | mon.h \ |
175 | function_unit.h | |
5b4d72dd MM |
176 | |
177 | EMUL_GENERIC_H = \ | |
178 | $(CPU_H) \ | |
179 | $(IDECODE_H) \ | |
180 | emul_generic.h \ | |
181 | os_emul.h | |
cb7a6892 MM |
182 | |
183 | ||
184 | INLINE = \ | |
185 | inline.h \ | |
186 | inline.c | |
187 | ||
73c4941b | 188 | BUILT_SRC_WO_CONFIG = \ |
cb7a6892 MM |
189 | icache.h \ |
190 | idecode.h idecode.c \ | |
191 | semantics.h semantics.c \ | |
5b4d72dd | 192 | itable.h itable.c \ |
73c4941b MM |
193 | spreg.h spreg.c |
194 | ||
195 | BUILT_SRC = \ | |
196 | $(BUILT_SRC_WO_CONFIG) \ | |
8b3797aa | 197 | config.h \ |
5b4d72dd | 198 | ppc-config.h |
cb7a6892 MM |
199 | |
200 | LIB_SRC = \ | |
201 | psim.c \ | |
202 | bits.c \ | |
cb7a6892 | 203 | debug.c \ |
73c4941b MM |
204 | sim-endian.c \ |
205 | sim-endian.h \ | |
206 | sim-endian-n.h \ | |
cb7a6892 | 207 | vm.c \ |
73c4941b | 208 | vm_n.h \ |
01860b7e | 209 | corefile.c \ |
73c4941b | 210 | function_unit.c \ |
cb7a6892 | 211 | events.c \ |
5b4d72dd MM |
212 | os_emul.c \ |
213 | emul_generic.c \ | |
214 | emul_netbsd.c \ | |
cb7a6892 MM |
215 | registers.c \ |
216 | cpu.c \ | |
217 | interrupts.c \ | |
218 | devices.c \ | |
5b4d72dd | 219 | device_tree.c \ |
c5addc19 MM |
220 | mon.c \ |
221 | options.c | |
cb7a6892 MM |
222 | |
223 | MAIN_SRC = \ | |
224 | main.c \ | |
225 | sim_calls.c | |
226 | ||
227 | ||
5b4d72dd MM |
228 | # NOTE: semantics, idecode and psim put last so smaller files are compiled |
229 | # first | |
cb7a6892 MM |
230 | LIB_OBJ = \ |
231 | debug.o \ | |
c5addc19 | 232 | options.o \ |
c143ef62 | 233 | filter_filename.o \ |
cb7a6892 | 234 | bits.o \ |
73c4941b | 235 | sim-endian.o \ |
5b4d72dd MM |
236 | os_emul.o \ |
237 | emul_generic.o \ | |
238 | emul_netbsd.o \ | |
cb7a6892 | 239 | registers.o \ |
cb7a6892 | 240 | vm.o \ |
01860b7e | 241 | corefile.o \ |
73c4941b | 242 | function_unit.o \ |
cb7a6892 MM |
243 | spreg.o \ |
244 | cpu.o \ | |
245 | interrupts.o \ | |
246 | events.o \ | |
247 | devices.o \ | |
248 | device_tree.o \ | |
5b4d72dd MM |
249 | itable.o \ |
250 | mon.o \ | |
cb7a6892 MM |
251 | semantics.o \ |
252 | idecode.o \ | |
253 | psim.o | |
254 | ||
255 | ||
256 | GDB_OBJ = sim_calls.o | |
257 | ||
258 | ||
8e20a3ac | 259 | psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS) |
ba62bb1c | 260 | $(CC) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o psim main.o $(TARGETLIB) $(BFD_LIB) $(LIBIBERTY_LIB) $(LIBS) |
cb7a6892 MM |
261 | |
262 | run: psim | |
263 | rm -f run | |
264 | ln psim run | |
265 | ||
5b4d72dd | 266 | $(TARGETLIB): tmp-igen tmp-dgen $(LIB_OBJ) $(GDB_OBJ) |
cb7a6892 MM |
267 | rm -f $(TARGETLIB) |
268 | $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ) | |
269 | $(RANLIB) $(TARGETLIB) | |
270 | ||
9f5912cb MM |
271 | # Given that inlines are turned on now, rebuild psim whenever |
272 | # anything changes. | |
c143ef62 | 273 | psim.o: psim.c psim.h $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) |
ba62bb1c | 274 | $(CC) -c $(NOWARN_CFLAGS) $< |
cb7a6892 | 275 | |
5b4d72dd | 276 | bits.o: bits.c $(BASICS_H) |
cb7a6892 MM |
277 | |
278 | debug.o: debug.c $(BASICS_H) | |
73c4941b | 279 | filter_filename.o: filter_filename.c config.h ppc-config.h |
cb7a6892 | 280 | |
73c4941b | 281 | sim-endian.o: sim-endian.c sim-endian-n.h $(BASICS_H) |
cb7a6892 | 282 | |
5b4d72dd MM |
283 | os_emul.o: os_emul.c $(EMUL_GENERIC_H) |
284 | emul_generic.o: emul_generic.c $(EMUL_GENERIC_H) | |
285 | emul_netbsd.o: emul_netbsd.c emul_netbsd.h $(EMUL_GENERIC_H) | |
cb7a6892 MM |
286 | |
287 | registers.o: registers.c $(REGISTERS_H) $(BASICS_H) | |
288 | ||
289 | cpu.o: cpu.c $(CPU_H) $(IDECODE_H) | |
290 | ||
5b4d72dd | 291 | interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) os_emul.h |
cb7a6892 MM |
292 | |
293 | idecode.o: idecode.c $(CPU_H) $(IDECODE_H) semantics.h | |
ba62bb1c | 294 | $(CC) -c $(NOWARN_CFLAGS) $< |
cb7a6892 | 295 | |
cb7a6892 MM |
296 | # double.o: double.c dp-bit.c |
297 | ||
8e20a3ac | 298 | vm.o: vm.c vm.h vm_n.h $(BASICS_H) $(REGISTERS_H) \ |
01860b7e | 299 | device_tree.h corefile.h interrupts.h itable.h mon.h |
cb7a6892 | 300 | |
01860b7e | 301 | corefile.o: corefile.c corefile.h $(BASICS_H) device_tree.h |
cb7a6892 | 302 | |
73c4941b MM |
303 | function_unit.o: function_unit.c $(CPU_H) |
304 | ||
cb7a6892 MM |
305 | events.o: events.c events.h $(BASICS_H) |
306 | ||
c5addc19 | 307 | sim_calls.o: sim_calls.c $(PSIM_H) function_unit.h itable.h ../../gdb/tm.h devices.h options.h |
cb7a6892 MM |
308 | |
309 | spreg.o: spreg.h spreg.c words.h | |
310 | ||
c5addc19 | 311 | main.o: main.c $(PSIM_H) function_unit.h itable.h options.h |
cb7a6892 MM |
312 | |
313 | devices.o: devices.c devices.h $(BASICS_H) \ | |
314 | device_tree.h events.h | |
315 | ||
316 | device_tree.o: device_tree.c device_tree.h devices.h $(BASICS_H) | |
317 | ||
318 | semantics.o: semantics.c semantics.h $(CPU_H) $(IDECODE_H) | |
ba62bb1c | 319 | $(CC) -c $(NOWARN_CFLAGS) $< |
cb7a6892 | 320 | |
5b4d72dd MM |
321 | itable.o: itable.c itable.h |
322 | ||
73c4941b | 323 | mon.o: mon.c $(CPU_H) |
cb7a6892 | 324 | |
ba62bb1c MM |
325 | # Rebuild options whenever something changes so the date/time is up to date. |
326 | options.o: options.c $(BASICS_H) $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) config.status Makefile | |
327 | $(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_opcode@"' '-DIGEN_FLAGS="$(IGEN_FLAGS)"' '-DDGEN_FLAGS="$(DGEN_FLAGS)"' $< | |
c5addc19 | 328 | |
cb7a6892 MM |
329 | # |
330 | # Rules to create the built c source code files | |
331 | # | |
332 | ||
8b3797aa MM |
333 | ppc-config.h: $(CONFIG_FILE) |
334 | cp $(srcdir)/$(CONFIG_FILE) ppc-config.h | |
cb7a6892 MM |
335 | |
336 | ||
5b4d72dd MM |
337 | tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change |
338 | ./dgen $(DGEN_FLAGS) \ | |
339 | -r $(srcdir)/ppc-spr-table \ | |
8e20a3ac | 340 | -n spreg.h -P tmp-spreg.h \ |
5b4d72dd MM |
341 | -n spreg.c -p tmp-spreg.c |
342 | $(srcdir)/../../move-if-change tmp-spreg.h spreg.h | |
343 | $(srcdir)/../../move-if-change tmp-spreg.c spreg.c | |
344 | touch tmp-dgen | |
345 | ||
346 | ||
347 | tmp-igen: igen ppc-instructions $(IGEN_OPCODE_RULES) ppc-cache-rules $(srcdir)/../../move-if-change | |
348 | ./igen $(IGEN_FLAGS) \ | |
349 | -o $(srcdir)/$(IGEN_OPCODE_RULES) \ | |
350 | -k $(srcdir)/ppc-cache-rules \ | |
351 | -i $(srcdir)/ppc-instructions \ | |
8e20a3ac MM |
352 | -n icache.h -C tmp-icache.h \ |
353 | -n semantics.h -S tmp-semantics.h \ | |
354 | -n semantics.c -s tmp-semantics.c \ | |
355 | -n idecode.h -D tmp-idecode.h \ | |
5b4d72dd MM |
356 | -n idecode.c -d tmp-idecode.c \ |
357 | -n itable.h -T tmp-itable.h \ | |
358 | -n itable.c -t tmp-itable.c | |
cb7a6892 MM |
359 | $(srcdir)/../../move-if-change tmp-icache.h icache.h |
360 | $(srcdir)/../../move-if-change tmp-idecode.h idecode.h | |
361 | $(srcdir)/../../move-if-change tmp-idecode.c idecode.c | |
362 | $(srcdir)/../../move-if-change tmp-semantics.h semantics.h | |
363 | $(srcdir)/../../move-if-change tmp-semantics.c semantics.c | |
5b4d72dd MM |
364 | $(srcdir)/../../move-if-change tmp-itable.h itable.h |
365 | $(srcdir)/../../move-if-change tmp-itable.c itable.c | |
366 | touch tmp-igen | |
cb7a6892 | 367 | |
8e20a3ac MM |
368 | # NOTE: Some versions of make don't handle files created as side-effects |
369 | # uncomment the below if that is the case. | |
e61900e6 MM |
370 | |
371 | $(TARGETLIB): tmp-igen tmp-dgen | |
372 | itable.h itable.c icache.h idecode.h idecode.c semantics.h semantics.c: tmp-igen | |
373 | spreg.h spreg.c: tmp-dgen | |
cb7a6892 | 374 | |
c143ef62 | 375 | dgen: dgen.o table.o lf.o misc.o filter_filename.o |
ba62bb1c | 376 | $(CC_FOR_BUILD) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o dgen dgen.o table.o lf.o misc.o filter_filename.o $(LIBIBERTY_LIB) $(LIBS) |
cb7a6892 | 377 | |
c143ef62 | 378 | igen: igen.o table.o lf.o misc.o filter_filename.o |
ba62bb1c | 379 | $(CC_FOR_BUILD) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o igen igen.o table.o lf.o misc.o filter_filename.o $(LIBIBERTY_LIB) $(LIBS) |
64415b76 | 380 | |
c143ef62 MM |
381 | table.o: misc.h filter_filename.h lf.h table.h |
382 | lf.o: misc.h filter_filename.h lf.h | |
383 | dgen.o igen.o: misc.h filter_filename.h lf.h table.h | |
384 | misc.o: misc.h filter_filename.h | |
5b4d72dd | 385 | # With out this #, make thinks that misc.o doesn't have a rule |
cb7a6892 MM |
386 | |
387 | tags etags: TAGS | |
388 | ||
73c4941b | 389 | TAGS: $(BUILT_SRC) |
cb7a6892 MM |
390 | etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC) |
391 | ||
8b3797aa | 392 | clean mostlyclean: |
73c4941b | 393 | rm -f tmp-* *.[oasi] core psim run igen dgen config.log $(BUILT_SRC_WO_CONFIG) |
8b3797aa | 394 | |
8e20a3ac | 395 | distclean maintainer-clean realclean: clean |
c494cadd | 396 | rm -f TAGS Makefile config.cache config.status config.h stamp-h |
cb7a6892 | 397 | |
8b3797aa MM |
398 | Makefile: Makefile.in config.status |
399 | CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status | |
cb7a6892 | 400 | |
8b3797aa MM |
401 | config.h: stamp-h ; @true |
402 | stamp-h: config.in config.status | |
403 | CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status | |
cb7a6892 | 404 | |
bea95815 | 405 | config.status: configure |
cb7a6892 MM |
406 | $(SHELL) ./config.status --recheck |
407 | ||
408 | install: | |
4f965b81 MM |
409 | $(INSTALL_XFORM) run $(bindir)/run |
410 |