* aclocal.m4: Remove Make-common.in from dependencies.
[deliverable/binutils-gdb.git] / sim / common / aclocal.m4
1 # This file contains common code used by all simulators.
2 # SIM_AC_COMMON invokes AC macros used by all simulators and by the
3 # common directory.
4 # SIM_AC_OUTPUT is a cover function to AC_OUTPUT to use generate the
5 # Makefile in a target specific directory.
6
7 AC_DEFUN(SIM_AC_COMMON,
8 [
9 # autoconf.info says this should be called right after AC_INIT.
10 AC_CONFIG_HEADER(config.h:config.in)
11
12 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
13 AC_CANONICAL_SYSTEM
14 AC_ARG_PROGRAM
15 AC_PROG_CC
16 AC_PROG_INSTALL
17 AC_C_BIGENDIAN
18
19 # Put a plausible default for CC_FOR_BUILD in Makefile.
20 AC_C_CROSS
21 if test "x$cross_compiling" = "xno"; then
22 CC_FOR_BUILD='$(CC)'
23 else
24 CC_FOR_BUILD=gcc
25 fi
26 AC_SUBST(CC_FOR_BUILD)
27
28 AC_SUBST(CFLAGS)
29 AC_SUBST(HDEFINES)
30 AR=${AR-ar}
31 AC_SUBST(AR)
32 AC_PROG_RANLIB
33
34 . ${srcdir}/../../bfd/configure.host
35
36 dnl Standard simulator options.
37 dnl Eventually all simulators will support these.
38 dnl Do not add any here that cannot be supported by all simulators.
39 dnl Do not add similar but different options to a particular simulator,
40 dnl all shall eventually behave the same way.
41
42 AC_ARG_ENABLE(sim-cflags,
43 [ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
44 [case "${enableval}" in
45 yes) sim_cflags="-O2";;
46 trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
47 no) sim_cflags="";;
48 *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
49 esac
50 if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
51 echo "Setting sim cflags = $sim_cflags" 6>&1
52 fi],[sim_cflags=""])dnl
53 AC_SUBST(sim_cflags)
54
55 dnl --enable-sim-debug is for developers of the simulator
56 dnl the allowable values are work-in-progress
57 AC_ARG_ENABLE(sim-debug,
58 [ --enable-sim-debug=opts Enable debugging flags],
59 [case "${enableval}" in
60 yes) sim_debug="-DDEBUG=7";;
61 no) sim_debug="-DDEBUG=0";;
62 *) sim_debug="-DDEBUG='(${enableval})'";;
63 esac
64 if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
65 echo "Setting sim debug = $sim_debug" 6>&1
66 fi],[sim_debug=""])dnl
67 AC_SUBST(sim_debug)
68
69 dnl --enable-sim-trace is for users of the simulator
70 dnl the allowable values are work-in-progress
71 AC_ARG_ENABLE(sim-trace,
72 [ --enable-sim-trace=opts Enable tracing flags],
73 [case "${enableval}" in
74 yes) sim_trace="-DTRACE=1";;
75 no) sim_trace="-DTRACE=0";;
76 *) sim_trace="-DTRACE='(${enableval})'";;
77 esac
78 if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
79 echo "Setting sim trace = $sim_trace" 6>&1
80 fi],[sim_trace=""])dnl
81 AC_SUBST(sim_trace)
82
83 dnl This is a generic option to enable special byte swapping
84 dnl insns on *any* cpu.
85 AC_ARG_ENABLE(sim-bswap,
86 [ --enable-sim-bswap Use Host specific BSWAP instruction.],
87 [case "${enableval}" in
88 yes) sim_bswap="-DUSE_BSWAP";;
89 no) sim_bswap="";;
90 *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
91 esac
92 if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
93 echo "Setting bswap flags = $sim_bswap" 6>&1
94 fi],[sim_bswap=""])dnl
95 AC_SUBST(sim_bswap)
96
97 dnl These are available to append to as desired.
98 sim_link_files=
99 sim_link_links=
100
101 dnl Create tconfig.h either from simulator's tconfig.in or default one
102 dnl in common.
103 sim_link_links=tconfig.h
104 if test -f ${srcdir}/tconfig.in
105 then
106 sim_link_files=tconfig.in
107 else
108 sim_link_files=../common/tconfig.in
109 fi
110
111 case "${target}" in
112 *-*-*)
113 sim_link_files="${sim_link_files} ../common/nltvals.def"
114 sim_link_links="${sim_link_links} targ-vals.def"
115 ;;
116 esac
117
118 dnl Stuff that gets inserted into the Makefile
119
120 COMMON_MAKEFILE_FRAG=makefile-temp-$$
121 cat > $COMMON_MAKEFILE_FRAG <<EOF
122 VPATH = ${srcdir}
123 srcdir = ${srcdir}
124 srcroot = \$(srcdir)/../..
125
126 prefix = ${prefix}
127 exec_prefix = ${exec_prefix}
128
129 host_alias = ${host_alias}
130 target_alias = ${target_alias}
131 program_transform_name = ${program_transform_name}
132 bindir = ${bindir}
133
134 libdir = ${libdir}
135 tooldir = \$(libdir)/\$(target_alias)
136
137 datadir = ${datadir}
138 mandir = ${mandir}
139 man1dir = \$(mandir)/man1
140 infodir = ${infodir}
141 includedir = ${includedir}
142
143 SHELL = /bin/sh
144
145 INSTALL = \$(srcroot)/install.sh -c
146 INSTALL_PROGRAM = ${INSTALL_PROGRAM}
147 INSTALL_DATA = ${INSTALL_DATA}
148 INSTALL_XFORM = \$(INSTALL) -t='$(program_transform_name)'
149 INSTALL_XFORM1= \$(INSTALL_XFORM) -b=.1
150
151 CC = ${CC}
152 CC_FOR_BUILD = ${CC_FOR_BUILD}
153 CFLAGS = ${CFLAGS}
154 SIM_CFLAGS = ${sim_cflags}
155 SIM_DEBUG = ${sim_debug}
156 SIM_TRACE = ${sim_trace}
157 SIM_BSWAP = ${sim_bswap}
158
159 HDEFINES = ${HDEFINES}
160 TDEFINES =
161
162 AR = ${AR}
163 AR_FLAGS = rc
164 RANLIB = ${RANLIB}
165 MAKEINFO = makeinfo
166
167 # Each simulator's Makefile.in defines one or more of these variables
168 # as necessary. The SIM_AC_OUTPUT macro then inserts those values
169 # at '## Config'.
170
171 # List of object files, less common parts.
172 #SIM_OBJS =
173 # List of flags to always pass to $(CC).
174 #SIM_EXTRA_CFLAGS =
175 # List of extra libraries to link with.
176 #SIM_EXTRA_LIBS =
177 # List of extra program dependencies.
178 #SIM_EXTRA_LIBDEPS =
179 # Dependency of 'all' to build any extra files.
180 #SIM_EXTRA_ALL =
181 # Dependency of 'install' to install any extra files.
182 #SIM_EXTRA_INSTALL =
183 # Dependency of 'clean' to clean any extra files.
184 #SIM_EXTRA_CLEAN =
185
186 CONFIG_CFLAGS = ${DEFS} \$(SIM_CFLAGS) \$(SIM_DEBUG) \$(SIM_TRACE) \$(SIM_BSWAP) \
187 \$(SIM_EXTRA_CFLAGS) \$(HDEFINES) \$(TDEFINES)
188 CSEARCH = -I. -I\$(srcdir) -I../common -I\$(srcdir)/../common \
189 -I../../include -I\$(srcroot)/include \
190 -I../../bfd -I\$(srcroot)/bfd -I\$(srcroot)/gdb \
191 -I../../opcodes -I\$(srcroot)/opcodes
192 ALL_CFLAGS = \$(CONFIG_CFLAGS) \$(CSEARCH) \$(CFLAGS)
193 BUILD_CFLAGS = -g -O \$(CSEARCH)
194
195 .NOEXPORT:
196 MAKEOVERRIDES=
197
198 LIBIBERTY_LIB = ../../libiberty/libiberty.a
199 BFD_LIB = ../../bfd/libbfd.a
200 OPCODES_LIB = ../../opcodes/libopcodes.a
201 CONFIG_LIBS = ${LIBS}
202 LIBDEPS = \$(BFD_LIB) \$(OPCODES_LIB) \$(LIBIBERTY_LIB) \
203 \$(SIM_EXTRA_LIBDEPS)
204 EXTRA_LIBS = \$(BFD_LIB) \$(OPCODES_LIB) \$(LIBIBERTY_LIB) \
205 \$(CONFIG_LIBS) \$(SIM_EXTRA_LIBS)
206
207 LIB_OBJS = callback.o targ-map.o \$(SIM_OBJS)
208
209 all: run libsim.a \$(SIM_EXTRA_ALL)
210
211 libsim.a: \$(LIB_OBJS)
212 rm -f libsim.a
213 \$(AR) \$(ARFLAGS) libsim.a \$(LIB_OBJS)
214 \$(RANLIB) libsim.a
215
216 run: run.o libsim.a \$(LIBDEPS)
217 \$(CC) \$(ALL_CFLAGS) -o run \
218 run.o libsim.a \$(EXTRA_LIBS)
219
220 run.o: \$(srcdir)/../common/run.c config.h tconfig.h \
221 \$(srcroot)/include/callback.h
222 \$(CC) -c \$(srcdir)/../common/run.c \$(ALL_CFLAGS)
223
224 callback.o: \$(srcdir)/../common/callback.c config.h tconfig.h \
225 \$(srcroot)/include/callback.h targ-vals.h
226 \$(CC) -c \$(srcdir)/../common/callback.c \$(ALL_CFLAGS)
227
228 gentmap: \$(srcdir)/../common/gentmap.c targ-vals.def
229 \$(CC_FOR_BUILD) \$(srcdir)/../common/gentmap.c -o gentmap \$(BUILD_CFLAGS) -I\$(srcdir)/../common
230
231 targ-vals.h: gentmap
232 rm -f targ-vals.h
233 ./gentmap -h >targ-vals.h
234
235 targ-map.c: gentmap
236 rm -f targ-map.c
237 ./gentmap -c >targ-map.c
238
239 install: install-common \$(SIM_EXTRA_INSTALL)
240
241 install-common:
242 \$(INSTALL_XFORM) run \$(bindir)/run
243
244 check:
245
246 info:
247 clean-info:
248 install-info:
249
250 tags etags: TAGS
251
252 TAGS: force
253 etags *.c *.h
254
255 clean: \$(SIM_EXTRA_CLEAN)
256 rm -f *.[[oa]] *~ core gentmap targ-map.c targ-vals.h
257 rm -f run libsim.a
258
259 distclean mostlyclean maintainer-clean realclean: clean
260 rm -f TAGS
261 rm -f Makefile config.cache config.log config.status
262 rm -f tconfig.h config.h stamp-h
263
264 .c.o:
265 \$(CC) -c \$(ALL_CFLAGS) \$<
266
267 # Dummy target to force execution of dependent targets.
268 force:
269
270 Makefile: Makefile.in config.status
271 CONFIG_HEADERS= \$(SHELL) ./config.status
272
273 config.status: configure
274 \$(SHELL) ./config.status --recheck
275
276 config.h: stamp-h ; @true
277 stamp-h: config.in config.status
278 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in \$(SHELL) ./config.status
279
280 # We can't add dependencies to configure because it causes too much trouble
281 # to end users if configure's timestamp is out of sync.
282 .PHONY: run-autoconf
283 run-autoconf:
284 cd \$(srcdir) && autoconf -l ../common
285 EOF
286
287 dnl end of COMMON_MAKEFILE_FRAG
288
289 AC_SUBST_FILE(COMMON_MAKEFILE_FRAG)
290
291 ]) dnl End of SIM_AC_COMMON
292
293 dnl Generate the Makefile in a target specific directory.
294 dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
295 dnl so this is a cover macro to tuck the details away of how we cope.
296 dnl It also inserts default definitions of the SIM_FOO variables.
297
298 AC_DEFUN(SIM_AC_OUTPUT,
299 [
300 AC_LINK_FILES($sim_link_files, $sim_link_links)
301 AC_OUTPUT(Makefile,[
302 case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
303 ])
304
305 rm $COMMON_MAKEFILE_FRAG
306
307 ])dnl End of SIM_AC_OUTPUT
This page took 0.039418 seconds and 5 git commands to generate.