2 # This file is part of the program psim.
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.
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.
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.
25 srcroot = $(srcdir)/../..
28 exec_prefix = @exec_prefix@
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)
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
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
64 CC_FOR_BUILD = @CC_FOR_BUILD@
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 FUNC_CFLAGS = @sim_func@
85 MODEL_CFLAGS = @sim_model@ @sim_default_model@
86 WARNING_CFLAGS = @sim_warnings@
87 CONFIG_CFLAGS = $(BSWAP_CFLAGS) \
89 $(HOSTENDIAN_CFLAGS) \
92 $(HOSTBITSIZE_CFLAGS) \
103 CONFIG_FILE = @sim_config@
104 IGEN_OPCODE_RULES = @sim_opcode@
105 IGEN_DUPLICATE = @sim_dup@
106 IGEN_FILTER = @sim_filter@
107 IGEN_ICACHE = @sim_icache@
108 DGEN_FLAGS = @sim_switch@
110 HDEFINES = @HDEFINES@
112 IGEN_FLAGS = $(IGEN_DUPLICATE) $(IGEN_FILTER) $(IGEN_ICACHE)
117 LIB_INCLUDES = -I$(srcdir)/../../include
118 BFD_INCLUDES = -I../../bfd -I$(srcdir)/../../bfd
119 GDB_INCLUDES = -I../../gdb -I$(srcdir)/../../gdb -I$(srcdir)/../../gdb/config -I$(srcdir)/../../mmalloc
120 INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES)
122 LIBIBERTY_LIB = ../../libiberty/libiberty.a
123 BFD_LIB = ../../bfd/libbfd.a
127 all: run $(TARGETLIB) $(GDB_OBJ)
130 $(CC) -c $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $<
150 idecode_expression.h \
185 BUILT_SRC_WO_CONFIG = \
187 idecode.h idecode.c \
188 semantics.h semantics.c \
193 $(BUILT_SRC_WO_CONFIG) \
224 # NOTE: semantics, idecode and psim put last so smaller files are compiled
251 GDB_OBJ = sim_calls.o
254 psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS)
255 $(CC) $(CFLAGS) $(LDFLAGS) -o psim main.o $(TARGETLIB) $(BFD_LIB) $(LIBIBERTY_LIB) $(LIBS)
261 $(TARGETLIB): tmp-igen tmp-dgen $(LIB_OBJ) $(GDB_OBJ)
263 $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
264 $(RANLIB) $(TARGETLIB)
266 # Given that inlines are turned on now, rebuild psim whenever
268 psim.o: psim.c psim.h $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC)
270 bits.o: bits.c $(BASICS_H)
272 debug.o: debug.c $(BASICS_H)
273 filter_filename.o: filter_filename.c config.h ppc-config.h
275 sim-endian.o: sim-endian.c sim-endian-n.h $(BASICS_H)
277 os_emul.o: os_emul.c $(EMUL_GENERIC_H)
278 emul_generic.o: emul_generic.c $(EMUL_GENERIC_H)
279 emul_netbsd.o: emul_netbsd.c emul_netbsd.h $(EMUL_GENERIC_H)
281 registers.o: registers.c $(REGISTERS_H) $(BASICS_H)
283 cpu.o: cpu.c $(CPU_H) $(IDECODE_H)
285 interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) os_emul.h
287 idecode.o: idecode.c $(CPU_H) $(IDECODE_H) semantics.h
288 $(CC) -c $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $<
290 # double.o: double.c dp-bit.c
292 vm.o: vm.c vm.h vm_n.h $(BASICS_H) $(REGISTERS_H) \
293 device_tree.h corefile.h interrupts.h itable.h mon.h
295 corefile.o: corefile.c corefile.h $(BASICS_H) device_tree.h
297 function_unit.o: function_unit.c $(CPU_H)
299 events.o: events.c events.h $(BASICS_H)
301 sim_calls.o: sim_calls.c $(PSIM_H) function_unit.h itable.h ../../gdb/tm.h devices.h
303 spreg.o: spreg.h spreg.c words.h
305 main.o: main.c $(PSIM_H) function_unit.h itable.h
307 devices.o: devices.c devices.h $(BASICS_H) \
308 device_tree.h events.h
310 device_tree.o: device_tree.c device_tree.h devices.h $(BASICS_H)
312 semantics.o: semantics.c semantics.h $(CPU_H) $(IDECODE_H)
313 $(CC) -c $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $<
315 itable.o: itable.c itable.h
317 mon.o: mon.c $(CPU_H)
320 # Rules to create the built c source code files
323 ppc-config.h: $(CONFIG_FILE)
324 cp $(srcdir)/$(CONFIG_FILE) ppc-config.h
327 tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change
328 ./dgen $(DGEN_FLAGS) \
329 -r $(srcdir)/ppc-spr-table \
330 -n spreg.h -P tmp-spreg.h \
331 -n spreg.c -p tmp-spreg.c
332 $(srcdir)/../../move-if-change tmp-spreg.h spreg.h
333 $(srcdir)/../../move-if-change tmp-spreg.c spreg.c
337 tmp-igen: igen ppc-instructions $(IGEN_OPCODE_RULES) ppc-cache-rules $(srcdir)/../../move-if-change
338 ./igen $(IGEN_FLAGS) \
339 -o $(srcdir)/$(IGEN_OPCODE_RULES) \
340 -k $(srcdir)/ppc-cache-rules \
341 -i $(srcdir)/ppc-instructions \
342 -n icache.h -C tmp-icache.h \
343 -n semantics.h -S tmp-semantics.h \
344 -n semantics.c -s tmp-semantics.c \
345 -n idecode.h -D tmp-idecode.h \
346 -n idecode.c -d tmp-idecode.c \
347 -n itable.h -T tmp-itable.h \
348 -n itable.c -t tmp-itable.c
349 $(srcdir)/../../move-if-change tmp-icache.h icache.h
350 $(srcdir)/../../move-if-change tmp-idecode.h idecode.h
351 $(srcdir)/../../move-if-change tmp-idecode.c idecode.c
352 $(srcdir)/../../move-if-change tmp-semantics.h semantics.h
353 $(srcdir)/../../move-if-change tmp-semantics.c semantics.c
354 $(srcdir)/../../move-if-change tmp-itable.h itable.h
355 $(srcdir)/../../move-if-change tmp-itable.c itable.c
358 # NOTE: Some versions of make don't handle files created as side-effects
359 # uncomment the below if that is the case.
361 $(TARGETLIB): tmp-igen tmp-dgen
362 itable.h itable.c icache.h idecode.h idecode.c semantics.h semantics.c: tmp-igen
363 spreg.h spreg.c: tmp-dgen
365 dgen: dgen.o table.o lf.o misc.o filter_filename.o
366 $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o dgen dgen.o table.o lf.o misc.o filter_filename.o $(LIBIBERTY_LIB) $(LIBS)
368 igen: igen.o table.o lf.o misc.o filter_filename.o
369 $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o igen igen.o table.o lf.o misc.o filter_filename.o $(LIBIBERTY_LIB) $(LIBS)
371 table.o: misc.h filter_filename.h lf.h table.h
372 lf.o: misc.h filter_filename.h lf.h
373 dgen.o igen.o: misc.h filter_filename.h lf.h table.h
374 misc.o: misc.h filter_filename.h
375 # With out this #, make thinks that misc.o doesn't have a rule
380 etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC)
383 rm -f tmp-* *.[oasi] core psim run igen dgen config.log $(BUILT_SRC_WO_CONFIG)
385 distclean maintainer-clean realclean: clean
386 rm -f TAGS Makefile config.cache config.status config.h stamp-h
388 Makefile: Makefile.in config.status
389 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
391 config.h: stamp-h ; @true
392 stamp-h: config.in config.status
393 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
395 config.status: configure
396 $(SHELL) ./config.status --recheck
399 $(INSTALL_XFORM) run $(bindir)/run