More changes for GO32 canadian cross builds
[deliverable/binutils-gdb.git] / sim / ppc / Makefile.in
CommitLineData
cb7a6892
MM
1#
2# This file is part of the program psim.
3#
d6103e8e 4# Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
cb7a6892
MM
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
21default: all
22
cb7a6892
MM
23VPATH = @srcdir@
24srcdir = @srcdir@
25srcroot = $(srcdir)/../..
26
27prefix = @prefix@
28exec_prefix = @exec_prefix@
29
30host_alias = @host_alias@
31target_alias = @target_alias@
32program_transform_name = @program_transform_name@
33bindir = $(exec_prefix)/bin
34libdir = $(exec_prefix)/lib
35tooldir = $(libdir)/$(target_alias)
36
37datadir = $(prefix)/lib
38mandir = $(prefix)/man
39man1dir = $(mandir)/man1
40man2dir = $(mandir)/man2
41man3dir = $(mandir)/man3
42man4dir = $(mandir)/man4
43man5dir = $(mandir)/man5
44man6dir = $(mandir)/man6
45man7dir = $(mandir)/man7
46man8dir = $(mandir)/man8
47man9dir = $(mandir)/man9
48infodir = $(prefix)/info
49includedir = $(prefix)/include
50docdir = $(datadir)/doc
51
52SHELL = /bin/sh
53
cb7a6892
MM
54INSTALL = $(srcroot)/install.sh -c
55INSTALL_PROGRAM = $(INSTALL)
56INSTALL_DATA = $(INSTALL)
57INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
58INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1
59
8b3797aa 60AR = @AR@
cb7a6892 61AR_FLAGS = rc
8b3797aa
MM
62CC = @CC@
63CFLAGS = @CFLAGS@
64CC_FOR_BUILD = @CC_FOR_BUILD@
cb7a6892
MM
65BISON = bison
66MAKEINFO = makeinfo
8b3797aa
MM
67RANLIB = @RANLIB@
68
c494cadd
MM
69SIM_CFLAGS = @sim_cflags@
70INLINE_CFLAGS = @sim_inline@
71BSWAP_CFLAGS = @sim_bswap@
72ENDIAN_CFLAGS = @sim_endian@
73HOSTENDIAN_CFLAGS = @sim_hostendian@
74SMP_CFLAGS = @sim_smp@
1dc7c0ed 75XOR_ENDIAN_CFLAGS = @sim_xor_endian@
c494cadd
MM
76BITSIZE_CFLAGS = @sim_bitsize@
77HOSTBITSIZE_CFLAGS = @sim_hostbitsize@
78ENV_CFLAGS = @sim_env@
79TIMEBASE_CFLAGS = @sim_timebase@
80ALIGNMENT_CFLAGS = @sim_alignment@
81FLOAT_CFLAGS = @sim_float@
82TRACE_CFLAGS = @sim_trace@
83ASSERT_CFLAGS = @sim_assert@
28816f45 84RESERVED_CFLAGS = @sim_reserved@
c494cadd 85MONITOR_CFLAGS = @sim_monitor@
979c3c25 86MODEL_CFLAGS = @sim_model@ @sim_default_model@ @sim_model_issue@
d6103e8e 87STDIO_CFLAGS = @sim_stdio@
73c4941b 88WARNING_CFLAGS = @sim_warnings@
c494cadd
MM
89CONFIG_CFLAGS = $(BSWAP_CFLAGS) \
90 $(ENDIAN_CFLAGS) \
91 $(HOSTENDIAN_CFLAGS) \
92 $(SMP_CFLAGS) \
1dc7c0ed 93 $(XOR_ENDIAN_CFLAGS) \
c494cadd
MM
94 $(BITSIZE_CFLAGS) \
95 $(HOSTBITSIZE_CFLAGS) \
96 $(ENV_CFLAGS) \
056e975c
MM
97 $(TIMEBASE_CFLAGS) \
98 $(ALIGNMENT_CFLAGS) \
c494cadd
MM
99 $(FLOAT_CFLAGS) \
100 $(TRACE_CFLAGS) \
101 $(ASSERT_CFLAGS) \
28816f45 102 $(RESERVED_CFLAGS) \
73c4941b 103 $(MONITOR_CFLAGS) \
d6103e8e
MM
104 $(MODEL_CFLAGS) \
105 $(STDIO_CFLAGS)
c494cadd 106
ba62bb1c
MM
107STD_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)
108NOWARN_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)
08dc78ad
MM
109BUILD_CFLAGS = -O $(INCLUDES)
110
111BUILD_LDFLAGS =
ba62bb1c 112
c494cadd
MM
113CONFIG_FILE = @sim_config@
114IGEN_OPCODE_RULES = @sim_opcode@
115IGEN_DUPLICATE = @sim_dup@
116IGEN_FILTER = @sim_filter@
117IGEN_ICACHE = @sim_icache@
118DGEN_FLAGS = @sim_switch@
119
8b3797aa
MM
120HDEFINES = @HDEFINES@
121TDEFINES =
a983c8f0 122IGEN_FLAGS = $(IGEN_DUPLICATE) $(IGEN_FILTER) $(IGEN_ICACHE)
cb7a6892
MM
123
124.NOEXPORT:
125MAKEOVERRIDES=
126
127LIB_INCLUDES = -I$(srcdir)/../../include
128BFD_INCLUDES = -I../../bfd -I$(srcdir)/../../bfd
129GDB_INCLUDES = -I../../gdb -I$(srcdir)/../../gdb -I$(srcdir)/../../gdb/config -I$(srcdir)/../../mmalloc
130INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES)
131
cb7a6892
MM
132LIBIBERTY_LIB = ../../libiberty/libiberty.a
133BFD_LIB = ../../bfd/libbfd.a
134
c143ef62 135TARGETLIB = libsim.a
cb7a6892 136
8e20a3ac 137all: run $(TARGETLIB) $(GDB_OBJ)
cb7a6892
MM
138
139.c.o:
ba62bb1c 140 $(CC) -c $(STD_CFLAGS) $<
cb7a6892
MM
141
142
143
144BASICS_H = \
979c3c25 145 basics.h \
cb7a6892 146 config.h \
8b3797aa 147 ppc-config.h \
979c3c25
MM
148 inline.h \
149 sim_callbacks.h \
150 debug.h filter_filename.h \
cb7a6892 151 words.h \
cb7a6892 152 bits.h \
979c3c25 153 sim-endian.h
cb7a6892
MM
154
155PSIM_H = \
156 psim.h \
157 $(BASICS_H)
158
159IDECODE_H = \
160 idecode.h \
cb7a6892
MM
161 idecode_expression.h \
162 idecode_branch.h \
163 idecode_fields.h \
164 icache.h
165
166REGISTERS_H = \
167 registers.h \
168 spreg.h
169
170CPU_H = \
171 cpu.h \
172 $(BASICS_H) \
173 $(REGISTERS_H) \
979c3c25 174 device.h \
01860b7e 175 corefile.h \
cb7a6892
MM
176 vm.h \
177 events.h \
178 interrupts.h \
179 psim.h \
5b4d72dd
MM
180 icache.h \
181 itable.h \
73c4941b 182 mon.h \
28816f45 183 model.h
5b4d72dd 184
979c3c25
MM
185DEVICE_TABLE_H = \
186 $(BASICS_H) \
187 device_table.h \
08dc78ad
MM
188 device.h \
189 hw.h
979c3c25 190
5b4d72dd
MM
191EMUL_GENERIC_H = \
192 $(CPU_H) \
193 $(IDECODE_H) \
194 emul_generic.h \
195 os_emul.h
cb7a6892
MM
196
197
198INLINE = \
199 inline.h \
200 inline.c
201
73c4941b 202BUILT_SRC_WO_CONFIG = \
cb7a6892
MM
203 icache.h \
204 idecode.h idecode.c \
205 semantics.h semantics.c \
5b4d72dd 206 itable.h itable.c \
28816f45 207 spreg.h spreg.c \
08dc78ad
MM
208 model.h model.c \
209 hw.h hw.c \
210 filter_host.c
73c4941b
MM
211
212BUILT_SRC = \
213 $(BUILT_SRC_WO_CONFIG) \
8b3797aa 214 config.h \
5b4d72dd 215 ppc-config.h
cb7a6892
MM
216
217LIB_SRC = \
218 psim.c \
219 bits.c \
cb7a6892 220 debug.c \
73c4941b
MM
221 sim-endian.c \
222 sim-endian.h \
223 sim-endian-n.h \
cb7a6892 224 vm.c \
73c4941b 225 vm_n.h \
01860b7e 226 corefile.c \
cb7a6892 227 events.c \
5b4d72dd
MM
228 os_emul.c \
229 emul_generic.c \
230 emul_netbsd.c \
979c3c25
MM
231 emul_chirp.c \
232 emul_bugapi.c \
cb7a6892
MM
233 registers.c \
234 cpu.c \
235 interrupts.c \
979c3c25
MM
236 device.c \
237 device_table.c \
238 cap.c \
c5addc19 239 mon.c \
08dc78ad
MM
240 options.c \
241 $(HW_SRC)
cb7a6892
MM
242
243MAIN_SRC = \
244 main.c \
245 sim_calls.c
246
247
5b4d72dd
MM
248# NOTE: semantics, idecode and psim put last so smaller files are compiled
249# first
cb7a6892
MM
250LIB_OBJ = \
251 debug.o \
c143ef62 252 filter_filename.o \
cb7a6892 253 bits.o \
73c4941b 254 sim-endian.o \
5b4d72dd
MM
255 os_emul.o \
256 emul_generic.o \
257 emul_netbsd.o \
979c3c25
MM
258 emul_chirp.o \
259 emul_bugapi.o \
cb7a6892 260 registers.o \
cb7a6892 261 vm.o \
01860b7e 262 corefile.o \
28816f45 263 model.o \
cb7a6892
MM
264 spreg.o \
265 cpu.o \
266 interrupts.o \
267 events.o \
979c3c25
MM
268 cap.o \
269 device.o \
270 device_table.o \
5b4d72dd
MM
271 itable.o \
272 mon.o \
cb7a6892
MM
273 semantics.o \
274 idecode.o \
979c3c25 275 psim.o \
08dc78ad
MM
276 options.o \
277 $(HW)
cb7a6892
MM
278
279
280GDB_OBJ = sim_calls.o
281
08dc78ad
MM
282HW_SRC = \
283 hw_cpu.c \
284 hw_memory.c \
285 hw_nvram.c \
286 hw_iobus.c \
287 hw_pal.c
288
289HW = \
290 hw_cpu.o \
291 hw_memory.o \
292 hw_nvram.o \
293 hw_iobus.o \
294 hw_pal.o
295
cb7a6892 296
8e20a3ac 297psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS)
ba62bb1c 298 $(CC) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o psim main.o $(TARGETLIB) $(BFD_LIB) $(LIBIBERTY_LIB) $(LIBS)
cb7a6892
MM
299
300run: psim
301 rm -f run
302 ln psim run
303
08dc78ad 304$(TARGETLIB): tmp-igen tmp-dgen $(HW) $(LIB_OBJ) $(GDB_OBJ)
cb7a6892
MM
305 rm -f $(TARGETLIB)
306 $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
307 $(RANLIB) $(TARGETLIB)
308
9f5912cb
MM
309# Given that inlines are turned on now, rebuild psim whenever
310# anything changes.
c143ef62 311psim.o: psim.c psim.h $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC)
cb7a6892 312
5b4d72dd 313bits.o: bits.c $(BASICS_H)
cb7a6892
MM
314
315debug.o: debug.c $(BASICS_H)
1dc7c0ed 316filter_filename.o: filter_filename.c filter_filename.h config.h ppc-config.h
cb7a6892 317
73c4941b 318sim-endian.o: sim-endian.c sim-endian-n.h $(BASICS_H)
cb7a6892 319
979c3c25 320os_emul.o: os_emul.c emul_netbsd.h emul_chirp.h emul_bugapi.h $(EMUL_GENERIC_H)
5b4d72dd 321emul_generic.o: emul_generic.c $(EMUL_GENERIC_H)
979c3c25 322
5b4d72dd 323emul_netbsd.o: emul_netbsd.c emul_netbsd.h $(EMUL_GENERIC_H)
d6103e8e 324emul_chirp.o: emul_chirp.c emul_chirp.h $(EMUL_GENERIC_H)
979c3c25 325emul_bugapi.o: emul_bugapi.c emul_bugapi.h $(EMUL_GENERIC_H)
cb7a6892
MM
326
327registers.o: registers.c $(REGISTERS_H) $(BASICS_H)
328
329cpu.o: cpu.c $(CPU_H) $(IDECODE_H)
330
5b4d72dd 331interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) os_emul.h
cb7a6892
MM
332
333idecode.o: idecode.c $(CPU_H) $(IDECODE_H) semantics.h
ba62bb1c 334 $(CC) -c $(NOWARN_CFLAGS) $<
cb7a6892 335
cb7a6892
MM
336# double.o: double.c dp-bit.c
337
8e20a3ac 338vm.o: vm.c vm.h vm_n.h $(BASICS_H) $(REGISTERS_H) \
979c3c25 339 device.h corefile.h interrupts.h itable.h mon.h
cb7a6892 340
08dc78ad 341corefile.o: corefile.c corefile.h corefile-n.h $(BASICS_H) $(DEVICE_TABLE_H)
73c4941b 342
28816f45
MM
343model.o: model.c $(CPU_H)
344
cb7a6892
MM
345events.o: events.c events.h $(BASICS_H)
346
979c3c25 347sim_calls.o: sim_calls.c $(PSIM_H) itable.h ../../gdb/tm.h options.h
cb7a6892 348
979c3c25 349spreg.o: spreg.h spreg.c $(BASICS_H)
cb7a6892 350
979c3c25 351main.o: main.c $(PSIM_H) itable.h options.h
cb7a6892 352
d6103e8e 353device.o: device.c $(DEVICE_TABLE_H) cap.h
cb7a6892 354
08dc78ad 355device_table.o: device_table.c $(DEVICE_TABLE_H) events.h hw.c
979c3c25
MM
356
357cap.o: cap.c cap.h $(BASICS_H)
cb7a6892
MM
358
359semantics.o: semantics.c semantics.h $(CPU_H) $(IDECODE_H)
ba62bb1c 360 $(CC) -c $(NOWARN_CFLAGS) $<
cb7a6892 361
5b4d72dd
MM
362itable.o: itable.c itable.h
363
73c4941b 364mon.o: mon.c $(CPU_H)
cb7a6892 365
ba62bb1c
MM
366# Rebuild options whenever something changes so the date/time is up to date.
367options.o: options.c $(BASICS_H) $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) config.status Makefile
368 $(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_opcode@"' '-DIGEN_FLAGS="$(IGEN_FLAGS)"' '-DDGEN_FLAGS="$(DGEN_FLAGS)"' $<
c5addc19 369
cb7a6892
MM
370#
371# Rules to create the built c source code files
372#
373
8b3797aa
MM
374ppc-config.h: $(CONFIG_FILE)
375 cp $(srcdir)/$(CONFIG_FILE) ppc-config.h
cb7a6892
MM
376
377
5b4d72dd
MM
378tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change
379 ./dgen $(DGEN_FLAGS) \
380 -r $(srcdir)/ppc-spr-table \
8e20a3ac 381 -n spreg.h -P tmp-spreg.h \
5b4d72dd
MM
382 -n spreg.c -p tmp-spreg.c
383 $(srcdir)/../../move-if-change tmp-spreg.h spreg.h
384 $(srcdir)/../../move-if-change tmp-spreg.c spreg.c
385 touch tmp-dgen
386
387
388tmp-igen: igen ppc-instructions $(IGEN_OPCODE_RULES) ppc-cache-rules $(srcdir)/../../move-if-change
389 ./igen $(IGEN_FLAGS) \
390 -o $(srcdir)/$(IGEN_OPCODE_RULES) \
391 -k $(srcdir)/ppc-cache-rules \
392 -i $(srcdir)/ppc-instructions \
8e20a3ac
MM
393 -n icache.h -C tmp-icache.h \
394 -n semantics.h -S tmp-semantics.h \
395 -n semantics.c -s tmp-semantics.c \
396 -n idecode.h -D tmp-idecode.h \
5b4d72dd
MM
397 -n idecode.c -d tmp-idecode.c \
398 -n itable.h -T tmp-itable.h \
28816f45
MM
399 -n itable.c -t tmp-itable.c \
400 -n model.h -M tmp-model.h \
401 -n model.c -m tmp-model.c
cb7a6892
MM
402 $(srcdir)/../../move-if-change tmp-icache.h icache.h
403 $(srcdir)/../../move-if-change tmp-idecode.h idecode.h
404 $(srcdir)/../../move-if-change tmp-idecode.c idecode.c
405 $(srcdir)/../../move-if-change tmp-semantics.h semantics.h
406 $(srcdir)/../../move-if-change tmp-semantics.c semantics.c
5b4d72dd
MM
407 $(srcdir)/../../move-if-change tmp-itable.h itable.h
408 $(srcdir)/../../move-if-change tmp-itable.c itable.c
28816f45
MM
409 $(srcdir)/../../move-if-change tmp-model.h model.h
410 $(srcdir)/../../move-if-change tmp-model.c model.c
5b4d72dd 411 touch tmp-igen
cb7a6892 412
8e20a3ac
MM
413# NOTE: Some versions of make don't handle files created as side-effects
414# uncomment the below if that is the case.
e61900e6
MM
415
416$(TARGETLIB): tmp-igen tmp-dgen
28816f45 417itable.h itable.c icache.h idecode.h idecode.c semantics.h semantics.c model.h model.c: tmp-igen
e61900e6 418spreg.h spreg.c: tmp-dgen
cb7a6892 419
08dc78ad
MM
420dgen: dgen.o table.o lf.o misc.o filter_host.o
421 $(CC_FOR_BUILD) $(BUILD_CFLAGS) -o dgen dgen.o table.o lf.o misc.o filter_host.o $(LIBIBERTY_LIB) $(LIBS)
422
423igen: igen.o table.o lf.o misc.o filter_host.o
424 $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o igen igen.o table.o lf.o misc.o filter_host.o $(LIBIBERTY_LIB) $(LIBS)
425
426filter_host.c: filter_filename.c
427 cat $(srcdir)/filter_filename.c > filter_host.c
428
429filter_host.o: filter_host.c filter_filename.h config.h ppc-config.h
430 $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c filter_host.c
cb7a6892 431
08dc78ad
MM
432table.o: table.c misc.h filter_filename.h lf.h table.h
433 $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/table.c
434
435lf.o: lf.c misc.h filter_filename.h lf.h
436 $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/lf.c
437
438dgen.o: dgen.c misc.h filter_filename.h lf.h table.h
439 $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/dgen.c
440
441igen.o: igen.c misc.h filter_filename.h lf.h table.h
442 $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/igen.c
64415b76 443
c143ef62 444misc.o: misc.h filter_filename.h
08dc78ad
MM
445 $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/misc.c
446
5b4d72dd 447# With out this #, make thinks that misc.o doesn't have a rule
cb7a6892 448
08dc78ad
MM
449# real hardware
450hw.h:
451 (cd $(srcdir); ls $(HW_SRC)) \
452 | sed -e 's/^.*\(hw_.*\)\.c/\1/' \
453 -e 's/^/extern const device_descriptor /' \
454 -e 's/$$/_device_descriptor\[\];/' \
455 > tmp-hw.h
456 mv tmp-hw.h hw.h
457hw.c:
458 (cd $(srcdir); ls $(HW_SRC)) \
459 | sed -e 's/^.*\(hw_.*\)\.c/\1/' \
460 -e 's/^/ /' \
461 -e 's/$$/_device_descriptor,/' \
462 > tmp-hw.c
463 mv tmp-hw.c hw.c
464hw_cpu.o: hw_cpu.c $(DEVICE_TABLE_H)
465hw_memory.o: hw_memory.c $(DEVICE_TABLE_H)
466hw_nvram.o: hw_nvram.c $(DEVICE_TABLE_H)
467hw_iobus.o: hw_iobus.c $(DEVICE_TABLE_H)
468hw_pal.o: hw_pal.c $(DEVICE_TABLE_H)
469# ignore this line, it stops make from getting confused
470
471
cb7a6892
MM
472tags etags: TAGS
473
73c4941b 474TAGS: $(BUILT_SRC)
cb7a6892
MM
475 etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC)
476
8b3797aa 477clean mostlyclean:
73c4941b 478 rm -f tmp-* *.[oasi] core psim run igen dgen config.log $(BUILT_SRC_WO_CONFIG)
8b3797aa 479
979c3c25 480distclean realclean: clean
c494cadd 481 rm -f TAGS Makefile config.cache config.status config.h stamp-h
cb7a6892 482
979c3c25 483maintainer-clean: distclean
52edddb9 484 rm -f *~ *.log ppc-config.h core *.core
979c3c25 485
8b3797aa
MM
486Makefile: Makefile.in config.status
487 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
cb7a6892 488
8b3797aa
MM
489config.h: stamp-h ; @true
490stamp-h: config.in config.status
491 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
cb7a6892 492
bea95815 493config.status: configure
cb7a6892
MM
494 $(SHELL) ./config.status --recheck
495
496install:
4f965b81
MM
497 $(INSTALL_XFORM) run $(bindir)/run
498
This page took 0.068287 seconds and 4 git commands to generate.