1# Makefile template for Configure for the IQ2000 simulator
2# Copyright (C) 1998, 2007, 2008, 2009, 2010, 2011
3# Free Software Foundation, Inc.
4# Contributed by Cygnus Support.
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 3 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, see <http://www.gnu.org/licenses/>.
18
19## COMMON_PRE_CONFIG_FRAG
20
21IQ2000_OBJS = iq2000.o cpu.o decode.o sem.o model.o mloop.o
22
23CONFIG_DEVICES = dv-sockser.o
24CONFIG_DEVICES =
25
26SIM_OBJS = \
27	$(SIM_NEW_COMMON_OBJS) \
28	sim-cpu.o \
29	sim-hload.o \
30	sim-hrw.o \
31	sim-model.o \
32	sim-reg.o \
33	cgen-utils.o cgen-trace.o cgen-scache.o \
34	cgen-run.o sim-reason.o sim-engine.o sim-stop.o \
35	sim-if.o arch.o \
36	$(IQ2000_OBJS) \
37	$(CONFIG_DEVICES)
38
39# Extra headers included by sim-main.h.
40SIM_EXTRA_DEPS = \
41	$(CGEN_INCLUDE_DEPS) \
42	arch.h cpuall.h iq2000-sim.h $(srcdir)/../../opcodes/iq2000-desc.h
43
44SIM_EXTRA_CFLAGS =
45
46ALL_CPU_CFLAGS = -DHAVE_CPU_IQ2000BF -DHAVE_CPU_IQ10BF
47
48SIM_RUN_OBJS = nrun.o
49SIM_EXTRA_CLEAN = iq2000-clean
50
51## COMMON_POST_CONFIG_FRAG
52
53arch = iq2000
54
55sim-if.o: $(srcdir)/sim-if.c $(SIM_MAIN_DEPS) $(srcdir)/../common/sim-core.h
56
57arch.o: arch.c $(SIM_MAIN_DEPS)
58	$(CC) -c $(srcdir)/arch.c $(ALL_CFLAGS) -UHAVE_CPU_IQ10BF
59
60devices.o: $(srcdir)/devices.c $(SIM_MAIN_DEPS)
61
62# IQ2000 objs
63
64IQ2000BF_INCLUDE_DEPS = \
65	$(CGEN_MAIN_CPU_DEPS) \
66	cpu.h decode.h eng.h
67
68iq2000.o: $(srcdir)/iq2000.c $(IQ2000BF_INCLUDE_DEPS)
69
70# FIXME: Use of `mono' is wip.
71mloop.c eng.h: stamp-mloop
72stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
73	$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
74		-mono -fast -pbb -switch sem-switch.c \
75		-cpu iq2000bf -infile $(srcdir)/mloop.in
76	$(SHELL) $(srcroot)/move-if-change eng.hin eng.h
77	$(SHELL) $(srcroot)/move-if-change mloop.cin mloop.c
78	touch stamp-mloop
79mloop.o: mloop.c $(srcdir)/sem-switch.c $(IQ2000BF_INCLUDE_DEPS)
80
81cpu.o: $(srcdir)/cpu.c $(IQ2000BF_INCLUDE_DEPS)
82decode.o: $(srcdir)/decode.c $(IQ2000BF_INCLUDE_DEPS)
83sem.o: $(srcdir)/sem.c $(IQ2000BF_INCLUDE_DEPS)
84model.o: $(srcdir)/model.c $(IQ2000BF_INCLUDE_DEPS)
85
86iq2000-clean:
87	rm -f mloop.c eng.h stamp-mloop
88	rm -f tmp-*
89	rm -f stamp-arch stamp-cpu
90
91# cgen support, enable with --enable-cgen-maint
92CGEN_MAINT = ; @true
93# The following line is commented in or out depending upon --enable-cgen-maint.
94@CGEN_MAINT@CGEN_MAINT =
95
96stamp-arch: $(CGEN_READ_SCM) $(CGEN_ARCH_SCM) $(CPU_DIR)/iq2000.cpu Makefile
97	$(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) mach=iq2000 \
98	  archfile=$(CPU_DIR)/iq2000.cpu \
99	  FLAGS="with-scache with-profile=fn"
100	touch stamp-arch
101arch.h arch.c cpuall.h: $(CGEN_MAINT) stamp-arch
102	@true
103
104stamp-cpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(CPU_DIR)/iq2000.cpu Makefile
105	$(MAKE) cgen-cpu-decode $(CGEN_FLAGS_TO_PASS) \
106	  cpu=iq2000bf mach=iq2000 \
107	  archfile=$(CPU_DIR)/iq2000.cpu \
108	  FLAGS="with-scache with-profile=fn" \
109	  EXTRAFILES="$(CGEN_CPU_SEM) $(CGEN_CPU_SEMSW)"
110	touch stamp-cpu
111cpu.h sem.c sem-switch.c model.c decode.c decode.h: $(CGEN_MAINT) stamp-cpu
112	@true
113