Commit | Line | Data |
---|---|---|
f2de7dfd AC |
1 | # Makefile fragment for common parts of all simulators. |
2 | # Copyright (C) 1997 Free Software Foundation, Inc. | |
3 | # Contributed by Cygnus Support. | |
4 | ||
5 | # This program is free software; you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation; either version 2 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program; if not, write to the Free Software | |
17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
18 | ||
19 | # This Makefile fragment consists of two separate parts. | |
20 | # They are merged into the final Makefile at points denoted by | |
21 | # "## COMMON_PRE_CONFIG_FRAG" and "## COMMON_POST_CONFIG_FRAG". | |
22 | # | |
23 | # The target Makefile should look like: | |
24 | # | |
25 | #># Copyright blah blah | |
26 | #> | |
27 | #>## COMMON_PRE_CONFIG_FRAG | |
28 | #> | |
29 | #># Any overrides necessary for the SIM_FOO config vars. | |
30 | #>SIM_FOO = ... | |
31 | #> | |
32 | #>## COMMON_POST_CONFIG_FRAG | |
33 | #> | |
34 | #># Rules to build target specific .o's. | |
35 | ||
36 | ## COMMON_PRE_CONFIG_FRAG | |
37 | ||
38 | VPATH = @srcdir@ | |
39 | srcdir = @srcdir@ | |
40 | srcroot = $(srcdir)/../.. | |
41 | ||
42 | prefix = @prefix@ | |
43 | exec_prefix = @exec_prefix@ | |
44 | ||
45 | host_alias = @host_alias@ | |
46 | target_alias = @target_alias@ | |
47 | program_transform_name = @program_transform_name@ | |
48 | bindir = @bindir@ | |
49 | ||
50 | libdir = @libdir@ | |
51 | tooldir = $(libdir)/$(target_alias) | |
52 | ||
53 | datadir = @datadir@ | |
54 | mandir = @mandir@ | |
55 | man1dir = $(mandir)/man1 | |
56 | infodir = @infodir@ | |
57 | includedir = @includedir@ | |
58 | ||
59 | SHELL = /bin/sh | |
60 | ||
61 | INSTALL = $(srcroot)/install.sh -c | |
62 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
63 | INSTALL_DATA = @INSTALL_DATA@ | |
64 | INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)' | |
65 | INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1 | |
66 | ||
67 | CC = @CC@ | |
68 | CC_FOR_BUILD = @CC_FOR_BUILD@ | |
69 | CFLAGS = @CFLAGS@ | |
70 | SIM_BSWAP = @sim_bswap@ | |
71 | SIM_CFLAGS = @sim_cflags@ | |
72 | SIM_DEBUG = @sim_debug@ | |
73 | SIM_ENDIAN = @sim_endian@ | |
74 | SIM_HOSTENDIAN = @sim_hostendian@ | |
75 | SIM_INLINE = @sim_inline@ | |
76 | SIM_TRACE = @sim_trace@ | |
77 | SIM_WARNINGS = @sim_warnings@ | |
78 | ||
79 | HDEFINES = @HDEFINES@ | |
80 | TDEFINES = | |
81 | ||
82 | AR = @AR@ | |
83 | AR_FLAGS = rc | |
84 | RANLIB = @RANLIB@ | |
85 | MAKEINFO = makeinfo | |
86 | ||
87 | # Each simulator's Makefile.in defines one or more of these variables | |
88 | # to override our settings as necessary. | |
89 | ||
90 | # List of object files, less common parts. | |
91 | SIM_OBJS = | |
92 | # List of flags to always pass to $(CC). | |
93 | SIM_EXTRA_CFLAGS = | |
94 | # List of extra libraries to link with. | |
95 | SIM_EXTRA_LIBS = | |
96 | # List of extra program dependencies. | |
97 | SIM_EXTRA_LIBDEPS = | |
98 | # List of main object files for `run'. | |
99 | SIM_RUN_OBJS = run.o | |
100 | # Dependency of `all' to build any extra files. | |
101 | SIM_EXTRA_ALL = | |
102 | # Dependency of `install' to install any extra files. | |
103 | SIM_EXTRA_INSTALL = | |
104 | # Dependency of `clean' to clean any extra files. | |
105 | SIM_EXTRA_CLEAN = | |
106 | ||
107 | ## End COMMON_PRE_CONFIG_FRAG | |
108 | ||
109 | ## COMMON_POST_CONFIG_FRAG | |
110 | ||
111 | CONFIG_CFLAGS = @DEFS@ $(SIM_CFLAGS) $(SIM_DEBUG) $(SIM_TRACE) $(SIM_BSWAP) \ | |
112 | $(SIM_HOSTENDIAN) $(SIM_ENDIAN) $(SIM_INLINE) $(SIM_WARNINGS) \ | |
113 | $(SIM_EXTRA_CFLAGS) $(HDEFINES) $(TDEFINES) | |
114 | CSEARCH = -I. -I$(srcdir) -I../common -I$(srcdir)/../common \ | |
115 | -I../../include -I$(srcroot)/include \ | |
116 | -I../../bfd -I$(srcroot)/bfd -I$(srcroot)/gdb \ | |
117 | -I../../opcodes -I$(srcroot)/opcodes | |
118 | ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(CFLAGS) | |
119 | BUILD_CFLAGS = -g -O $(CSEARCH) | |
120 | ||
121 | LIBIBERTY_LIB = ../../libiberty/libiberty.a | |
122 | BFD_LIB = ../../bfd/libbfd.a | |
123 | OPCODES_LIB = ../../opcodes/libopcodes.a | |
124 | CONFIG_LIBS = @LIBS@ | |
125 | LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBIBERTY_LIB) \ | |
126 | $(SIM_EXTRA_LIBDEPS) | |
127 | EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBIBERTY_LIB) \ | |
128 | $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) | |
129 | ||
130 | LIB_OBJS = callback.o targ-map.o $(SIM_OBJS) | |
131 | ||
132 | all: libsim.a run $(SIM_EXTRA_ALL) | |
133 | ||
134 | libsim.a: $(LIB_OBJS) | |
135 | rm -f libsim.a | |
136 | $(AR) $(ARFLAGS) libsim.a $(LIB_OBJS) | |
137 | $(RANLIB) libsim.a | |
138 | ||
139 | run: $(SIM_RUN_OBJS) libsim.a $(LIBDEPS) | |
140 | $(CC) $(ALL_CFLAGS) -o run \ | |
141 | $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS) | |
142 | ||
143 | run.o: $(srcdir)/../common/run.c config.h tconfig.h \ | |
144 | $(srcroot)/include/callback.h | |
145 | $(CC) -c $(srcdir)/../common/run.c $(ALL_CFLAGS) | |
146 | ||
147 | # FIXME: Ideally, callback.o and friends live in a library outside of | |
148 | # both the gdb and simulator source trees (e.g. devo/remote. Not | |
149 | # devo/libremote because this directory would contain more than just | |
150 | # a library). | |
151 | ||
152 | callback.o: $(srcdir)/../common/callback.c config.h tconfig.h \ | |
153 | $(srcroot)/include/callback.h targ-vals.h | |
154 | $(CC) -c $(srcdir)/../common/callback.c $(ALL_CFLAGS) | |
155 | ||
156 | targ-map.o: targ-map.c targ-vals.h | |
157 | ||
158 | gentmap: Makefile $(srcdir)/../common/gentmap.c targ-vals.def | |
159 | $(CC_FOR_BUILD) $(srcdir)/../common/gentmap.c -o gentmap $(BUILD_CFLAGS) | |
160 | ||
161 | targ-vals.h: gentmap | |
162 | rm -f targ-vals.h | |
163 | ./gentmap -h >targ-vals.h | |
164 | ||
165 | targ-map.c: gentmap | |
166 | rm -f targ-map.c | |
167 | ./gentmap -c >targ-map.c | |
168 | ||
169 | install: install-common $(SIM_EXTRA_INSTALL) | |
170 | ||
171 | install-common: | |
172 | $(INSTALL_XFORM) run $(bindir)/run | |
173 | ||
174 | check: | |
175 | ||
176 | info: | |
177 | clean-info: | |
178 | install-info: | |
179 | ||
180 | .NOEXPORT: | |
181 | MAKEOVERRIDES= | |
182 | ||
183 | tags etags: TAGS | |
184 | ||
185 | TAGS: force | |
186 | etags *.c *.h | |
187 | ||
188 | clean: $(SIM_EXTRA_CLEAN) | |
189 | rm -f *.[oa] *~ core | |
190 | rm -f run libsim.a | |
191 | rm -f gentmap targ-map.c targ-vals.h | |
192 | ||
193 | distclean mostlyclean maintainer-clean realclean: clean | |
194 | rm -f TAGS | |
195 | rm -f Makefile config.cache config.log config.status | |
196 | rm -f tconfig.h config.h stamp-h | |
197 | ||
198 | .c.o: | |
199 | $(CC) -c $(ALL_CFLAGS) $< | |
200 | ||
201 | # Dummy target to force execution of dependent targets. | |
202 | force: | |
203 | ||
204 | Makefile: Makefile.in $(srcdir)/../common/Make-common.in config.status | |
205 | CONFIG_HEADERS= $(SHELL) ./config.status | |
206 | ||
207 | config.status: configure | |
208 | $(SHELL) ./config.status --recheck | |
209 | ||
210 | config.h: stamp-h ; @true | |
211 | stamp-h: config.in config.status | |
212 | CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status | |
213 | ||
214 | ## End COMMON_POST_CONFIG_FRAG |