*** empty log message ***
[external/binutils.git] / sim / ppc / Makefile.in
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
21 default: all
22
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
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
60 AR = @AR@
61 AR_FLAGS = rc
62 CC = @CC@
63 CFLAGS = @CFLAGS@
64 CC_FOR_BUILD = @CC_FOR_BUILD@
65 BISON = bison
66 MAKEINFO = makeinfo
67 RANLIB = @RANLIB@
68
69 HDEFINES = @HDEFINES@
70 TDEFINES =
71
72 .NOEXPORT:
73 MAKEOVERRIDES=
74
75 LIB_INCLUDES    = -I$(srcdir)/../../include
76 BFD_INCLUDES    = -I../../bfd -I$(srcdir)/../../bfd
77 GDB_INCLUDES    = -I../../gdb -I$(srcdir)/../../gdb  -I$(srcdir)/../../gdb/config -I$(srcdir)/../../mmalloc
78 INCLUDES        = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES)
79
80 CONFIG_FILE     = std-config.h
81
82 # See inline.h for appropriate flags to set
83 INLINE_CFLAGS   = -DDEFAULT_INLINE=2
84
85 LIBIBERTY_LIB   = ../../libiberty/libiberty.a
86 BFD_LIB         = ../../bfd/libbfd.a
87
88 TARGETLIB = libsim.a
89
90 all:    run $(TARGETLIB) $(GDB_OBJ)
91
92 .c.o:
93         $(CC) -c $(CFLAGS) $(INLINE_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $<
94
95
96
97 BASICS_H = \
98         config.h \
99         ppc-config.h \
100         words.h \
101         ppc-endian.h \
102         debug.h \
103         bits.h \
104         sim_callbacks.h
105
106 PSIM_H = \
107         psim.h \
108         $(BASICS_H)
109
110 IDECODE_H = \
111         idecode.h \
112         idecode_expression.h \
113         idecode_branch.h \
114         idecode_fields.h \
115         icache.h
116
117 REGISTERS_H = \
118         registers.h \
119         spreg.h
120
121 CPU_H = \
122         cpu.h \
123         $(BASICS_H) \
124         $(REGISTERS_H) \
125         device_tree.h \
126         core.h \
127         vm.h \
128         events.h \
129         interrupts.h \
130         psim.h \
131         icache.h
132
133
134 INLINE = \
135         inline.h \
136         inline.c
137
138 BUILT_SRC = \
139         icache.h \
140         idecode.h idecode.c \
141         semantics.h semantics.c \
142         spreg.h spreg.c \
143         config.h \
144         ppc-config.h
145
146 LIB_SRC = \
147         psim.c \
148         bits.c \
149         ppc-endian.c \
150         debug.c \
151         vm.c \
152         core.c \
153         events.c \
154         system.c \
155         registers.c \
156         cpu.c \
157         interrupts.c \
158         devices.c \
159         device_tree.c
160
161 MAIN_SRC = \
162         main.c \
163         sim_calls.c
164
165
166 LIB_OBJ = \
167         debug.o \
168         bits.o \
169         ppc-endian.o \
170         system.o \
171         registers.o \
172         vm.o \
173         core.o \
174         spreg.o \
175         cpu.o \
176         interrupts.o \
177         events.o \
178         devices.o \
179         device_tree.o \
180         semantics.o \
181         idecode.o \
182         psim.o
183
184
185 GDB_OBJ = sim_calls.o 
186
187
188 psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS)
189         $(CC) $(CFLAGS) $(LDFLAGS) -o psim main.o $(TARGETLIB) $(BFD_LIB) $(LIBIBERTY_LIB) $(LIBS)
190
191 run: psim
192         rm -f run
193         ln psim run
194
195 $(TARGETLIB): tmp-gencode $(LIB_OBJ) $(GDB_OBJ)
196         rm -f $(TARGETLIB)
197         $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
198         $(RANLIB) $(TARGETLIB)
199
200 # Given that inlines are turned on now, rebuild psim whenever
201 # anything changes.
202 psim.o: psim.c psim.h $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC)
203
204 bits.o: bits.c bits.h
205
206 debug.o: debug.c $(BASICS_H)
207
208 ppc-endian.o: ppc-endian.c ppc-endian.h \
209         config.h ppc-config.h words.h sim_callbacks.h
210
211 system.o: system.c system.h $(CPU_H) $(IDECODE_H)
212
213 registers.o: registers.c $(REGISTERS_H) $(BASICS_H) 
214
215 cpu.o: cpu.c $(CPU_H) $(IDECODE_H)
216
217 interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) system.h
218
219 idecode.o: idecode.c $(CPU_H) $(IDECODE_H) semantics.h
220
221 # double.o: double.c dp-bit.c
222
223 vm.o: vm.c vm.h vm_n.h $(BASICS_H) $(REGISTERS_H) \
224         device_tree.h core.h interrupts.h
225
226 core.o: core.c core.h $(BASICS_H) device_tree.h
227
228 events.o: events.c events.h $(BASICS_H) 
229
230 sim_calls.o: sim_calls.c $(PSIM_H) ../../gdb/tm.h devices.h
231
232 spreg.o: spreg.h spreg.c words.h
233
234 main.o: main.c $(PSIM_H)
235
236 devices.o: devices.c devices.h $(BASICS_H) \
237         device_tree.h events.h
238
239 device_tree.o: device_tree.c device_tree.h devices.h $(BASICS_H)
240
241 semantics.o: semantics.c semantics.h $(CPU_H) $(IDECODE_H)
242
243
244 #
245 # Rules to create the built c source code files
246 #
247
248 ppc-config.h: $(CONFIG_FILE)
249         cp $(srcdir)/$(CONFIG_FILE) ppc-config.h
250
251
252 tmp-gencode: gen ppc-instructions ppc-spr-table $(srcdir)/../../move-if-change
253         ./gen   -r $(srcdir)/ppc-spr-table \
254                 -i $(srcdir)/ppc-instructions \
255                 -n spreg.h     -P tmp-spreg.h \
256                 -n spreg.c     -p tmp-spreg.c \
257                 -n icache.h    -C tmp-icache.h \
258                 -n semantics.h -S tmp-semantics.h \
259                 -n semantics.c -s tmp-semantics.c \
260                 -n idecode.h   -D tmp-idecode.h \
261                 -n idecode.c   -d tmp-idecode.c
262         $(srcdir)/../../move-if-change tmp-icache.h icache.h
263         $(srcdir)/../../move-if-change tmp-idecode.h idecode.h
264         $(srcdir)/../../move-if-change tmp-idecode.c idecode.c
265         $(srcdir)/../../move-if-change tmp-semantics.h semantics.h
266         $(srcdir)/../../move-if-change tmp-semantics.c semantics.c
267         $(srcdir)/../../move-if-change tmp-spreg.h spreg.h
268         $(srcdir)/../../move-if-change tmp-spreg.c spreg.c
269         touch tmp-gencode
270
271 # NOTE: Some versions of make don't handle files created as side-effects
272 # uncomment the below if that is the case.
273 #
274 # $(TARGETLIB): tmp-gencode
275 # icache.h idecode.h idecode.c semantics.h semantics.c spreg.h spreg.c: tmp-gencode
276
277 gen.o: gen.c config.h ppc-config.h
278         $(CC_FOR_BUILD) -c $(CFLAGS) $(INLINE_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $(srcdir)/gen.c
279
280 gen: gen.o config.h ppc-config.h $(LIBIBERTY_LIB) $(LIBS)
281         $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o gen gen.o $(LIBIBERTY_LIB) $(LIBS)
282
283 #
284
285 tags etags: TAGS
286
287 TAGS: tmp-gencode config.h ppc-config.h
288         etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC)
289
290 clean mostlyclean:
291         rm -f tmp-* *.[oas] core psim run gen config.log
292         rm -f icache.h idecode.h idecode.c semantics.h semantics.c spreg.h spreg.c ppc-config.h
293
294 distclean maintainer-clean realclean: clean
295         rm -f TAGS $(BUILT_SRC) Makefile config.cache config.status config.h stamp-h
296
297 Makefile: Makefile.in config.status
298         CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
299
300 config.h: stamp-h ; @true
301 stamp-h: config.in config.status
302         CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
303
304 config.status: configure
305         $(SHELL) ./config.status --recheck
306
307 install:
308         $(INSTALL_XFORM) run $(bindir)/run
309