asan: dlltool buffer overflow: embedded NUL in string
[binutils-gdb.git] / gdbserver / Makefile.in
1 # Copyright (C) 1989-2021 Free Software Foundation, Inc.
2
3 # This file is part of GDB.
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 3 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, see <http://www.gnu.org/licenses/>.
17
18 # Please keep lists in this file sorted alphabetically, with one item per line.
19 # See gdb/Makefile.in for guidelines on ordering files and directories.
20
21 prefix = @prefix@
22 exec_prefix = @exec_prefix@
23
24 host_alias = @host_noncanonical@
25 target_alias = @target_noncanonical@
26 program_transform_name = @program_transform_name@
27 bindir = @bindir@
28 libdir = @libdir@
29
30 CONFIG_SRC_SUBDIR = @CONFIG_SRC_SUBDIR@
31
32 install_sh = @install_sh@
33
34 SHELL = @SHELL@
35 EXEEXT = @EXEEXT@
36
37 INSTALL = @INSTALL@
38 INSTALL_PROGRAM = @INSTALL_PROGRAM@
39 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
40 INSTALL_DATA = @INSTALL_DATA@
41 RANLIB = @RANLIB@
42
43 CC = @CC@
44 CXX = @CXX@
45 CXX_DIALECT = @CXX_DIALECT@
46 AR = @AR@
47 AR_FLAGS = rc
48 STRIP = @STRIP@
49
50 # Dependency tracking information.
51 DEPMODE = @CCDEPMODE@
52 DEPDIR = @DEPDIR@
53 depcomp = $(SHELL) $(srcdir)/../depcomp
54
55 # Directory containing source files. Don't clean up the spacing,
56 # this exact string is matched for by the "configure" script.
57 srcdir = @srcdir@
58 abs_top_srcdir = @abs_top_srcdir@
59 abs_srcdir = @abs_srcdir@
60 VPATH = @srcdir@
61
62 top_builddir = .
63
64 include $(srcdir)/../gdb/silent-rules.mk
65
66 # Note that these are overridden by GNU make-specific code below if
67 # GNU make is used. The overrides implement dependency tracking.
68 COMPILE.pre = $(CXX) $(CXX_DIALECT)
69 COMPILE.post = -c -o $@
70 POSTCOMPILE = @true
71
72 # CXXFLAGS is at the very end on purpose, so that user-supplied flags can
73 # override internal flags.
74 COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(CXXFLAGS) $(COMPILE.post)
75
76 # It is also possible that you will need to add -I/usr/include/sys to the
77 # CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
78 # is where it should be according to Posix).
79
80 # Set this up with gcc if you have gnu ld and the loader will print out
81 # line numbers for undefinded refs.
82 #CC_LD = g++ -static
83 CC_LD = $(CXX) $(CXX_DIALECT)
84
85 # Where is the "include" directory? Traditionally ../include or ./include
86 INCLUDE_DIR = ${srcdir}/../include
87 INCLUDE_DEP = $$(INCLUDE_DIR)
88
89 LIBIBERTY_BUILDDIR = ../libiberty
90 LIBIBERTY_NORMAL = $(LIBIBERTY_BUILDDIR)/libiberty.a
91 LIBIBERTY_NOASAN = $(LIBIBERTY_BUILDDIR)/noasan/libiberty.a
92 LIBIBERTY_PIC = $(LIBIBERTY_BUILDDIR)/pic/libiberty.a
93 LIBIBERTY_FOR_SHLIB = \
94 $(if $(wildcard $(LIBIBERTY_NOASAN)),\
95 $(LIBIBERTY_NOASAN),\
96 $(if $(wildcard $(LIBIBERTY_PIC)),\
97 $(LIBIBERTY_PIC),\
98 $(LIBIBERTY_NORMAL)))
99 LIBIBERTY = $(LIBIBERTY_NORMAL)
100
101 GDBSUPPORT_BUILDDIR = ../gdbsupport
102 GDBSUPPORT = $(GDBSUPPORT_BUILDDIR)/libgdbsupport.a
103
104 # Where is ust? These will be empty if ust was not available.
105 ustlibs = @ustlibs@
106 ustinc = @ustinc@
107
108 # gnulib
109 GNULIB_PARENT_DIR = ..
110 include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
111
112 # Where is the INTL library? Typically in ../intl.
113 INTL = @LIBINTL@
114 INTL_DEPS = @LIBINTL_DEP@
115 INTL_CFLAGS = @INCINTL@
116
117 INCSUPPORT = -I$(srcdir)/.. -I..
118
119 # All the includes used for CFLAGS and for lint.
120 # -I. for config files.
121 # -I${srcdir} for our headers.
122 # -I$(srcdir)/../gdb/regformats for regdef.h.
123 #
124 # We do not include ../target or ../nat in here because headers
125 # in those directories should be included with the subdirectory.
126 # e.g.: "target/wait.h".
127 #
128 INCLUDE_CFLAGS = -I. -I${srcdir} \
129 -I$(srcdir)/../gdb/regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
130 -I$(srcdir)/../gdb $(INCGNU) $(INCSUPPORT) \
131 $(INTL_CFLAGS)
132
133 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
134 # from the config/ directory.
135 GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS}
136 #PROFILE_CFLAGS = -pg
137
138 WARN_CFLAGS = @WARN_CFLAGS@
139 WERROR_CFLAGS = @WERROR_CFLAGS@
140
141 WARN_CFLAGS_NO_FORMAT = `echo " $(WARN_CFLAGS) " \
142 | sed "s/ -Wformat-nonliteral / -Wno-format-nonliteral /g"`
143
144 # These are specifically reserved for setting from the command line
145 # when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
146 CFLAGS = @CFLAGS@
147 CXXFLAGS = @CXXFLAGS@
148 CPPFLAGS = @CPPFLAGS@
149
150 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
151 PTHREAD_LIBS = @PTHREAD_LIBS@
152
153 WIN32APILIBS = @WIN32APILIBS@
154
155 # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
156 INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \
157 ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS)
158 INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
159 INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
160
161 # LDFLAGS is specifically reserved for setting from the command line
162 # when running make.
163 LDFLAGS = @LDFLAGS@
164 INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
165
166 # All source files that go into linking GDB remote server.
167
168 SFILES = \
169 $(srcdir)/debug.cc \
170 $(srcdir)/dll.cc \
171 $(srcdir)/gdbreplay.cc \
172 $(srcdir)/hostio.cc \
173 $(srcdir)/i387-fp.cc \
174 $(srcdir)/inferiors.cc \
175 $(srcdir)/linux-aarch64-low.cc \
176 $(srcdir)/linux-arc-low.cc \
177 $(srcdir)/linux-arm-low.cc \
178 $(srcdir)/linux-ia64-low.cc \
179 $(srcdir)/linux-low.cc \
180 $(srcdir)/linux-m68k-low.cc \
181 $(srcdir)/linux-mips-low.cc \
182 $(srcdir)/linux-nios2-low.cc \
183 $(srcdir)/linux-or1k-low.cc \
184 $(srcdir)/linux-ppc-low.cc \
185 $(srcdir)/linux-riscv-low.cc \
186 $(srcdir)/linux-s390-low.cc \
187 $(srcdir)/linux-sh-low.cc \
188 $(srcdir)/linux-sparc-low.cc \
189 $(srcdir)/linux-x86-low.cc \
190 $(srcdir)/linux-xtensa-low.cc \
191 $(srcdir)/mem-break.cc \
192 $(srcdir)/netbsd-aarch64-low.cc \
193 $(srcdir)/netbsd-amd64-low.cc \
194 $(srcdir)/netbsd-i386-low.cc \
195 $(srcdir)/netbsd-low.cc \
196 $(srcdir)/netbsd-low.h \
197 $(srcdir)/proc-service.cc \
198 $(srcdir)/proc-service.list \
199 $(srcdir)/regcache.cc \
200 $(srcdir)/remote-utils.cc \
201 $(srcdir)/server.cc \
202 $(srcdir)/symbol.cc \
203 $(srcdir)/target.cc \
204 $(srcdir)/thread-db.cc \
205 $(srcdir)/utils.cc \
206 $(srcdir)/win32-i386-low.cc \
207 $(srcdir)/win32-low.cc \
208 $(srcdir)/x86-low.cc \
209 $(srcdir)/../gdb/alloc.c \
210 $(srcdir)/../gdb/arch/arc.c \
211 $(srcdir)/../gdb/arch/arm.c \
212 $(srcdir)/../gdb/arch/arm-get-next-pcs.c \
213 $(srcdir)/../gdb/arch/arm-linux.c \
214 $(srcdir)/../gdb/arch/ppc-linux-common.c \
215 $(srcdir)/../gdb/arch/riscv.c \
216 $(srcdir)/../gdb/nat/aarch64-mte-linux-ptrace.c \
217 $(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \
218 $(srcdir)/../gdb/nat/linux-btrace.c \
219 $(srcdir)/../gdb/nat/linux-namespaces.c \
220 $(srcdir)/../gdb/nat/linux-osdata.c \
221 $(srcdir)/../gdb/nat/linux-personality.c \
222 $(srcdir)/../gdb/nat/mips-linux-watch.c \
223 $(srcdir)/../gdb/nat/ppc-linux.c \
224 $(srcdir)/../gdb/nat/riscv-linux-tdesc.c \
225 $(srcdir)/../gdb/nat/fork-inferior.c \
226 $(srcdir)/../gdb/target/waitstatus.c
227
228 DEPFILES = @GDBSERVER_DEPFILES@
229
230 LIBOBJS = @LIBOBJS@
231
232 SOURCES = $(SFILES)
233 TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
234
235 OBS = \
236 alloc.o \
237 ax.o \
238 debug.o \
239 dll.o \
240 hostio.o \
241 inferiors.o \
242 mem-break.o \
243 notif.o \
244 regcache.o \
245 remote-utils.o \
246 server.o \
247 symbol.o \
248 target.o \
249 tdesc.o \
250 tracepoint.o \
251 utils.o \
252 version.o \
253 target/waitstatus.o \
254 $(DEPFILES) \
255 $(LIBOBJS) \
256 $(XML_BUILTIN)
257
258 GDBREPLAY_OBS = \
259 gdbreplay.o \
260 utils.o \
261 version.o
262
263 GDBSERVER_LIBS = @GDBSERVER_LIBS@ $(PTHREAD_LIBS)
264 XM_CLIBS = @LIBS@
265 CDEPS = $(srcdir)/proc-service.list
266
267 # XML files to compile in to gdbserver, if any.
268 XML_DIR = $(srcdir)/../gdb/features
269 XML_FILES = @srv_xmlfiles@
270 XML_BUILTIN = @srv_xmlbuiltin@
271
272 IPA_DEPFILES = @IPA_DEPFILES@
273 extra_libraries = @extra_libraries@
274
275 FLAGS_TO_PASS = \
276 "prefix=$(prefix)" \
277 "exec_prefix=$(exec_prefix)" \
278 "libdir=$(libdir)" \
279 "DESTDIR=$(DESTDIR)" \
280 "AR=$(AR)" \
281 "AR_FLAGS=$(AR_FLAGS)" \
282 "CC=$(CC)" \
283 "CFLAGS=$(CFLAGS)" \
284 "CXX=$(CXX)" \
285 "CXXFLAGS=$(CXXFLAGS)" \
286 "DLLTOOL=$(DLLTOOL)" \
287 "LDFLAGS=$(LDFLAGS)" \
288 "RANLIB=$(RANLIB)" \
289 "MAKEINFO=$(MAKEINFO)" \
290 "MAKEHTML=$(MAKEHTML)" \
291 "MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
292 "INSTALL=$(INSTALL)" \
293 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
294 "INSTALL_DATA=$(INSTALL_DATA)" \
295 "RUNTEST=$(RUNTEST)" \
296 "RUNTESTFLAGS=$(RUNTESTFLAGS)"
297
298 # All generated files which can be included by another file.
299 generated_files = config.h
300
301 all: gdbserver$(EXEEXT) gdbreplay$(EXEEXT) $(extra_libraries)
302
303 # Traditionally "install" depends on "all". But it may be useful
304 # not to; for example, if the user has made some trivial change to a
305 # source file and doesn't care about rebuilding or just wants to save the
306 # time it takes for make to check that all is up to date.
307 # install-only is intended to address that need.
308 install: all
309 @$(MAKE) $(FLAGS_TO_PASS) install-only
310
311 install-only:
312 n=`echo gdbserver | sed '$(program_transform_name)'`; \
313 if [ x$$n = x ]; then n=gdbserver; else true; fi; \
314 if [ x"$(IPA_DEPFILES)" != x ]; then \
315 $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(libdir); \
316 $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \
317 fi; \
318 $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir); \
319 $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
320
321 install-strip:
322 $(MAKE) $(FLAGS_TO_PASS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
323 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
324 `test -z '$(STRIP)' || \
325 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install-only
326
327 uninstall: force
328 n=`echo gdbserver | sed '$(program_transform_name)'`; \
329 if [ x$$n = x ]; then n=gdbserver; else true; fi; \
330 if [ x"$(IPA_DEPFILES)" != x ]; then \
331 rm -f $(DESTDIR)$(libdir)/$(IPA_LIB); \
332 fi; \
333 rm -f $(DESTDIR)/$(bindir)/$$n$(EXEEXT)
334
335 installcheck:
336 check:
337 info dvi pdf:
338 install-info:
339 install-pdf:
340 html:
341 install-html:
342 clean-info:
343
344 gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY) \
345 $(INTL_DEPS) $(GDBSUPPORT)
346 $(SILENCE) rm -f gdbserver$(EXEEXT)
347 $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
348 $(CXXFLAGS) \
349 -o gdbserver$(EXEEXT) $(OBS) $(GDBSUPPORT) $(LIBGNU) \
350 $(LIBGNU_EXTRA_LIBS) $(LIBIBERTY) $(INTL) \
351 $(GDBSERVER_LIBS) $(XM_CLIBS) $(WIN32APILIBS)
352
353 gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY) \
354 $(INTL_DEPS) $(GDBSUPPORT)
355 $(SILENCE) rm -f gdbreplay$(EXEEXT)
356 $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
357 $(CXXFLAGS) \
358 -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) \
359 $(GDBSUPPORT) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) \
360 $(LIBIBERTY) $(INTL) $(WIN32APILIBS)
361
362 IPA_OBJS = \
363 alloc-ipa.o \
364 ax-ipa.o \
365 gdbsupport/common-utils-ipa.o \
366 gdbsupport/errors-ipa.o \
367 gdbsupport/format-ipa.o \
368 gdbsupport/print-utils-ipa.o \
369 gdbsupport/rsp-low-ipa.o \
370 gdbsupport/safe-strerror-ipa.o \
371 gdbsupport/tdesc-ipa.o \
372 regcache-ipa.o \
373 remote-utils-ipa.o \
374 tdesc-ipa.o \
375 tracepoint-ipa.o \
376 utils-ipa.o \
377 ${IPA_DEPFILES}
378
379 IPA_LIB = libinproctrace.so
380
381 $(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS}
382 $(SILENCE) rm -f $(IPA_LIB)
383 $(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
384 -Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
385 $(CXXFLAGS) \
386 -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) -ldl -pthread
387
388 # Put the proper machine-specific files first, so M-. on a machine
389 # specific routine gets the one for the correct machine.
390 # The xyzzy stuff below deals with empty DEPFILES
391 TAGS: ${TAGFILES}
392 etags \
393 `for i in yzzy ${DEPFILES}; do \
394 if [ x$$i != xyzzy ]; then \
395 echo ${srcdir}/$$i | sed -e 's/\.o$$/\.cc/' \
396 -e 's,/\(arch\|nat\|target\)/,/../\1/,' \
397 fi; \
398 done` \
399 ${TAGFILES}
400 tags: TAGS
401
402 mostlyclean clean:
403 rm -f *.o ${ADD_FILES} *~
404 rm -f gdbserver$(EXEEXT) gdbreplay$(EXEEXT) core make.log
405 rm -f $(IPA_LIB)
406 rm -f *-generated.cc
407 rm -f stamp-xml
408 rm -f $(DEPDIR)/*.Po
409 for i in $(CONFIG_SRC_SUBDIR); do \
410 rm -f $$i/*.o; \
411 rm -f $$i/$(DEPDIR)/*; \
412 done
413
414 maintainer-clean realclean distclean: clean
415 rm -f Makefile config.status config.h stamp-h config.log
416 rm -f Makefile
417 for i in $(CONFIG_SRC_SUBDIR); do \
418 rmdir $$i/$(DEPDIR); \
419 done
420
421 config.h: stamp-h ; @true
422 stamp-h: config.in config.status
423 $(SHELL) ./config.status config.h
424
425 Makefile: Makefile.in config.status
426 $(SHELL) ./config.status $@
427
428 config.status: configure configure.srv $(srcdir)/../bfd/development.sh
429 $(SHELL) ./config.status --recheck
430
431 # automatic rebuilding in automake-generated Makefiles requires
432 # this rule in the toplevel Makefile, which, with GNU make, causes
433 # the desired updates through the implicit regeneration of the Makefile
434 # and all of its prerequisites.
435 am--refresh:
436 @:
437
438 force:
439
440 version-generated.cc: Makefile $(srcdir)/../gdb/version.in $(srcdir)/../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
441 $(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir)/../gdb \
442 $(host_alias) $(target_alias) $@
443
444 xml-builtin-generated.cc: stamp-xml; @true
445 stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
446 $(SILENCE) rm -f xml-builtin.tmp
447 $(ECHO_GEN_XML_BUILTIN_GENERATED) $(SHELL) $(XML_DIR)/feature_to_c.sh \
448 xml-builtin.tmp $(XML_FILES)
449 $(SILENCE) $(SHELL) $(srcdir)/../move-if-change xml-builtin.tmp xml-builtin-generated.cc
450 $(SILENCE) echo stamp > stamp-xml
451
452 .PRECIOUS: xml-builtin.cc
453
454 # GNU Make has an annoying habit of putting *all* the Makefile variables
455 # into the environment, unless you include this target as a circumvention.
456 # Rumor is that this will be fixed (and this target can be removed)
457 # in GNU Make 4.0.
458 .NOEXPORT:
459
460 # GNU Make 3.63 has a different problem: it keeps tacking command line
461 # overrides onto the definition of $(MAKE). This variable setting
462 # will remove them.
463 MAKEOVERRIDES =
464
465 regdat_sh = $(srcdir)/../gdb/regformats/regdat.sh
466
467 UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
468
469 # Undo gnulib replacements for the IPA shared library build.
470 # The gnulib headers are still needed, but gnulib is not linked
471 # into the IPA lib so replacement apis don't work.
472 UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r -Drpl_free=free
473
474 # Note, we only build the IPA if -fvisibility=hidden is supported in
475 # the first place.
476 IPAGENT_CFLAGS = $(INTERNAL_CFLAGS) $(UST_CFLAGS) \
477 $(UNDO_GNULIB_CFLAGS) \
478 -fPIC -DIN_PROCESS_AGENT \
479 -fvisibility=hidden
480
481 # CXXFLAGS is at the very end on purpose, so that user-supplied flags can
482 # override internal flags.
483 IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) $(CXXFLAGS) $(COMPILE.post)
484
485 # Rules for special cases.
486
487 ax-ipa.o: ax.cc
488 $(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
489 $(POSTCOMPILE)
490
491 ax.o: ax.cc
492 $(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
493 $(POSTCOMPILE)
494
495 # Rules for objects that go in the in-process agent.
496
497 arch/%-ipa.o: ../gdb/arch/%.c
498 $(IPAGENT_COMPILE) -x c++ $<
499 $(POSTCOMPILE)
500
501 gdbsupport/%-ipa.o: ../gdbsupport/%.cc
502 $(IPAGENT_COMPILE) $<
503 $(POSTCOMPILE)
504
505 %-ipa.o: %-generated.cc
506 $(IPAGENT_COMPILE) $<
507 $(POSTCOMPILE)
508
509 %-ipa.o: %.cc
510 $(IPAGENT_COMPILE) $<
511 $(POSTCOMPILE)
512
513 %-ipa.o: ../gdb/%.c
514 $(IPAGENT_COMPILE) -x c++ $<
515 $(POSTCOMPILE)
516
517 # Note: Between two matching pattern rules, GNU Make 3.81 chooses the first one.
518 # Therefore, this one needs to be before "%.o: %.cc" for it to be considered for
519 # files such as linux-amd64-ipa.o generated from linux-amd64-ipa.cc.
520 #
521 # Later versions of GNU Make choose the rule with the shortest stem, so it would
522 # work in any order.
523
524 %-ipa.o: %-ipa.cc
525 $(IPAGENT_COMPILE) $<
526 $(POSTCOMPILE)
527
528 # Rules for objects that go in the gdbserver binary.
529
530 arch/%.o: ../gdb/arch/%.c
531 $(COMPILE) -x c++ $<
532 $(POSTCOMPILE)
533
534 %.o: %-generated.cc
535 $(COMPILE) $<
536 $(POSTCOMPILE)
537
538 %.o: %.cc
539 $(COMPILE) $<
540 $(POSTCOMPILE)
541
542 nat/%.o: ../gdb/nat/%.c
543 $(COMPILE) -x c++ $<
544 $(POSTCOMPILE)
545
546 target/%.o: ../gdb/target/%.c
547 $(COMPILE) -x c++ $<
548 $(POSTCOMPILE)
549
550 %.o: ../gdb/%.c
551 $(COMPILE) -x c++ $<
552 $(POSTCOMPILE)
553
554 # Rules for register format descriptions. Suffix destination files with
555 # -generated to identify and clean them easily.
556
557 %-generated.cc: ../gdb/regformats/%.dat $(regdat_sh)
558 $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
559
560 %-generated.cc: ../gdb/regformats/rs6000/%.dat $(regdat_sh)
561 $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
562
563 #
564 # Dependency tracking.
565 #
566
567 ifeq ($(DEPMODE),depmode=gcc3)
568 # Note that we put the dependencies into a .Tpo file, then move them
569 # into place if the compile succeeds. We need this because gcc does
570 # not atomically write the dependency output file.
571 override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \
572 -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo
573 override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \
574 $(@D)/$(DEPDIR)/$(basename $(@F)).Po
575 else
576 override COMPILE.pre = source='$<' object='$@' libtool=no \
577 DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) \
578 $(CXX) $(CXX_DIALECT)
579 # depcomp handles atomicity for us, so we don't need a postcompile
580 # step.
581 override POSTCOMPILE =
582 endif
583
584 # A list of all the objects we might care about in this build, for
585 # dependency tracking.
586 all_object_files = $(OBS) $(GDBREPLAY_OBS) $(IPA_OBJS)
587
588 # Ensure that generated files are created early. Use order-only
589 # dependencies if available. They require GNU make 3.80 or newer,
590 # and the .VARIABLES variable was introduced at the same time.
591 ifdef .VARIABLES
592 $(all_object_files): | $(generated_files)
593 else
594 $(all_object_files) : $(generated_files)
595 endif
596
597 # All the .deps files to include.
598 all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
599 $(dir $(dep))/$(DEPDIR)/$(notdir $(dep)))
600
601 # Dependencies.
602 -include $(all_deps_files)
603
604 # Disable implicit make rules.
605 include $(srcdir)/../gdb/disable-implicit-rules.mk
606
607 # Do not delete intermediate files (e.g. *-generated.cc).
608 .SECONDARY:
609
610 # This is the end of "Makefile.in".