C++ compile support
[external/binutils.git] / gdb / Makefile.in
1 # Copyright (C) 1989-2018 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 # Here are the general guidelines for ordering files and directories:
20 #
21 #   - Files come before directories.
22 #   - The extensions are not taken into account when comparing filenames, except
23 #     if the filenames are otherwise equal.
24 #   - A filename that is a prefix of another one comes before.
25 #   - Underscores and dashes are treated equally, and come before alphanumeric
26 #     characters.
27 #
28 # For example:
29 #
30 # SOME_FILES = \
31 #       foo.c \
32 #       foo.h \
33 #       foo-bar.c \
34 #       foobar.c \
35 #       foo/bar.c
36
37 prefix = @prefix@
38 exec_prefix = @exec_prefix@
39
40 host_alias = @host_alias@
41 target_alias = @target_alias@
42 program_transform_name = @program_transform_name@
43 bindir = @bindir@
44 libdir = @libdir@
45 tooldir = $(libdir)/$(target_alias)
46
47 datadir = @datadir@
48 localedir = @localedir@
49 mandir = @mandir@
50 man1dir = $(mandir)/man1
51 man2dir = $(mandir)/man2
52 man3dir = $(mandir)/man3
53 man4dir = $(mandir)/man4
54 man5dir = $(mandir)/man5
55 man6dir = $(mandir)/man6
56 man7dir = $(mandir)/man7
57 man8dir = $(mandir)/man8
58 man9dir = $(mandir)/man9
59 infodir = @infodir@
60 datarootdir = @datarootdir@
61 docdir = @docdir@
62 htmldir = @htmldir@
63 pdfdir = @pdfdir@
64 includedir = @includedir@
65
66 install_sh = @install_sh@
67
68 # This can be referenced by `LIBINTL' as computed by
69 # ZW_GNU_GETTEXT_SISTER_DIR.
70 top_builddir = .
71
72 SHELL = @SHELL@
73 EXEEXT = @EXEEXT@
74
75 AWK = @AWK@
76 LN_S = @LN_S@
77
78 INSTALL = @INSTALL@
79 INSTALL_PROGRAM = @INSTALL_PROGRAM@
80 INSTALL_SCRIPT = @INSTALL_SCRIPT@
81 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
82 INSTALL_DATA = @INSTALL_DATA@
83
84 DESTDIR =
85
86 AR = @AR@
87 AR_FLAGS = qv
88 RANLIB = @RANLIB@
89 DLLTOOL = @DLLTOOL@
90 WINDRES = @WINDRES@
91 MIG = @MIG@
92 STRIP = @STRIP@
93
94 XGETTEXT = @XGETTEXT@
95 GMSGFMT = @GMSGFMT@
96 MSGMERGE = msgmerge
97
98 PACKAGE = @PACKAGE@
99 CATALOGS = @CATALOGS@
100
101 # If you are compiling with GCC, make sure that either 1) You have the
102 # fixed include files where GCC can reach them, or 2) You use the
103 # -traditional flag.  Otherwise the ioctl calls in inflow.c
104 # will be incorrectly compiled.  The "fixincludes" script in the gcc
105 # distribution will fix your include files up.
106 CC = @CC@
107 CXX = @CXX@
108 CXX_DIALECT = @CXX_DIALECT@
109
110 # Dependency tracking information.
111 DEPMODE = @CCDEPMODE@
112 DEPDIR = @DEPDIR@
113 depcomp = $(SHELL) $(srcdir)/../depcomp
114
115 # Directory containing source files.
116 srcdir = @srcdir@
117 VPATH = @srcdir@
118 top_srcdir = @top_srcdir@
119
120 include $(srcdir)/silent-rules.mk
121
122 # Note that these are overridden by GNU make-specific code below if
123 # GNU make is used.  The overrides implement dependency tracking.
124 COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
125 COMPILE.post = -c -o $@
126 COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
127 POSTCOMPILE = @true
128
129 YACC = @YACC@
130
131 # This is used to rebuild ada-lex.c from ada-lex.l.  If the program is
132 # not defined, but ada-lex.c is present, compilation will continue,
133 # possibly with a warning.
134 FLEX = flex
135
136 YLWRAP = $(srcdir)/../ylwrap
137
138 # where to find makeinfo, preferably one designed for texinfo-2
139 MAKEINFO = @MAKEINFO@
140 MAKEINFOFLAGS = @MAKEINFOFLAGS@
141 MAKEINFO_EXTRA_FLAGS = @MAKEINFO_EXTRA_FLAGS@
142 MAKEINFO_CMD = $(MAKEINFO) $(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS)
143
144 MAKEHTML = $(MAKEINFO_CMD) --html
145 MAKEHTMLFLAGS =
146
147 # Set this up with gcc if you have gnu ld and the loader will print out
148 # line numbers for undefined references.
149 #CC_LD = g++ -static
150 CC_LD = $(CXX) $(CXX_DIALECT)
151
152 # Where is our "include" directory?  Typically $(srcdir)/../include.
153 # This is essentially the header file directory for the library
154 # routines in libiberty.
155 INCLUDE_DIR = $(srcdir)/../include
156 INCLUDE_CFLAGS = -I$(INCLUDE_DIR)
157
158 # Where is the "-liberty" library?  Typically in ../libiberty.
159 LIBIBERTY = ../libiberty/libiberty.a
160
161 # Where is the BFD library?  Typically in ../bfd.
162 BFD_DIR = ../bfd
163 BFD = $(BFD_DIR)/libbfd.a
164 BFD_SRC = $(srcdir)/$(BFD_DIR)
165 BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC)
166
167 # This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
168 # -I../zlib, unless we were configured with --with-system-zlib, in which
169 # case both are empty.
170 ZLIB = @zlibdir@ -lz
171 ZLIBINC = @zlibinc@
172
173 # Where is the decnumber library?  Typically in ../libdecnumber.
174 LIBDECNUMBER_DIR = ../libdecnumber
175 LIBDECNUMBER = $(LIBDECNUMBER_DIR)/libdecnumber.a
176 LIBDECNUMBER_SRC = $(srcdir)/$(LIBDECNUMBER_DIR)
177 LIBDECNUMBER_CFLAGS = -I$(LIBDECNUMBER_DIR) -I$(LIBDECNUMBER_SRC)
178
179 # Where is the READLINE library?  Typically in ../readline.
180 READLINE_DIR = ../readline
181 READLINE_SRC = $(srcdir)/$(READLINE_DIR)
182 READLINE = @READLINE@
183 READLINE_DEPS = @READLINE_DEPS@
184 READLINE_CFLAGS = @READLINE_CFLAGS@
185
186 # Where is expat?  This will be empty if expat was not available.
187 LIBEXPAT = @LIBEXPAT@
188
189 # Where is lzma?  This will be empty if lzma was not available.
190 LIBLZMA = @LIBLZMA@
191
192 # Where is libbabeltrace? This will be empty if lbabeltrace was not
193 # available.
194 LIBBABELTRACE = @LIBBABELTRACE@
195
196 # Where is libipt?  This will be empty if libipt was not available.
197 LIBIPT = @LIBIPT@
198
199 # Where is libmpfr?  This will be empty if libmpfr was not available.
200 LIBMPFR = @LIBMPFR@
201
202 WARN_CFLAGS = @WARN_CFLAGS@
203 WERROR_CFLAGS = @WERROR_CFLAGS@
204 GDB_WARN_CFLAGS = $(WARN_CFLAGS)
205 GDB_WERROR_CFLAGS = $(WERROR_CFLAGS)
206
207 GDB_WARN_CFLAGS_NO_FORMAT = `echo " $(GDB_WARN_CFLAGS) " \
208                    | sed "s/ -Wformat-nonliteral / -Wno-format-nonliteral /g"`
209 GDB_WARN_CFLAGS_NO_DEFS = `echo " $(GDB_WARN_CFLAGS) " \
210                    | sed "s/ -Wold-style-definition / -Wno-old-style-definition /g"`
211
212 RDYNAMIC = @RDYNAMIC@
213
214 # Where is the INTL library?  Typically in ../intl.
215 INTL = @LIBINTL@
216 INTL_DEPS = @LIBINTL_DEP@
217 INTL_CFLAGS = @INCINTL@
218
219 # Where is the ICONV library?  This will be empty if in libc or not available.
220 LIBICONV = @LIBICONV@
221
222 # Did the user give us a --with-gdb-datadir option?
223 GDB_DATADIR = @GDB_DATADIR@
224
225 # Code signing.
226 CODESIGN = codesign
227 CODESIGN_CERT = @CODESIGN_CERT@
228
229 # Flags to pass to gdb when invoked with "make run".
230 GDBFLAGS =
231
232 # Helper code from gnulib.
233 GNULIB_BUILDDIR = build-gnulib
234 LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
235 INCGNU = -I$(srcdir)/gnulib/import -I$(GNULIB_BUILDDIR)/import
236
237 # Generated headers in the gnulib directory.  These must be listed
238 # so that they are generated before other files are compiled.
239 GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
240
241 #
242 # CLI sub directory definitons
243 #
244 SUBDIR_CLI_SRCS = \
245         cli/cli-cmds.c \
246         cli/cli-decode.c \
247         cli/cli-dump.c \
248         cli/cli-interp.c \
249         cli/cli-logging.c \
250         cli/cli-script.c \
251         cli/cli-setshow.c \
252         cli/cli-utils.c
253
254 SUBDIR_CLI_OBS = $(patsubst %.c,%.o,$(SUBDIR_CLI_SRCS))
255
256 #
257 # MI sub directory definitons
258 #
259 SUBDIR_MI_SRCS = \
260         mi/mi-cmd-break.c \
261         mi/mi-cmd-catch.c \
262         mi/mi-cmd-disas.c \
263         mi/mi-cmd-env.c \
264         mi/mi-cmd-file.c \
265         mi/mi-cmd-info.c \
266         mi/mi-cmd-stack.c \
267         mi/mi-cmd-target.c \
268         mi/mi-cmd-var.c \
269         mi/mi-cmds.c \
270         mi/mi-console.c \
271         mi/mi-getopt.c \
272         mi/mi-interp.c \
273         mi/mi-main.c \
274         mi/mi-out.c \
275         mi/mi-parse.c \
276         mi/mi-symbol-cmds.c
277
278 SUBDIR_MI_OBS = $(patsubst %.c,%.o,$(SUBDIR_MI_SRCS))
279
280 SUBDIR_MI_DEPS =
281 SUBDIR_MI_LDFLAGS =
282 SUBDIR_MI_CFLAGS =
283
284 #
285 # TUI sub directory definitions
286 #
287 SUBDIR_TUI_SRCS = \
288         tui/tui.c \
289         tui/tui-command.c \
290         tui/tui-data.c \
291         tui/tui-disasm.c \
292         tui/tui-file.c \
293         tui/tui-hooks.c \
294         tui/tui-interp.c \
295         tui/tui-io.c \
296         tui/tui-layout.c \
297         tui/tui-out.c \
298         tui/tui-regs.c \
299         tui/tui-source.c \
300         tui/tui-stack.c \
301         tui/tui-win.c \
302         tui/tui-windata.c \
303         tui/tui-wingeneral.c \
304         tui/tui-winsource.c
305
306 SUBDIR_TUI_OBS = $(patsubst %.c,%.o,$(SUBDIR_TUI_SRCS))
307
308 SUBDIR_TUI_DEPS =
309 SUBDIR_TUI_LDFLAGS =
310 SUBDIR_TUI_CFLAGS = -DTUI=1
311
312 #
313 # GCC Compile support sub-directory definitions
314 #
315 SUBDIR_GCC_COMPILE_SRCS = \
316         compile/compile.c \
317         compile/compile-c-support.c \
318         compile/compile-c-symbols.c \
319         compile/compile-c-types.c \
320         compile/compile-cplus-symbols.c \
321         compile/compile-cplus-types.c \
322         compile/compile-loc2c.c \
323         compile/compile-object-load.c \
324         compile/compile-object-run.c
325
326 SUBDIR_GCC_COMPILE_OBS = $(patsubst %.c,%.o,$(filter %.c,$(SUBDIR_GCC_COMPILE_SRCS)))
327
328 #
329 # Guile sub directory definitons for guile support.
330 #
331 SUBDIR_GUILE_SRCS = \
332         guile/guile.c \
333         guile/scm-arch.c \
334         guile/scm-auto-load.c \
335         guile/scm-block.c \
336         guile/scm-breakpoint.c \
337         guile/scm-cmd.c \
338         guile/scm-disasm.c \
339         guile/scm-exception.c \
340         guile/scm-frame.c \
341         guile/scm-gsmob.c \
342         guile/scm-iterator.c \
343         guile/scm-lazy-string.c \
344         guile/scm-math.c \
345         guile/scm-objfile.c \
346         guile/scm-param.c \
347         guile/scm-ports.c \
348         guile/scm-pretty-print.c \
349         guile/scm-progspace.c \
350         guile/scm-safe-call.c \
351         guile/scm-string.c \
352         guile/scm-symbol.c \
353         guile/scm-symtab.c \
354         guile/scm-type.c \
355         guile/scm-utils.c \
356         guile/scm-value.c
357
358 SUBDIR_GUILE_OBS = $(patsubst %.c,%.o,$(SUBDIR_GUILE_SRCS))
359
360 SUBDIR_GUILE_DEPS =
361 SUBDIR_GUILE_LDFLAGS =
362 SUBDIR_GUILE_CFLAGS =
363
364 #
365 # python sub directory definitons
366 #
367 SUBDIR_PYTHON_SRCS = \
368         python/py-arch.c \
369         python/py-auto-load.c \
370         python/py-block.c \
371         python/py-bpevent.c \
372         python/py-breakpoint.c \
373         python/py-cmd.c \
374         python/py-continueevent.c \
375         python/py-event.c \
376         python/py-evtregistry.c \
377         python/py-evts.c \
378         python/py-exitedevent.c \
379         python/py-finishbreakpoint.c \
380         python/py-frame.c \
381         python/py-framefilter.c \
382         python/py-function.c \
383         python/py-gdb-readline.c \
384         python/py-inferior.c \
385         python/py-infevents.c \
386         python/py-infthread.c \
387         python/py-instruction.c \
388         python/py-lazy-string.c \
389         python/py-linetable.c \
390         python/py-newobjfileevent.c \
391         python/py-objfile.c \
392         python/py-param.c \
393         python/py-prettyprint.c \
394         python/py-progspace.c \
395         python/py-record.c \
396         python/py-record-btrace.c \
397         python/py-record-full.c \
398         python/py-signalevent.c \
399         python/py-stopevent.c \
400         python/py-symbol.c \
401         python/py-symtab.c \
402         python/py-threadevent.c \
403         python/py-type.c \
404         python/py-unwind.c \
405         python/py-utils.c \
406         python/py-value.c \
407         python/py-varobj.c \
408         python/py-xmethods.c \
409         python/python.c
410
411 SUBDIR_PYTHON_OBS = $(patsubst %.c,%.o,$(SUBDIR_PYTHON_SRCS))
412
413 SUBDIR_PYTHON_DEPS =
414 SUBDIR_PYTHON_LDFLAGS =
415 SUBDIR_PYTHON_CFLAGS =
416
417 SUBDIR_UNITTESTS_SRCS = \
418         unittests/array-view-selftests.c \
419         unittests/cli-utils-selftests.c \
420         unittests/common-utils-selftests.c \
421         unittests/environ-selftests.c \
422         unittests/format_pieces-selftests.c \
423         unittests/function-view-selftests.c \
424         unittests/lookup_name_info-selftests.c \
425         unittests/memory-map-selftests.c \
426         unittests/memrange-selftests.c \
427         unittests/offset-type-selftests.c \
428         unittests/observable-selftests.c \
429         unittests/optional-selftests.c \
430         unittests/parse-connection-spec-selftests.c \
431         unittests/ptid-selftests.c \
432         unittests/rsp-low-selftests.c \
433         unittests/scoped_fd-selftests.c \
434         unittests/scoped_mmap-selftests.c \
435         unittests/scoped_restore-selftests.c \
436         unittests/string_view-selftests.c \
437         unittests/tracepoint-selftests.c \
438         unittests/unpack-selftests.c \
439         unittests/utils-selftests.c \
440         unittests/xml-utils-selftests.c
441
442 SUBDIR_UNITTESTS_OBS = $(patsubst %.c,%.o,$(SUBDIR_UNITTESTS_SRCS))
443
444 SUBDIR_TARGET_SRCS = target/waitstatus.c
445 SUBDIR_TARGET_OBS = $(patsubst %.c,%.o,$(SUBDIR_TARGET_SRCS))
446
447
448 # Opcodes currently live in one of two places.  Either they are in the
449 # opcode library, typically ../opcodes, or they are in a header file
450 # in INCLUDE_DIR.
451 # Where is the "-lopcodes" library, with (some of) the opcode tables and
452 # disassemblers?
453 OPCODES_DIR = ../opcodes
454 OPCODES_SRC = $(srcdir)/$(OPCODES_DIR)
455 OPCODES = $(OPCODES_DIR)/libopcodes.a
456 # Where are the other opcode tables which only have header file
457 # versions?
458 OP_INCLUDE = $(INCLUDE_DIR)/opcode
459 # Some source files like to use #include "opcodes/file.h"
460 OPCODES_CFLAGS = -I$(OP_INCLUDE) -I$(OPCODES_SRC)/..
461
462 # The simulator is usually nonexistent; targets that include one
463 # should set this to list all the .o or .a files to be linked in.
464 SIM = @SIM@
465
466 WIN32LIBS = @WIN32LIBS@
467
468 # Tcl et al cflags and libraries
469 TCL = @TCL_LIBRARY@
470 TCL_CFLAGS = @TCL_INCLUDE@
471 GDBTKLIBS = @GDBTKLIBS@
472 # Extra flags that the GDBTK files need:
473 GDBTK_CFLAGS = @GDBTK_CFLAGS@
474
475 TK = @TK_LIBRARY@
476 TK_CFLAGS = @TK_INCLUDE@
477
478 X11_CFLAGS = @TK_XINCLUDES@
479 X11_LDFLAGS =
480 X11_LIBS =
481
482 WIN32LDAPP = @WIN32LDAPP@
483
484 LIBGUI = @LIBGUI@
485 GUI_CFLAGS_X = @GUI_CFLAGS_X@
486 IDE_CFLAGS = $(GUI_CFLAGS_X) $(IDE_CFLAGS_X)
487
488 ALL_TCL_CFLAGS = $(TCL_CFLAGS) $(TK_CFLAGS)
489
490 # The version of gdbtk we're building. This should be kept
491 # in sync with GDBTK_VERSION and friends in gdbtk.h.
492 GDBTK_VERSION = 1.0
493 GDBTK_LIBRARY = $(datadir)/insight$(GDBTK_VERSION)
494
495 # Gdbtk requires an absolute path to the source directory or
496 # the testsuite won't run properly.
497 GDBTK_SRC_DIR = @GDBTK_SRC_DIR@
498
499 SUBDIR_GDBTK_OBS = \
500         gdbtk.o \
501         gdbtk-bp.o \
502         gdbtk-cmds.o \
503         gdbtk-hooks.o \
504         gdbtk-interp.o \
505         gdbtk-register.o \
506         gdbtk-stack.o \
507         gdbtk-varobj.o \
508         gdbtk-wrapper.o
509
510 SUBDIR_GDBTK_SRCS = \
511         gdbtk/generic/gdbtk.c \
512         gdbtk/generic/gdbtk-bp.c \
513         gdbtk/generic/gdbtk-cmds.c \
514         gdbtk/generic/gdbtk-hooks.c \
515         gdbtk/generic/gdbtk-interp.c \
516         gdbtk/generic/gdbtk-main.c \
517         gdbtk/generic/gdbtk-register.c \
518         gdbtk/generic/gdbtk-stack.c \
519         gdbtk/generic/gdbtk-varobj.c \
520         gdbtk/generic/gdbtk-wrapper.c
521
522 SUBDIR_GDBTK_DEPS = $(LIBGUI) $(TCL_DEPS) $(TK_DEPS)
523 SUBDIR_GDBTK_LDFLAGS =
524 SUBDIR_GDBTK_CFLAGS = -DGDBTK
525
526 CONFIG_OBS = @CONFIG_OBS@
527 CONFIG_SRCS = @CONFIG_SRCS@
528 CONFIG_DEPS = @CONFIG_DEPS@
529 CONFIG_LDFLAGS = @CONFIG_LDFLAGS@
530 ENABLE_CFLAGS = @ENABLE_CFLAGS@
531 CONFIG_ALL = @CONFIG_ALL@
532 CONFIG_CLEAN = @CONFIG_CLEAN@
533 CONFIG_INSTALL = @CONFIG_INSTALL@
534 CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
535 HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
536
537 CONFIG_SRC_SUBDIR = arch cli mi common compile tui unittests guile python target
538 CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
539
540 # -I. for config files.
541 # -I$(srcdir) for gdb internal headers.
542 # -I$(srcdir)/config for more generic config files.
543
544 # It is also possible that you will need to add -I/usr/include/sys if
545 # your system doesn't have fcntl.h in /usr/include (which is where it
546 # should be according to Posix).
547 DEFS = @DEFS@
548 GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/common -I$(srcdir)/config \
549         -DLOCALEDIR="\"$(localedir)\"" $(DEFS)
550
551 # MH_CFLAGS, if defined, has host-dependent CFLAGS from the config directory.
552 GLOBAL_CFLAGS = $(MH_CFLAGS)
553
554 PROFILE_CFLAGS = @PROFILE_CFLAGS@
555
556 # These are specifically reserved for setting from the command line
557 # when running make.  I.E.: "make CFLAGS=-Wmissing-prototypes".
558 CFLAGS = @CFLAGS@
559 CXXFLAGS = @CXXFLAGS@
560 CPPFLAGS = @CPPFLAGS@
561
562 # Set by configure, for e.g. expat.  Python installations are such that
563 # C headers are included using their basename (for example, we #include
564 # <Python.h> rather than, say, <python/Python.h>).  Since the file names
565 # are sometimes a little generic, we think that the risk of collision
566 # with other header files is high.  If that happens, we try to mitigate
567 # a bit the consequences by putting the Python includes last in the list.
568 INTERNAL_CPPFLAGS = $(CPPFLAGS) @GUILE_CPPFLAGS@ @PYTHON_CPPFLAGS@
569
570 # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
571 INTERNAL_CFLAGS_BASE = \
572         $(CXXFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
573         $(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \
574         $(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
575         $(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS)
576 INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
577 INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
578
579 # LDFLAGS is specifically reserved for setting from the command line
580 # when running make.
581 LDFLAGS = @LDFLAGS@
582
583 # Profiling options need to go here to work.
584 # I think it's perfectly reasonable for a user to set -pg in CFLAGS
585 # and have it work; that's why CFLAGS is here.
586 # PROFILE_CFLAGS is _not_ included, however, because we use monstartup.
587 INTERNAL_LDFLAGS = \
588         $(CXXFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) \
589         $(LDFLAGS) $(CONFIG_LDFLAGS)
590
591 # If your system is missing alloca(), or, more likely, it's there but
592 # it doesn't work, then refer to libiberty.
593
594 # Libraries and corresponding dependencies for compiling gdb.
595 # XM_CLIBS, defined in *config files, have host-dependent libs.
596 # LIBIBERTY appears twice on purpose.
597 CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(ZLIB) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
598         $(XM_CLIBS) $(GDBTKLIBS) \
599         @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
600         $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
601         $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) $(LIBMPFR)
602 CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \
603         $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU)
604
605 DIST = gdb
606
607 RUNTEST = runtest
608 RUNTESTFLAGS =
609
610 # XML files to build in to GDB.
611 XMLFILES = \
612         $(srcdir)/features/btrace.dtd \
613         $(srcdir)/features/btrace-conf.dtd \
614         $(srcdir)/features/gdb-target.dtd \
615         $(srcdir)/features/library-list.dtd \
616         $(srcdir)/features/library-list-aix.dtd \
617         $(srcdir)/features/library-list-svr4.dtd \
618         $(srcdir)/features/osdata.dtd \
619         $(srcdir)/features/threads.dtd \
620         $(srcdir)/features/traceframe-info.dtd \
621         $(srcdir)/features/xinclude.dtd
622
623 # Build the ser-*.o files the host supports.  This includes ser-unix.o
624 # for any system that supports a POSIX interface to the serial port.
625 # See configure.ac.
626 SER_HARDWIRE = @SER_HARDWIRE@
627
628 # This is remote-sim.o if a simulator is to be linked in.
629 SIM_OBS = @SIM_OBS@
630
631 # Target-dependent object files.
632 TARGET_OBS = @TARGET_OBS@
633
634 # All target-dependent objects files that require 64-bit CORE_ADDR
635 # (used with --enable-targets=all --enable-64-bit-bfd).
636 ALL_64_TARGET_OBS = \
637         aarch64-fbsd-tdep.o \
638         aarch64-linux-tdep.o \
639         aarch64-newlib-tdep.o \
640         aarch64-tdep.o \
641         alpha-bsd-tdep.o \
642         alpha-linux-tdep.o \
643         alpha-mdebug-tdep.o \
644         alpha-nbsd-tdep.o \
645         alpha-obsd-tdep.o \
646         alpha-tdep.o \
647         amd64-darwin-tdep.o \
648         amd64-dicos-tdep.o \
649         amd64-fbsd-tdep.o \
650         amd64-linux-tdep.o \
651         amd64-nbsd-tdep.o \
652         amd64-obsd-tdep.o \
653         amd64-sol2-tdep.o \
654         amd64-tdep.o \
655         amd64-windows-tdep.o \
656         arch/aarch64.o \
657         arch/aarch64-insn.o \
658         arch/amd64.o \
659         ia64-linux-tdep.o \
660         ia64-tdep.o \
661         ia64-vms-tdep.o \
662         mips64-obsd-tdep.o \
663         sparc64-fbsd-tdep.o \
664         sparc64-linux-tdep.o \
665         sparc64-nbsd-tdep.o \
666         sparc64-obsd-tdep.o \
667         sparc64-sol2-tdep.o \
668         sparc64-tdep.o
669
670 # All other target-dependent objects files (used with --enable-targets=all).
671 ALL_TARGET_OBS = \
672         arc-tdep.o \
673         arch/arm.o \
674         arch/arm-get-next-pcs.o \
675         arch/arm-linux.o \
676         arch/i386.o \
677         arch/ppc-linux-common.o \
678         arm-bsd-tdep.o \
679         arm-fbsd-tdep.o \
680         arm-linux-tdep.o \
681         arm-nbsd-tdep.o \
682         arm-obsd-tdep.o \
683         arm-symbian-tdep.o \
684         arm-tdep.o \
685         arm-wince-tdep.o \
686         avr-tdep.o \
687         bfin-linux-tdep.o \
688         bfin-tdep.o \
689         bsd-uthread.o \
690         cris-linux-tdep.o \
691         cris-tdep.o \
692         csky-linux-tdep.o \
693         csky-tdep.o \
694         dicos-tdep.o \
695         fbsd-tdep.o \
696         frv-linux-tdep.o \
697         frv-tdep.o \
698         ft32-tdep.o \
699         glibc-tdep.o \
700         h8300-tdep.o \
701         hppa-bsd-tdep.o \
702         hppa-linux-tdep.o \
703         hppa-nbsd-tdep.o \
704         hppa-obsd-tdep.o \
705         hppa-tdep.o \
706         i386-bsd-tdep.o \
707         i386-cygwin-tdep.o \
708         i386-darwin-tdep.o \
709         i386-dicos-tdep.o \
710         i386-fbsd-tdep.o \
711         i386-gnu-tdep.o \
712         i386-go32-tdep.o \
713         i386-linux-tdep.o \
714         i386-nbsd-tdep.o \
715         i386-nto-tdep.o \
716         i386-obsd-tdep.o \
717         i386-sol2-tdep.o \
718         i386-tdep.o \
719         i387-tdep.o \
720         iq2000-tdep.o \
721         linux-record.o \
722         linux-tdep.o \
723         lm32-tdep.o \
724         m32c-tdep.o \
725         m32r-linux-tdep.o \
726         m32r-tdep.o \
727         m68hc11-tdep.o \
728         m68k-bsd-tdep.o \
729         m68k-linux-tdep.o \
730         m68k-tdep.o \
731         mep-tdep.o \
732         microblaze-linux-tdep.o \
733         microblaze-tdep.o \
734         mips-fbsd-tdep.o \
735         mips-linux-tdep.o \
736         mips-nbsd-tdep.o \
737         mips-sde-tdep.o \
738         mips-tdep.o \
739         mn10300-linux-tdep.o \
740         mn10300-tdep.o \
741         moxie-tdep.o \
742         msp430-tdep.o \
743         nbsd-tdep.o \
744         nds32-tdep.o \
745         nios2-linux-tdep.o \
746         nios2-tdep.o \
747         nto-tdep.o \
748         obsd-tdep.o \
749         or1k-tdep.o \
750         ppc-fbsd-tdep.o \
751         ppc-linux-tdep.o \
752         ppc-nbsd-tdep.o \
753         ppc-obsd-tdep.o \
754         ppc-ravenscar-thread.o \
755         ppc-sysv-tdep.o \
756         ppc64-tdep.o \
757         ravenscar-thread.o \
758         riscv-linux-tdep.o \
759         riscv-tdep.o \
760         rl78-tdep.o \
761         rs6000-aix-tdep.o \
762         rs6000-lynx178-tdep.o \
763         rs6000-tdep.o \
764         rx-tdep.o \
765         s390-linux-tdep.o \
766         s390-tdep.o \
767         score-tdep.o \
768         sh-linux-tdep.o \
769         sh-nbsd-tdep.o \
770         sh-tdep.o \
771         sol2-tdep.o \
772         solib-aix.o \
773         solib-darwin.o \
774         solib-dsbt.o \
775         solib-frv.o \
776         solib-spu.o \
777         solib-svr4.o \
778         sparc-linux-tdep.o \
779         sparc-nbsd-tdep.o \
780         sparc-obsd-tdep.o \
781         sparc-ravenscar-thread.o \
782         sparc-sol2-tdep.o \
783         sparc-tdep.o \
784         spu-multiarch.o \
785         spu-tdep.o \
786         symfile-mem.o \
787         tic6x-linux-tdep.o \
788         tic6x-tdep.o \
789         tilegx-linux-tdep.o \
790         tilegx-tdep.o \
791         v850-tdep.o \
792         vax-nbsd-tdep.o \
793         vax-tdep.o \
794         windows-tdep.o \
795         x86-tdep.o \
796         xcoffread.o \
797         xstormy16-tdep.o \
798         xtensa-config.o \
799         xtensa-linux-tdep.o \
800         xtensa-tdep.o
801
802 # The following native-target dependent variables are defined on
803 # configure.nat.
804 NAT_FILE = @NAT_FILE@
805 NATDEPFILES = @NATDEPFILES@
806 NAT_CDEPS = @NAT_CDEPS@
807 LOADLIBES = @LOADLIBES@
808 MH_CFLAGS = @MH_CFLAGS@
809 XM_CLIBS = @XM_CLIBS@
810 NAT_GENERATED_FILES = @NAT_GENERATED_FILES@
811 HAVE_NATIVE_GCORE_HOST = @HAVE_NATIVE_GCORE_HOST@
812
813 # Native-target dependent makefile fragment comes in here.
814 @nat_makefile_frag@
815
816 # End of native-target dependent variables.
817
818 FLAGS_TO_PASS = \
819         "prefix=$(prefix)" \
820         "exec_prefix=$(exec_prefix)" \
821         "infodir=$(infodir)" \
822         "datarootdir=$(datarootdir)" \
823         "docdir=$(docdir)" \
824         "htmldir=$(htmldir)" \
825         "pdfdir=$(pdfdir)" \
826         "libdir=$(libdir)" \
827         "mandir=$(mandir)" \
828         "datadir=$(datadir)" \
829         "includedir=$(includedir)" \
830         "against=$(against)" \
831         "DESTDIR=$(DESTDIR)" \
832         "AR=$(AR)" \
833         "AR_FLAGS=$(AR_FLAGS)" \
834         "CC=$(CC)" \
835         "CFLAGS=$(CFLAGS)" \
836         "CXX=$(CXX)" \
837         "CXX_DIALECT=$(CXX_DIALECT)" \
838         "CXXFLAGS=$(CXXFLAGS)" \
839         "DLLTOOL=$(DLLTOOL)" \
840         "LDFLAGS=$(LDFLAGS)" \
841         "RANLIB=$(RANLIB)" \
842         "MAKEINFO=$(MAKEINFO)" \
843         "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
844         "MAKEINFO_EXTRA_FLAGS=$(MAKEINFO_EXTRA_FLAGS)" \
845         "MAKEHTML=$(MAKEHTML)" \
846         "MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
847         "INSTALL=$(INSTALL)" \
848         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
849         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
850         "INSTALL_DATA=$(INSTALL_DATA)" \
851         "RUNTEST=$(RUNTEST)" \
852         "RUNTESTFLAGS=$(RUNTESTFLAGS)"
853
854 # Flags that we pass when building the testsuite.
855
856 # empty for native, $(target_alias)/ for cross
857 target_subdir = @target_subdir@
858
859 CC_FOR_TARGET = ` \
860   if [ -f $${rootme}/../gcc/xgcc ] ; then \
861     if [ -f $${rootme}/../$(target_subdir)newlib/Makefile ] ; then \
862       echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/ -idirafter $${rootme}/$(target_subdir)newlib/targ-include -idirafter $${rootsrc}/../$(target_subdir)newlib/libc/include -nostdinc -B$${rootme}/../$(target_subdir)newlib/; \
863     else \
864       echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/; \
865     fi; \
866   else \
867     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
868       echo $(CC); \
869     else \
870       t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
871     fi; \
872   fi`
873
874 CXX_FOR_TARGET = ` \
875   if [ -f $${rootme}/../gcc/xg++ ] ; then \
876     if [ -f $${rootme}/../$(target_subdir)newlib/Makefile ] ; then \
877       echo $${rootme}/../gcc/xg++ -B$${rootme}/../gcc/ -idirafter $${rootme}/$(target_subdir)newlib/targ-include -idirafter $${rootsrc}/../$(target_subdir)newlib/libc/include -nostdinc -B$${rootme}/../$(target_subdir)newlib/; \
878     else \
879       echo $${rootme}/../gcc/xg++ -B$${rootme}/../gcc/; \
880     fi; \
881   else \
882     if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
883       echo $(CXX); \
884     else \
885       t='$(program_transform_name)'; echo g++ | sed -e '' $$t; \
886     fi; \
887   fi`
888
889 # The use of $$(x_FOR_TARGET) reduces the command line length by not
890 # duplicating the lengthy definition.
891 TARGET_FLAGS_TO_PASS = \
892         "prefix=$(prefix)" \
893         "exec_prefix=$(exec_prefix)" \
894         "against=$(against)" \
895         'CC=$$(CC_FOR_TARGET)' \
896         "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
897         "CFLAGS=$(CFLAGS)" \
898         'CXX=$$(CXX_FOR_TARGET)' \
899         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
900         "CXXFLAGS=$(CXXFLAGS)" \
901         "INSTALL=$(INSTALL)" \
902         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
903         "INSTALL_DATA=$(INSTALL_DATA)" \
904         "MAKEINFO=$(MAKEINFO)" \
905         "MAKEHTML=$(MAKEHTML)" \
906         "RUNTEST=$(RUNTEST)" \
907         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
908         "FORCE_PARALLEL=$(FORCE_PARALLEL)" \
909         "TESTS=$(TESTS)"
910
911 # All source files that go into linking GDB.
912
913 # Files that should wind up in SFILES and whose corresponding .o
914 # should be in COMMON_OBS.
915 COMMON_SFILES = \
916         ada-lang.c \
917         ada-tasks.c \
918         ada-typeprint.c \
919         ada-valprint.c \
920         ada-varobj.c \
921         addrmap.c \
922         agent.c \
923         annotate.c \
924         arch-utils.c \
925         auto-load.c \
926         auxv.c \
927         ax-gdb.c \
928         ax-general.c \
929         bcache.c \
930         bfd-target.c \
931         block.c \
932         blockframe.c \
933         break-catch-sig.c \
934         break-catch-syscall.c \
935         break-catch-throw.c \
936         breakpoint.c \
937         btrace.c \
938         build-id.c \
939         buildsym-legacy.c \
940         buildsym.c \
941         c-lang.c \
942         c-typeprint.c \
943         c-valprint.c \
944         c-varobj.c \
945         charset.c \
946         cli-out.c \
947         coff-pe-read.c \
948         coffread.c \
949         common/agent.c \
950         common/btrace-common.c \
951         common/buffer.c \
952         common/cleanups.c \
953         common/common-debug.c \
954         common/common-exceptions.c \
955         common/common-regcache.c \
956         common/common-utils.c \
957         common/errors.c \
958         common/environ.c \
959         common/fileio.c \
960         common/filestuff.c \
961         common/format.c \
962         common/job-control.c \
963         common/gdb_tilde_expand.c \
964         common/gdb_vecs.c \
965         common/netstuff.c \
966         common/new-op.c \
967         common/pathstuff.c \
968         common/print-utils.c \
969         common/ptid.c \
970         common/rsp-low.c \
971         common/run-time-clock.c \
972         common/scoped_mmap.c \
973         common/signals.c \
974         common/signals-state-save-restore.c \
975         common/tdesc.c \
976         common/vec.c \
977         common/xml-utils.c \
978         complaints.c \
979         completer.c \
980         continuations.c \
981         copying.c \
982         corefile.c \
983         corelow.c \
984         cp-abi.c \
985         cp-namespace.c \
986         cp-support.c \
987         cp-valprint.c \
988         ctf.c \
989         d-lang.c \
990         d-namespace.c \
991         d-valprint.c \
992         dbxread.c \
993         dcache.c \
994         debug.c \
995         demangle.c \
996         dictionary.c \
997         disasm.c \
998         disasm-selftests.c \
999         dummy-frame.c \
1000         dwarf-index-cache.c \
1001         dwarf-index-common.c \
1002         dwarf-index-write.c \
1003         dwarf2-frame.c \
1004         dwarf2-frame-tailcall.c \
1005         dwarf2expr.c \
1006         dwarf2loc.c \
1007         dwarf2read.c \
1008         eval.c \
1009         event-loop.c \
1010         event-top.c \
1011         exceptions.c \
1012         exec.c \
1013         expprint.c \
1014         extension.c \
1015         f-lang.c \
1016         f-typeprint.c \
1017         f-valprint.c \
1018         filename-seen-cache.c \
1019         filesystem.c \
1020         findcmd.c \
1021         findvar.c \
1022         frame.c \
1023         frame-base.c \
1024         frame-unwind.c \
1025         gcore.c \
1026         gdb_bfd.c \
1027         gdb-dlfcn.c \
1028         gdb_obstack.c \
1029         gdb_regex.c \
1030         gdb_usleep.c \
1031         gdbarch.c \
1032         gdbarch-selftests.c \
1033         gdbtypes.c \
1034         gnu-v2-abi.c \
1035         gnu-v3-abi.c \
1036         go-lang.c \
1037         go-typeprint.c \
1038         go-valprint.c \
1039         inf-child.c \
1040         inf-loop.c \
1041         infcall.c \
1042         infcmd.c \
1043         inferior.c \
1044         inflow.c \
1045         infrun.c \
1046         inline-frame.c \
1047         interps.c \
1048         jit.c \
1049         language.c \
1050         linespec.c \
1051         location.c \
1052         m2-lang.c \
1053         m2-typeprint.c \
1054         m2-valprint.c \
1055         macrocmd.c \
1056         macroexp.c \
1057         macroscope.c \
1058         macrotab.c \
1059         main.c \
1060         maint.c \
1061         mdebugread.c \
1062         mem-break.c \
1063         memattr.c \
1064         memory-map.c \
1065         memrange.c \
1066         minidebug.c \
1067         minsyms.c \
1068         mipsread.c \
1069         namespace.c \
1070         objc-lang.c \
1071         objfiles.c \
1072         observable.c \
1073         opencl-lang.c \
1074         osabi.c \
1075         osdata.c \
1076         p-lang.c \
1077         p-typeprint.c \
1078         p-valprint.c \
1079         parse.c \
1080         printcmd.c \
1081         probe.c \
1082         producer.c \
1083         progspace.c \
1084         progspace-and-thread.c \
1085         prologue-value.c \
1086         psymtab.c \
1087         record.c \
1088         record-btrace.c \
1089         record-full.c \
1090         regcache.c \
1091         regcache-dump.c \
1092         reggroups.c \
1093         registry.c \
1094         remote.c \
1095         remote-fileio.c \
1096         remote-notif.c \
1097         reverse.c \
1098         rust-lang.c \
1099         sentinel-frame.c \
1100         ser-event.c \
1101         serial.c \
1102         skip.c \
1103         solib.c \
1104         solib-target.c \
1105         source.c \
1106         stabsread.c \
1107         stack.c \
1108         std-regs.c \
1109         symfile.c \
1110         symfile-debug.c \
1111         symmisc.c \
1112         symtab.c \
1113         target.c \
1114         target-dcache.c \
1115         target-descriptions.c \
1116         target-memory.c \
1117         thread.c \
1118         thread-fsm.c \
1119         tid-parse.c \
1120         top.c \
1121         tracefile.c \
1122         tracefile-tfile.c \
1123         tracepoint.c \
1124         trad-frame.c \
1125         tramp-frame.c \
1126         target-float.c \
1127         typeprint.c \
1128         ui-file.c \
1129         ui-out.c \
1130         user-regs.c \
1131         utils.c \
1132         valarith.c \
1133         valops.c \
1134         valprint.c \
1135         value.c \
1136         varobj.c \
1137         xml-support.c \
1138         xml-syscall.c \
1139         xml-tdesc.c
1140
1141 # Links made at configuration time should not be specified here, since
1142 # SFILES is used in building the distribution archive.
1143 SFILES = \
1144         ada-exp.y \
1145         arch/i386.c \
1146         c-exp.y \
1147         cp-name-parser.y \
1148         d-exp.y \
1149         dtrace-probe.c \
1150         elfread.c \
1151         f-exp.y \
1152         gdb.c \
1153         go-exp.y \
1154         m2-exp.y \
1155         p-exp.y \
1156         proc-service.list \
1157         rust-exp.y \
1158         ser-base.c \
1159         ser-unix.c \
1160         sol-thread.c \
1161         stap-probe.c \
1162         stub-termcap.c \
1163         symfile-mem.c \
1164         ui-file.h \
1165         mi/mi-common.c \
1166         $(SUBDIR_CLI_SRCS) \
1167         $(SUBDIR_TARGET_SRCS) \
1168         $(COMMON_SFILES) \
1169         $(SUBDIR_GCC_COMPILE_SRCS)
1170
1171 # Header files that need to have srcdir added.  Note that in the cases
1172 # where we use a macro like $(gdbcmd_h), things are carefully arranged
1173 # so that each .h file is listed exactly once (M-x tags-search works
1174 # wrong if TAGS has files twice).  Because this is tricky to get
1175 # right, it is probably easiest just to list .h files here directly.
1176
1177 HFILES_NO_SRCDIR = \
1178         aarch64-tdep.h \
1179         ada-lang.h \
1180         addrmap.h \
1181         alpha-bsd-tdep.h \
1182         alpha-tdep.h \
1183         amd64-darwin-tdep.h \
1184         amd64-linux-tdep.h \
1185         amd64-nat.h \
1186         amd64-tdep.h \
1187         annotate.h \
1188         arc-tdep.h \
1189         arch-utils.h \
1190         arm-linux-tdep.h \
1191         arm-tdep.h \
1192         auto-load.h \
1193         auxv.h \
1194         ax.h \
1195         ax-gdb.h \
1196         bcache.h \
1197         bfd-target.h \
1198         bfin-tdep.h \
1199         block.h \
1200         breakpoint.h \
1201         bsd-kvm.h \
1202         bsd-uthread.h \
1203         build-id.h \
1204         buildsym-legacy.h \
1205         buildsym.h \
1206         c-lang.h \
1207         charset.h \
1208         charset-list.h \
1209         cli-out.h \
1210         coff-pe-read.h \
1211         command.h \
1212         complaints.h \
1213         completer.h \
1214         cp-abi.h \
1215         cp-support.h \
1216         csky-tdep.h \
1217         ctf.h \
1218         d-lang.h \
1219         darwin-nat.h \
1220         dcache.h \
1221         defs.h \
1222         dicos-tdep.h \
1223         dictionary.h \
1224         disasm.h \
1225         dummy-frame.h \
1226         dwarf-index-cache.h \
1227         dwarf-index-common.h \
1228         dwarf2-frame.h \
1229         dwarf2-frame-tailcall.h \
1230         dwarf2expr.h \
1231         dwarf2loc.h \
1232         dwarf2read.h \
1233         event-loop.h \
1234         event-top.h \
1235         exceptions.h \
1236         exec.h \
1237         expression.h \
1238         extension.h \
1239         extension-priv.h \
1240         f-lang.h \
1241         fbsd-nat.h \
1242         fbsd-tdep.h \
1243         filesystem.h \
1244         frame.h \
1245         frame-base.h \
1246         frame-unwind.h \
1247         frv-tdep.h \
1248         ft32-tdep.h \
1249         gcore.h \
1250         gdb_bfd.h \
1251         gdb_curses.h \
1252         gdb-dlfcn.h \
1253         gdb_expat.h \
1254         gdb_obstack.h \
1255         gdb_proc_service.h \
1256         gdb_regex.h \
1257         gdb_select.h \
1258         gdb-stabs.h \
1259         gdb_usleep.h \
1260         gdb_vfork.h \
1261         gdb_wchar.h \
1262         gdbarch.h \
1263         gdbcmd.h \
1264         gdbcore.h \
1265         gdbthread.h \
1266         gdbtypes.h \
1267         glibc-tdep.h \
1268         gnu-nat.h \
1269         go-lang.h \
1270         gregset.h \
1271         hppa-bsd-tdep.h \
1272         hppa-linux-offsets.h \
1273         hppa-tdep.h \
1274         i386-bsd-nat.h \
1275         i386-darwin-tdep.h \
1276         i386-linux-nat.h \
1277         i386-linux-tdep.h \
1278         i386-tdep.h \
1279         i387-tdep.h \
1280         ia64-libunwind-tdep.h \
1281         ia64-tdep.h \
1282         inf-child.h \
1283         inf-loop.h \
1284         inf-ptrace.h \
1285         infcall.h \
1286         inferior.h \
1287         inflow.h \
1288         inline-frame.h \
1289         interps.h \
1290         jit.h \
1291         language.h \
1292         linespec.h \
1293         linux-fork.h \
1294         linux-nat.h \
1295         linux-record.h \
1296         linux-tdep.h \
1297         location.h \
1298         m2-lang.h \
1299         m32r-tdep.h \
1300         m68k-tdep.h \
1301         macroexp.h \
1302         macroscope.h \
1303         macrotab.h \
1304         main.h \
1305         mdebugread.h \
1306         memattr.h \
1307         memory-map.h \
1308         memrange.h \
1309         microblaze-tdep.h \
1310         mips-linux-tdep.h \
1311         mips-nbsd-tdep.h \
1312         mips-tdep.h \
1313         mn10300-tdep.h \
1314         moxie-tdep.h \
1315         nbsd-nat.h \
1316         nbsd-tdep.h \
1317         nds32-tdep.h \
1318         nios2-tdep.h \
1319         nto-tdep.h \
1320         objc-lang.h \
1321         objfiles.h \
1322         obsd-nat.h \
1323         obsd-tdep.h \
1324         osabi.h \
1325         osdata.h \
1326         p-lang.h \
1327         parser-defs.h \
1328         ppc-fbsd-tdep.h \
1329         ppc-linux-tdep.h \
1330         ppc-nbsd-tdep.h \
1331         ppc-obsd-tdep.h \
1332         ppc-ravenscar-thread.h \
1333         ppc-tdep.h \
1334         ppc64-tdep.h \
1335         probe.h \
1336         proc-utils.h \
1337         procfs.h \
1338         progspace.h \
1339         progspace-and-thread.h \
1340         prologue-value.h \
1341         psympriv.h \
1342         psymtab.h \
1343         ravenscar-thread.h \
1344         record.h \
1345         record-full.h \
1346         regcache.h \
1347         reggroups.h \
1348         regset.h \
1349         remote.h \
1350         remote-fileio.h \
1351         remote-notif.h \
1352         riscv-tdep.h \
1353         rs6000-aix-tdep.h \
1354         rs6000-tdep.h \
1355         s390-linux-tdep.h \
1356         s390-tdep.h \
1357         score-tdep.h \
1358         selftest-arch.h \
1359         sentinel-frame.h \
1360         ser-base.h \
1361         ser-event.h \
1362         ser-tcp.h \
1363         ser-unix.h \
1364         serial.h \
1365         sh-tdep.h \
1366         sim-regno.h \
1367         skip.h \
1368         sol2-tdep.h \
1369         solib.h \
1370         solib-aix.h \
1371         solib-darwin.h \
1372         solib-spu.h \
1373         solib-svr4.h \
1374         solib-target.h \
1375         solist.h \
1376         source.h \
1377         sparc-nat.h \
1378         sparc-ravenscar-thread.h \
1379         sparc-tdep.h \
1380         sparc64-tdep.h \
1381         spu-tdep.h \
1382         stabsread.h \
1383         stack.h \
1384         stap-probe.h \
1385         symfile.h \
1386         symtab.h \
1387         target.h \
1388         target-dcache.h \
1389         target-descriptions.h \
1390         terminal.h \
1391         tid-parse.h \
1392         top.h \
1393         tracefile.h \
1394         tracepoint.h \
1395         trad-frame.h \
1396         target-float.h \
1397         tramp-frame.h \
1398         typeprint.h \
1399         ui-file.h \
1400         ui-out.h \
1401         user-regs.h \
1402         utils.h \
1403         valprint.h \
1404         value.h \
1405         varobj.h \
1406         varobj-iter.h \
1407         vax-tdep.h \
1408         windows-nat.h \
1409         windows-tdep.h \
1410         x86-bsd-nat.h \
1411         x86-linux-nat.h \
1412         x86-nat.h \
1413         xcoffread.h \
1414         xml-support.h \
1415         xml-syscall.h \
1416         xml-tdesc.h \
1417         xtensa-tdep.h \
1418         arch/aarch64.h \
1419         arch/aarch64-insn.h \
1420         arch/arm.h \
1421         arch/i386.h \
1422         arch/ppc-linux-common.h \
1423         arch/ppc-linux-tdesc.h \
1424         cli/cli-cmds.h \
1425         cli/cli-decode.h \
1426         cli/cli-script.h \
1427         cli/cli-setshow.h \
1428         cli/cli-utils.h \
1429         common/buffer.h \
1430         common/cleanups.h \
1431         common/common-debug.h \
1432         common/common-defs.h \
1433         common/common-exceptions.h \
1434         common/common-gdbthread.h \
1435         common/common-regcache.h \
1436         common/common-types.h \
1437         common/common-utils.h \
1438         common/job-control.h \
1439         common/errors.h \
1440         common/environ.h \
1441         common/fileio.h \
1442         common/format.h \
1443         common/gdb_assert.h \
1444         common/gdb_tilde_expand.h \
1445         common/gdb_locale.h \
1446         common/gdb_setjmp.h \
1447         common/gdb_signals.h \
1448         common/gdb_sys_time.h \
1449         common/gdb_vecs.h \
1450         common/gdb_wait.h \
1451         common/common-inferior.h \
1452         common/netstuff.h \
1453         common/host-defs.h \
1454         common/pathstuff.h \
1455         common/print-utils.h \
1456         common/ptid.h \
1457         common/queue.h \
1458         common/rsp-low.h \
1459         common/run-time-clock.h \
1460         common/signals-state-save-restore.h \
1461         common/symbol.h \
1462         common/tdesc.h \
1463         common/vec.h \
1464         common/version.h \
1465         common/x86-xstate.h \
1466         common/xml-utils.h \
1467         compile/compile.h \
1468         compile/compile-c.h \
1469         compile/compile-cplus.h \
1470         compile/compile-internal.h \
1471         compile/compile-object-load.h \
1472         compile/compile-object-run.h \
1473         compile/gcc-c-plugin.h \
1474         compile/gcc-cp-plugin.h \
1475         config/nm-linux.h \
1476         config/nm-nto.h \
1477         config/djgpp/langinfo.h \
1478         config/djgpp/nl_types.h \
1479         config/i386/nm-fbsd.h \
1480         config/i386/nm-i386gnu.h \
1481         config/sparc/nm-sol2.h \
1482         gnulib/import/inttypes.in.h \
1483         gnulib/import/stddef.in.h \
1484         gnulib/import/stdint.in.h \
1485         gnulib/import/str-two-way.h \
1486         gnulib/import/string.in.h \
1487         gnulib/import/extra/snippet/arg-nonnull.h \
1488         gnulib/import/extra/snippet/c++defs.h \
1489         gnulib/import/extra/snippet/warn-on-use.h \
1490         mi/mi-cmds.h \
1491         mi/mi-common.h \
1492         mi/mi-console.h \
1493         mi/mi-getopt.h \
1494         mi/mi-main.h \
1495         mi/mi-out.h \
1496         mi/mi-parse.h \
1497         nat/aarch64-linux.h \
1498         nat/aarch64-linux-hw-point.h \
1499         nat/aarch64-sve-linux-ptrace.h \
1500         nat/amd64-linux-siginfo.h \
1501         nat/gdb_ptrace.h \
1502         nat/gdb_thread_db.h \
1503         nat/fork-inferior.h \
1504         nat/linux-btrace.h \
1505         nat/linux-namespaces.h \
1506         nat/linux-nat.h \
1507         nat/linux-osdata.h \
1508         nat/linux-personality.h \
1509         nat/linux-ptrace.h \
1510         nat/linux-waitpid.h \
1511         nat/mips-linux-watch.h \
1512         nat/ppc-linux.h \
1513         nat/x86-cpuid.h \
1514         nat/x86-dregs.h \
1515         nat/x86-gcc-cpuid.h \
1516         nat/x86-linux.h \
1517         nat/x86-linux-dregs.h \
1518         python/py-event.h \
1519         python/py-events.h \
1520         python/py-stopevent.h \
1521         python/python.h \
1522         python/python-internal.h \
1523         regformats/regdef.h \
1524         target/resume.h \
1525         target/target.h \
1526         target/wait.h \
1527         target/waitstatus.h \
1528         tui/tui.h \
1529         tui/tui-command.h \
1530         tui/tui-data.h \
1531         tui/tui-disasm.h \
1532         tui/tui-file.h \
1533         tui/tui-hooks.h \
1534         tui/tui-io.h \
1535         tui/tui-layout.h \
1536         tui/tui-regs.h \
1537         tui/tui-source.h \
1538         tui/tui-stack.h \
1539         tui/tui-win.h \
1540         tui/tui-windata.h \
1541         tui/tui-wingeneral.h \
1542         tui/tui-winsource.h \
1543         x86-tdep.h
1544
1545 # Header files that already have srcdir in them, or which are in objdir.
1546
1547 HFILES_WITH_SRCDIR = \
1548         ../bfd/bfd.h \
1549         jit-reader.h
1550
1551 # GDB "info" files, which should be included in their entirety
1552 INFOFILES = gdb.info*
1553
1554 # {X,T,NAT}DEPFILES are something of a pain in that it's hard to
1555 # default their values the way we do for SER_HARDWIRE; in the future
1556 # maybe much of the stuff now in {X,T,NAT}DEPFILES will go into other
1557 # variables analogous to SER_HARDWIRE which get defaulted in this
1558 # Makefile.in
1559
1560 DEPFILES = $(TARGET_OBS) $(SER_HARDWIRE) $(NATDEPFILES) $(SIM_OBS)
1561
1562 SOURCES = $(SFILES) $(ALLDEPFILES) $(YYFILES) $(CONFIG_SRCS)
1563 # Don't include YYFILES (*.c) because we already include *.y in SFILES,
1564 # and it's more useful to see it in the .y file.
1565 TAGFILES_NO_SRCDIR = $(SFILES) $(HFILES_NO_SRCDIR) $(ALLDEPFILES) \
1566         $(CONFIG_SRCS)
1567 TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR)
1568
1569 COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
1570         mi/mi-common.o \
1571         version.o \
1572         xml-builtin.o \
1573         $(patsubst %.c,%.o,$(COMMON_SFILES)) \
1574         $(SUBDIR_CLI_OBS) \
1575         $(SUBDIR_TARGET_OBS) \
1576         $(SUBDIR_GCC_COMPILE_OBS)
1577
1578 SUBDIRS = doc @subdirs@ data-directory $(GNULIB_BUILDDIR)
1579 CLEANDIRS = $(SUBDIRS)
1580
1581 # List of subdirectories in the build tree that must exist.
1582 # This is used to force build failures in existing trees when
1583 # a new directory is added.
1584 # The format here is for the `case' shell command.
1585 REQUIRED_SUBDIRS = doc | testsuite | $(GNULIB_BUILDDIR) | data-directory
1586
1587 # Parser intermediate files.
1588 YYFILES = \
1589         ada-exp.c \
1590         ada-lex.c \
1591         c-exp.c \
1592         cp-name-parser.c \
1593         d-exp.c \
1594         f-exp.c \
1595         go-exp.c \
1596         m2-exp.c \
1597         p-exp.c \
1598         rust-exp.c
1599
1600 # ada-lex.c is included by another file, so it shouldn't wind up as a
1601 # .o itself.
1602 YYOBJ = $(filter-out ada-lex.o,$(patsubst %.c,%.o,$(YYFILES)))
1603
1604 # Things which need to be built when making a distribution.
1605
1606 DISTSTUFF = $(YYFILES)
1607
1608
1609 # All generated files which can be included by another file.
1610 generated_files = \
1611         ada-lex.c \
1612         config.h \
1613         gcore \
1614         jit-reader.h \
1615         $(GNULIB_H) \
1616         $(NAT_GENERATED_FILES)
1617
1618 # Flags needed to compile Python code
1619 PYTHON_CFLAGS = @PYTHON_CFLAGS@
1620
1621 all: gdb$(EXEEXT) $(CONFIG_ALL) gdb-gdb.py gdb-gdb.gdb
1622         @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do
1623
1624 # Rule for compiling .c files in the top-level gdb directory.
1625 # The order-only dependencies ensure that we create the build subdirectories.
1626 %.o: %.c | $(CONFIG_DEP_SUBDIR)
1627         $(COMPILE) $<
1628         $(POSTCOMPILE)
1629
1630 $(CONFIG_DEP_SUBDIR):
1631         $(SHELL) $(srcdir)/../mkinstalldirs $@
1632
1633 # Python files need special flags.
1634 python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS)
1635
1636 # Rules for compiling .c files in the various source subdirectories.
1637 %.o: $(srcdir)/gdbtk/generic/%.c
1638         $(COMPILE) $(all_gdbtk_cflags) $<
1639         $(POSTCOMPILE)
1640
1641 %.o: ${srcdir}/nat/%.c
1642         $(COMPILE) $<
1643         $(POSTCOMPILE)
1644
1645 installcheck:
1646
1647 # The check target can not use subdir_do, because subdir_do does not
1648 # use TARGET_FLAGS_TO_PASS.
1649 check: force
1650         @if [ -f testsuite/Makefile ]; then \
1651           rootme=`pwd`; export rootme; \
1652           rootsrc=`cd $(srcdir); pwd`; export rootsrc; \
1653           cd testsuite; \
1654           $(MAKE) $(TARGET_FLAGS_TO_PASS) check; \
1655         else true; fi
1656
1657 check-perf: force
1658         @if [ -f testsuite/Makefile ]; then \
1659           rootme=`pwd`; export rootme; \
1660           rootsrc=`cd $(srcdir); pwd`; export rootsrc; \
1661           cd testsuite; \
1662           $(MAKE) $(TARGET_FLAGS_TO_PASS) check-perf; \
1663         else true; fi
1664
1665 check-read1: force
1666         @if [ -f testsuite/Makefile ]; then \
1667           rootme=`pwd`; export rootme; \
1668           rootsrc=`cd $(srcdir); pwd`; export rootsrc; \
1669           cd testsuite; \
1670           $(MAKE) $(TARGET_FLAGS_TO_PASS) check-read1; \
1671         else true; fi
1672
1673 check-parallel: force
1674         @if [ -f testsuite/Makefile ]; then \
1675           rootme=`pwd`; export rootme; \
1676           rootsrc=`cd $(srcdir); pwd`; export rootsrc; \
1677           cd testsuite; \
1678           $(MAKE) $(TARGET_FLAGS_TO_PASS) check-parallel; \
1679         else true; fi
1680
1681 # The idea is to parallelize testing of multilibs, for example:
1682 #   make -j3 check//sh-hms-sim/{-m1,-m2,-m3,-m3e,-m4}/{,-nofpu}
1683 # will run 3 concurrent sessions of check, eventually testing all 10
1684 # combinations.  GNU make is required for the % pattern to work, as is
1685 # a shell that expands alternations within braces.  If GNU make is not
1686 # used, this rule will harmlessly fail to match.  Used FORCE_PARALLEL to
1687 # prevent serialized checking due to the passed RUNTESTFLAGS.
1688 # FIXME: use config.status --config not --version, when available.
1689 check//%: force
1690         @if [ -f testsuite/config.status ]; then \
1691           rootme=`pwd`; export rootme; \
1692           rootsrc=`cd $(srcdir); pwd`; export rootsrc; \
1693           target=`echo "$@" | sed 's,//.*,,'`; \
1694           variant=`echo "$@" | sed 's,^[^/]*//,,'`; \
1695           vardots=`echo "$$variant" | sed 's,/,.,g'`; \
1696           testdir=testsuite.$$vardots; \
1697           if [ ! -f $$testdir/Makefile ] && [ -f testsuite/config.status ]; then \
1698             configargs=`cd testsuite && ./config.status --version | \
1699               sed -n -e 's,"$$,,' -e 's,^ *with options ",,p'`; \
1700             $(SHELL) $(srcdir)/../mkinstalldirs $$testdir && \
1701             (cd $$testdir && \
1702              eval $(SHELL) "\"\$$rootsrc/testsuite/configure\" $$configargs" \
1703                            "\"--srcdir=\$$rootsrc/testsuite\"" \
1704              ); \
1705           else :; fi && cd $$testdir && \
1706           $(MAKE) $(TARGET_FLAGS_TO_PASS) \
1707             RUNTESTFLAGS="--target_board=$$variant $(RUNTESTFLAGS)" \
1708             FORCE_PARALLEL=$(if $(FORCE_PARALLEL),1,$(if $(RUNTESTFLAGS),,1)) \
1709             "$$target"; \
1710         else true; fi
1711
1712 # The set of headers checked by 'check-headers' by default.
1713 CHECK_HEADERS = $(HFILES_NO_SRCDIR)
1714
1715 # Try to compile each header in isolation, thus ensuring headers are
1716 # self-contained.
1717 #
1718 # Defaults to checking all $HFILES_NO_SRCDIR headers.
1719 #
1720 # Do:
1721 #
1722 #    make check-headers CHECK_HEADERS="header.h list.h"
1723 #
1724 # to check specific headers.
1725 #
1726 check-headers:
1727         @echo Checking headers.
1728         for i in $(CHECK_HEADERS) ; do \
1729                 $(CXX) $(CXX_DIALECT) -x c++-header -c -fsyntax-only \
1730                 $(INTERNAL_CFLAGS) -include defs.h $(srcdir)/$$i ; \
1731         done
1732 .PHONY: check-headers
1733
1734 info install-info clean-info dvi pdf install-pdf html install-html: force
1735         @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
1736
1737 # Traditionally "install" depends on "all".  But it may be useful
1738 # not to; for example, if the user has made some trivial change to a
1739 # source file and doesn't care about rebuilding or just wants to save the
1740 # time it takes for make to check that all is up to date.
1741 # install-only is intended to address that need.
1742 install: all
1743         @$(MAKE) $(FLAGS_TO_PASS) install-only
1744
1745 install-only: $(CONFIG_INSTALL)
1746         transformed_name=`t='$(program_transform_name)'; \
1747                           echo gdb | sed -e "$$t"` ; \
1748                 if test "x$$transformed_name" = x; then \
1749                   transformed_name=gdb ; \
1750                 else \
1751                   true ; \
1752                 fi ; \
1753                 $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
1754                 $(INSTALL_PROGRAM) gdb$(EXEEXT) \
1755                         $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
1756                 $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \
1757                 $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h
1758         if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" != x; \
1759         then \
1760           transformed_name=`t='$(program_transform_name)'; \
1761                             echo gcore | sed -e "$$t"` ; \
1762                   if test "x$$transformed_name" = x; then \
1763                     transformed_name=gcore ; \
1764                   else \
1765                     true ; \
1766                   fi ; \
1767                   $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
1768                   $(INSTALL_SCRIPT) gcore \
1769                           $(DESTDIR)$(bindir)/$$transformed_name; \
1770         fi
1771         transformed_name=`t='$(program_transform_name)'; \
1772                           echo gdb-add-index | sed -e "$$t"` ; \
1773         if test "x$$transformed_name" = x; then \
1774           transformed_name=gdb-add-index ; \
1775         else \
1776           true ; \
1777         fi ; \
1778         $(INSTALL_PROGRAM) $(srcdir)/contrib/gdb-add-index.sh \
1779                 $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT)
1780         @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
1781
1782 install-strip:
1783         $(MAKE) $(FLAGS_TO_PASS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1784           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1785           `test -z '$(STRIP)' || \
1786             echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install-only
1787
1788 install-guile:
1789         $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/guile/gdb
1790
1791 install-python:
1792         $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
1793
1794 uninstall: force $(CONFIG_UNINSTALL)
1795         transformed_name=`t='$(program_transform_name)'; \
1796                           echo gdb | sed -e $$t` ; \
1797                 if test "x$$transformed_name" = x; then \
1798                   transformed_name=gdb ; \
1799                 else \
1800                   true ; \
1801                 fi ; \
1802                 rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
1803                       $(DESTDIR)$(man1dir)/$$transformed_name.1
1804         if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" != x; \
1805         then \
1806           transformed_name=`t='$(program_transform_name)'; \
1807                             echo gcore | sed -e "$$t"` ; \
1808                   if test "x$$transformed_name" = x; then \
1809                     transformed_name=gcore ; \
1810                   else \
1811                     true ; \
1812                   fi ; \
1813                   rm -f $(DESTDIR)$(bindir)/$$transformed_name; \
1814         fi
1815         @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
1816
1817 # The C++ name parser can be built standalone for testing.
1818 test-cp-name-parser.o: cp-name-parser.c
1819         $(COMPILE) -DTEST_CPNAMES cp-name-parser.c
1820         $(POSTCOMPILE)
1821
1822 test-cp-name-parser$(EXEEXT): test-cp-name-parser.o $(LIBIBERTY)
1823         $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) \
1824                 -o test-cp-name-parser$(EXEEXT) test-cp-name-parser.o \
1825                 $(LIBIBERTY)
1826
1827 # We do this by grepping through sources.  If that turns out to be too slow,
1828 # maybe we could just require every .o file to have an initialization routine
1829 # of a given name (top.o -> _initialize_top, etc.).
1830 #
1831 # Formatting conventions:  The name of the _initialize_* routines must start
1832 # in column zero, and must not be inside #if.
1833 #
1834 # Note that the set of files with init functions might change, or the names
1835 # of the functions might change, so this files needs to depend on all the
1836 # object files that will be linked into gdb.
1837
1838 # FIXME: There is a problem with this approach - init.c may force
1839 # unnecessary files to be linked in.
1840
1841 # FIXME: cagney/2002-06-09: gdb/564: gdb/563: Force the order so that
1842 # the first call is to _initialize_gdbtypes (implemented by explicitly
1843 # putting that function's name first in the init.l-tmp file).  This is
1844 # a hack to ensure that all the architecture dependant global
1845 # builtin_type_* variables are initialized before anything else
1846 # (per-architecture code is called in the same order that it is
1847 # registered).  The ``correct fix'' is to have all the builtin types
1848 # made part of the architecture and initialize them on-demand (using
1849 # gdbarch_data) just like everything else.  The catch is that other
1850 # modules still take the address of these builtin types forcing them
1851 # to be variables, sigh!
1852
1853 # NOTE: cagney/2003-03-18: The sed pattern ``s|^\([^ /]...'' is
1854 # anchored on the first column and excludes the ``/'' character so
1855 # that it doesn't add the $(srcdir) prefix to any file that already
1856 # has an absolute path.  It turns out that $(DEC)'s True64 make
1857 # automatically adds the $(srcdir) prefixes when it encounters files
1858 # in sub-directories such as cli/ and mi/.
1859
1860 INIT_FILES = $(COMMON_OBS)
1861 init.c: stamp-init; @true
1862 stamp-init: $(INIT_FILES)
1863         @$(ECHO_INIT_C) echo "Making init.c"
1864         @rm -f init.c-tmp init.l-tmp
1865         @touch init.c-tmp
1866         @echo gdbtypes > init.l-tmp
1867         @-LANG=C ; export LANG ; \
1868         LC_ALL=C ; export LC_ALL ; \
1869         echo $(INIT_FILES) | \
1870         tr ' ' '\012' | \
1871         sed \
1872             -e '/^gdbtypes.[co]$$/d' \
1873             -e '/^init.[co]$$/d' \
1874             -e '/version.[co]$$/d' \
1875             -e '/^[a-z0-9A-Z_]*_[SU].[co]$$/d' \
1876             -e 's/-exp\.o$$/-exp.y/' \
1877             -e 's/\.o$$/.c/' \
1878             -e 's|^\([^  /][^     ]*\)|$(srcdir)/\1|g' | \
1879         while read f; do \
1880             sed -n -e 's/^_initialize_\([a-z_0-9A-Z]*\).*/\1/p' $$f 2>/dev/null; \
1881         done >> init.l-tmp
1882         @echo '/* Do not modify this file.  */' >>init.c-tmp
1883         @echo '/* It is created automatically by the Makefile.  */'>>init.c-tmp
1884         @echo '#include "defs.h"      /* For initialize_file_ftype.  */' >>init.c-tmp
1885         @echo 'extern void initialize_all_files(void);' >>init.c-tmp
1886         @sed -e 's/\(.*\)/extern initialize_file_ftype _initialize_\1;/' <init.l-tmp >>init.c-tmp
1887         @echo 'void' >>init.c-tmp
1888         @echo 'initialize_all_files (void)' >>init.c-tmp
1889         @echo '{' >>init.c-tmp
1890         @sed -e 's/\(.*\)/  _initialize_\1 ();/' <init.l-tmp >>init.c-tmp
1891         @echo '}' >>init.c-tmp
1892         @$(SHELL) $(srcdir)/../move-if-change init.c-tmp init.c
1893         @echo stamp > stamp-init
1894
1895 .PRECIOUS: init.c
1896
1897 # Create a library of the gdb object files and build GDB by linking
1898 # against that.
1899 #
1900 # init.o is very important.  It pulls in the rest of GDB.
1901 LIBGDB_OBS = $(COMMON_OBS) init.o
1902 libgdb.a: $(LIBGDB_OBS)
1903         -rm -f libgdb.a
1904         $(AR) q libgdb.a $(LIBGDB_OBS)
1905         $(RANLIB) libgdb.a
1906
1907 # Removing the old gdb first works better if it is running, at least on SunOS.
1908 gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)
1909         $(SILENCE) rm -f gdb$(EXEEXT)
1910         $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
1911                 -o gdb$(EXEEXT) gdb.o $(LIBGDB_OBS) \
1912                 $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
1913 ifneq ($(CODESIGN_CERT),)
1914         $(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT)
1915 endif
1916
1917 # Convenience rule to handle recursion.
1918 $(LIBGNU) $(GNULIB_H): all-lib
1919 all-lib: $(GNULIB_BUILDDIR)/Makefile
1920         @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=$(GNULIB_BUILDDIR) subdir_do
1921 .PHONY: all-lib
1922
1923 # Convenience rule to handle recursion.
1924 .PHONY: all-data-directory
1925 all-data-directory: data-directory/Makefile
1926         @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=data-directory subdir_do
1927
1928 # This is useful when debugging GDB, because some Unix's don't let you run GDB
1929 # on itself without copying the executable.  So "make gdb1" will make
1930 # gdb and put a copy in gdb1, and you can run it with "gdb gdb1".
1931 # Removing gdb1 before the copy is the right thing if gdb1 is open
1932 # in another process.
1933 gdb1$(EXEEXT): gdb$(EXEEXT)
1934         rm -f gdb1$(EXEEXT)
1935         cp gdb$(EXEEXT) gdb1$(EXEEXT)
1936
1937 # Put the proper machine-specific files first, so M-. on a machine
1938 # specific routine gets the one for the correct machine.  (FIXME: those
1939 # files go in twice; we should be removing them from the main list).
1940
1941 # TAGS depends on all the files that go into it so you can rebuild TAGS
1942 # with `make TAGS' and not have to say `rm TAGS' first.
1943
1944 GDB_NM_FILE = @GDB_NM_FILE@
1945 TAGS: $(TAGFILES_NO_SRCDIR) $(TAGFILES_WITH_SRCDIR)
1946         @echo Making TAGS
1947         etags `(test -n "$(GDB_NM_FILE)" && echo "$(srcdir)/$(GDB_NM_FILE)")` \
1948         `(for i in $(DEPFILES) $(TAGFILES_NO_SRCDIR); do \
1949                 echo $(srcdir)/$$i ; \
1950         done ; for i in $(TAGFILES_WITH_SRCDIR); do \
1951                 echo $$i ; \
1952         done) | sed -e 's/\.o$$/\.c/'` \
1953         `find $(srcdir)/config -name '*.h' -print`
1954
1955 tags: TAGS
1956
1957 clean mostlyclean: $(CONFIG_CLEAN)
1958         @$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do
1959         rm -f *.o *.a *~ init.c-tmp init.l-tmp version.c-tmp
1960         rm -f init.c stamp-init version.c stamp-version
1961         rm -f gdb$(EXEEXT) core make.log
1962         rm -f gdb[0-9]$(EXEEXT)
1963         rm -f test-cp-name-parser$(EXEEXT)
1964         rm -f xml-builtin.c stamp-xml
1965         rm -f $(DEPDIR)/*
1966         for i in $(CONFIG_SRC_SUBDIR); do \
1967                 rm -f $$i/*.o;  \
1968                 rm -f $$i/$(DEPDIR)/*; \
1969         done
1970
1971 # This used to depend on c-exp.c m2-exp.c TAGS
1972 # I believe this is wrong; the makefile standards for distclean just
1973 # describe removing files; the only sort of "re-create a distribution"
1974 # functionality described is if the distributed files are unmodified.
1975 # NB: While GDBSERVER might be configured on native systems, it isn't
1976 # always included in SUBDIRS.  Remove the gdbserver files explicitly.
1977 distclean: clean
1978         @$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(CLEANDIRS)" subdir_do
1979         rm -rf $(GNULIB_BUILDDIR)
1980         rm -f gdbserver/config.status gdbserver/config.log
1981         rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h
1982         rm -f gdbserver/Makefile gdbserver/config.cache
1983         rm -f nm.h config.status config.h stamp-h b jit-reader.h
1984         rm -f gdb-gdb.py gdb-gdb.gdb
1985         rm -f y.output yacc.acts yacc.tmp y.tab.h
1986         rm -f config.log config.cache
1987         rm -f Makefile
1988         rm -rf $(DEPDIR)
1989         for i in $(CONFIG_SRC_SUBDIR); do \
1990                 if test -d $$i/$(DEPDIR); then rmdir $$i/$(DEPDIR); fi \
1991         done
1992
1993 maintainer-clean: local-maintainer-clean do-maintainer-clean distclean
1994 realclean: maintainer-clean
1995
1996 local-maintainer-clean:
1997         @echo "This command is intended for maintainers to use;"
1998         @echo "it deletes files that may require special tools to rebuild."
1999         rm -f c-exp.c \
2000                 cp-name-parser.c \
2001                 ada-lex.c ada-exp.c \
2002                 d-exp.c f-exp.c go-exp.c m2-exp.c p-exp.c rust-exp.c
2003         rm -f TAGS $(INFOFILES)
2004         rm -f $(YYFILES)
2005         rm -f nm.h config.status
2006
2007 do-maintainer-clean:
2008         @$(MAKE) $(FLAGS_TO_PASS) DO=maintainer-clean "DODIRS=$(CLEANDIRS)" \
2009                 subdir_do
2010
2011 diststuff: $(DISTSTUFF) $(PACKAGE).pot $(CATALOGS)
2012         cd doc; $(MAKE) $(MFLAGS) diststuff
2013
2014 subdir_do: force
2015         @for i in $(DODIRS); do \
2016                 case $$i in \
2017                 $(REQUIRED_SUBDIRS)) \
2018                         if [ ! -f ./$$i/Makefile ] ; then \
2019                                 echo "Missing $$i/Makefile" >&2 ; \
2020                                 exit 1 ; \
2021                         fi ;; \
2022                 esac ; \
2023                 if [ -f ./$$i/Makefile ] ; then \
2024                         if (cd ./$$i; \
2025                                 $(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
2026                         else exit 1 ; fi ; \
2027                 else true ; fi ; \
2028         done
2029
2030 Makefile: Makefile.in config.status
2031         # Regenerate the Makefile and the tm.h / nm.h links.
2032         CONFIG_FILES="Makefile" \
2033           CONFIG_COMMANDS= \
2034           CONFIG_HEADERS= \
2035           $(SHELL) config.status
2036
2037 $(GNULIB_BUILDDIR)/Makefile: gnulib/Makefile.in config.status
2038         @cd $(GNULIB_BUILDDIR); CONFIG_FILES="Makefile" \
2039           CONFIG_COMMANDS="depfiles" \
2040           CONFIG_HEADERS= \
2041           CONFIG_LINKS= \
2042           $(SHELL) config.status
2043
2044 data-directory/Makefile: data-directory/Makefile.in config.status
2045         CONFIG_FILES="data-directory/Makefile" \
2046           CONFIG_COMMANDS="depfiles" \
2047           CONFIG_HEADERS= \
2048           CONFIG_LINKS= \
2049           $(SHELL) config.status
2050
2051 .PHONY: run
2052 run: Makefile
2053         ./gdb$(EXEEXT) --data-directory=`pwd`/data-directory $(GDBFLAGS)
2054
2055 jit-reader.h: $(srcdir)/jit-reader.in
2056         $(SHELL) config.status $@
2057
2058 gcore: $(srcdir)/gcore.in
2059         $(SHELL) config.status $@
2060
2061 gdb-gdb.py: $(srcdir)/gdb-gdb.py.in
2062         $(SHELL) config.status $@
2063
2064 gdb-gdb.gdb: $(srcdir)/gdb-gdb.gdb.in
2065         $(SHELL) config.status $@
2066
2067 config.h: stamp-h ; @true
2068 stamp-h: $(srcdir)/config.in config.status
2069         CONFIG_HEADERS=config.h:config.in \
2070           CONFIG_COMMANDS="default depdir" \
2071           CONFIG_FILES= \
2072           CONFIG_LINKS= \
2073           $(SHELL) config.status
2074
2075 config.status: $(srcdir)/configure configure.nat configure.tgt configure.host ../bfd/development.sh
2076         $(SHELL) config.status --recheck
2077
2078 ACLOCAL = aclocal
2079 ACLOCAL_AMFLAGS = -I ../config
2080
2081 # Keep these in sync with the includes in acinclude.m4.
2082 aclocal_m4_deps = \
2083         configure.ac \
2084         acx_configure_dir.m4 \
2085         libmcheck.m4 \
2086         transform.m4 \
2087         ../bfd/bfd.m4 \
2088         ../config/acinclude.m4 \
2089         ../config/plugins.m4 \
2090         ../config/lead-dot.m4 \
2091         ../config/override.m4 \
2092         ../config/largefile.m4 \
2093         ../config/gettext-sister.m4 \
2094         ../config/lib-ld.m4 \
2095         ../config/lib-prefix.m4 \
2096         ../config/lib-link.m4 \
2097         ../config/acx.m4 \
2098         ../config/tcl.m4 \
2099         ../config/depstand.m4 \
2100         ../config/lcmessage.m4 \
2101         ../config/codeset.m4 \
2102         ../config/zlib.m4
2103
2104 $(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps)
2105         cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
2106
2107 AUTOCONF = autoconf
2108 configure_deps = $(srcdir)/configure.ac $(srcdir)/aclocal.m4
2109 $(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(configure_deps)
2110         cd $(srcdir) && $(AUTOCONF)
2111
2112 AUTOHEADER = autoheader
2113 $(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(configure_deps)
2114         cd $(srcdir) && $(AUTOHEADER)
2115         rm -f stamp-h
2116         touch $@
2117
2118 # automatic rebuilding in automake-generated Makefiles requires
2119 # this rule in the toplevel Makefile, which, with GNU make, causes
2120 # the desired updates through the implicit regeneration of the Makefile
2121 # and all of its prerequisites.
2122 am--refresh:
2123         @:
2124
2125 force:
2126
2127 # Documentation!
2128 # GDB QUICK REFERENCE (TeX dvi file, CM fonts)
2129 doc/refcard.dvi:
2130         cd doc; $(MAKE) refcard.dvi $(FLAGS_TO_PASS)
2131
2132 # GDB QUICK REFERENCE (PostScript output, common PS fonts)
2133 doc/refcard.ps:
2134         cd doc; $(MAKE) refcard.ps $(FLAGS_TO_PASS)
2135
2136 # GDB MANUAL: TeX dvi file
2137 doc/gdb.dvi:
2138         cd doc; $(MAKE) gdb.dvi $(FLAGS_TO_PASS)
2139
2140 # GDB MANUAL: info file
2141 doc/gdb.info:
2142         cd doc; $(MAKE) gdb.info $(FLAGS_TO_PASS)
2143
2144 # Make copying.c from COPYING
2145 $(srcdir)/copying.c: @MAINTAINER_MODE_TRUE@ $(srcdir)/../COPYING3 $(srcdir)/copying.awk
2146         awk -f $(srcdir)/copying.awk \
2147                 < $(srcdir)/../COPYING3 > $(srcdir)/copying.tmp
2148         mv $(srcdir)/copying.tmp $(srcdir)/copying.c
2149
2150 version.c: stamp-version; @true
2151 # Note that the obvious names for the temp file are taken by
2152 # create-version.sh.
2153 stamp-version: Makefile version.in $(srcdir)/../bfd/version.h $(srcdir)/common/create-version.sh
2154         $(ECHO_GEN) $(SHELL) $(srcdir)/common/create-version.sh $(srcdir) \
2155             $(host_alias) $(target_alias) version-t.t
2156         @$(SHELL) $(srcdir)/../move-if-change version-t.t version.c
2157         @echo stamp > stamp-version
2158
2159
2160 gdb.cxref: $(SFILES)
2161         cxref -I. $(SFILES) >gdb.cxref
2162
2163 force_update:
2164
2165 # GNU Make has an annoying habit of putting *all* the Makefile variables
2166 # into the environment, unless you include this target as a circumvention.
2167 # Rumor is that this will be fixed (and this target can be removed)
2168 # in GNU Make 4.0.
2169 .NOEXPORT:
2170
2171 # GNU Make 3.63 has a different problem: it keeps tacking command line
2172 # overrides onto the definition of $(MAKE).  This variable setting
2173 # will remove them.
2174 MAKEOVERRIDES =
2175
2176 ALLDEPFILES = \
2177         aarch64-fbsd-nat.c \
2178         aarch64-fbsd-tdep.c \
2179         aarch64-linux-nat.c \
2180         aarch64-linux-tdep.c \
2181         aarch64-newlib-tdep.c \
2182         aarch64-tdep.c \
2183         aix-thread.c \
2184         alpha-bsd-nat.c \
2185         alpha-bsd-tdep.c \
2186         alpha-linux-nat.c \
2187         alpha-linux-tdep.c \
2188         alpha-mdebug-tdep.c \
2189         alpha-nbsd-tdep.c \
2190         alpha-obsd-tdep.c \
2191         alpha-tdep.c \
2192         amd64-bsd-nat.c \
2193         amd64-darwin-tdep.c \
2194         amd64-dicos-tdep.c \
2195         amd64-fbsd-nat.c \
2196         amd64-fbsd-tdep.c \
2197         amd64-linux-nat.c \
2198         amd64-linux-tdep.c \
2199         amd64-nat.c \
2200         amd64-nbsd-nat.c \
2201         amd64-nbsd-tdep.c \
2202         amd64-obsd-nat.c \
2203         amd64-obsd-tdep.c \
2204         amd64-sol2-tdep.c \
2205         amd64-tdep.c \
2206         arc-tdep.c \
2207         arm.c \
2208         arm-bsd-tdep.c \
2209         arm-fbsd-nat.c \
2210         arm-fbsd-tdep.c \
2211         arm-get-next-pcs.c \
2212         arm-linux.c \
2213         arm-linux-nat.c \
2214         arm-linux-tdep.c \
2215         arm-nbsd-nat.c \
2216         arm-nbsd-tdep.c \
2217         arm-obsd-tdep.c \
2218         arm-symbian-tdep.c \
2219         arm-tdep.c \
2220         avr-tdep.c \
2221         bfin-linux-tdep.c \
2222         bfin-tdep.c \
2223         bsd-kvm.c \
2224         bsd-uthread.c \
2225         csky-linux-tdep.c \
2226         csky-tdep.c \
2227         darwin-nat.c \
2228         dicos-tdep.c \
2229         fbsd-nat.c \
2230         fbsd-tdep.c \
2231         fork-child.c \
2232         ft32-tdep.c \
2233         glibc-tdep.c \
2234         go32-nat.c \
2235         h8300-tdep.c \
2236         hppa-bsd-tdep.c \
2237         hppa-linux-nat.c \
2238         hppa-linux-tdep.c \
2239         hppa-nbsd-nat.c \
2240         hppa-nbsd-tdep.c \
2241         hppa-obsd-nat.c \
2242         hppa-obsd-tdep.c \
2243         hppa-tdep.c \
2244         i386-bsd-nat.c \
2245         i386-bsd-tdep.c \
2246         i386-cygwin-tdep.c \
2247         i386-darwin-nat.c \
2248         i386-darwin-tdep.c \
2249         i386-dicos-tdep.c \
2250         i386-fbsd-nat.c \
2251         i386-fbsd-tdep.c \
2252         i386-gnu-nat.c \
2253         i386-gnu-tdep.c \
2254         i386-linux-nat.c \
2255         i386-linux-tdep.c \
2256         i386-nbsd-nat.c \
2257         i386-nbsd-tdep.c \
2258         i386-obsd-nat.c \
2259         i386-obsd-tdep.c \
2260         i386-sol2-nat.c \
2261         i386-sol2-tdep.c \
2262         i386-tdep.c \
2263         i386-v4-nat.c \
2264         i387-tdep.c \
2265         ia64-libunwind-tdep.c \
2266         ia64-linux-nat.c \
2267         ia64-linux-tdep.c \
2268         ia64-tdep.c \
2269         ia64-vms-tdep.c \
2270         inf-ptrace.c \
2271         linux-fork.c \
2272         linux-record.c \
2273         linux-tdep.c \
2274         lm32-tdep.c \
2275         m32r-linux-nat.c \
2276         m32r-linux-tdep.c \
2277         m32r-tdep.c \
2278         m68hc11-tdep.c \
2279         m68k-bsd-nat.c \
2280         m68k-bsd-tdep.c \
2281         m68k-linux-nat.c \
2282         m68k-linux-tdep.c \
2283         m68k-tdep.c \
2284         microblaze-linux-tdep.c \
2285         microblaze-tdep.c \
2286         mingw-hdep.c \
2287         mips-fbsd-nat.c \
2288         mips-fbsd-tdep.c \
2289         mips-linux-nat.c \
2290         mips-linux-tdep.c \
2291         mips-nbsd-nat.c \
2292         mips-nbsd-tdep.c \
2293         mips-sde-tdep.c \
2294         mips-tdep.c \
2295         mips64-obsd-nat.c \
2296         mips64-obsd-tdep.c \
2297         msp430-tdep.c \
2298         nbsd-nat.c \
2299         nbsd-tdep.c \
2300         nds32-tdep.c \
2301         nios2-linux-tdep.c \
2302         nios2-tdep.c \
2303         obsd-nat.c \
2304         obsd-tdep.c \
2305         posix-hdep.c \
2306         ppc-fbsd-nat.c \
2307         ppc-fbsd-tdep.c \
2308         ppc-linux-nat.c \
2309         ppc-linux-tdep.c \
2310         ppc-nbsd-nat.c \
2311         ppc-nbsd-tdep.c \
2312         ppc-obsd-nat.c \
2313         ppc-obsd-tdep.c \
2314         ppc-ravenscar-thread.c \
2315         ppc-sysv-tdep.c \
2316         ppc64-tdep.c \
2317         procfs.c \
2318         ravenscar-thread.c \
2319         remote-sim.c \
2320         riscv-linux-nat.c \
2321         riscv-linux-tdep.c \
2322         riscv-tdep.c \
2323         rl78-tdep.c \
2324         rs6000-lynx178-tdep.c \
2325         rs6000-nat.c \
2326         rs6000-tdep.c \
2327         rx-tdep.c \
2328         s390-linux-nat.c \
2329         s390-linux-tdep.c \
2330         s390-tdep.c \
2331         score-tdep.c \
2332         ser-go32.c \
2333         ser-mingw.c \
2334         ser-pipe.c \
2335         ser-tcp.c \
2336         sh-nbsd-nat.c \
2337         sh-nbsd-tdep.c \
2338         sh-tdep.c \
2339         sol2-tdep.c \
2340         solib-aix.c \
2341         solib-spu.c \
2342         solib-svr4.c \
2343         sparc-linux-nat.c \
2344         sparc-linux-tdep.c \
2345         sparc-nat.c \
2346         sparc-nbsd-nat.c \
2347         sparc-nbsd-tdep.c \
2348         sparc-obsd-tdep.c \
2349         sparc-ravenscar-thread.c \
2350         sparc-sol2-nat.c \
2351         sparc-sol2-tdep.c \
2352         sparc-tdep.c \
2353         sparc64-fbsd-nat.c \
2354         sparc64-fbsd-tdep.c \
2355         sparc64-linux-nat.c \
2356         sparc64-linux-tdep.c \
2357         sparc64-nat.c \
2358         sparc64-nbsd-nat.c \
2359         sparc64-nbsd-tdep.c \
2360         sparc64-obsd-nat.c \
2361         sparc64-obsd-tdep.c \
2362         sparc64-sol2-tdep.c \
2363         sparc64-tdep.c \
2364         spu-linux-nat.c \
2365         spu-multiarch.c \
2366         spu-tdep.c \
2367         tilegx-linux-nat.c \
2368         tilegx-linux-tdep.c \
2369         tilegx-tdep.c \
2370         v850-tdep.c \
2371         vax-bsd-nat.c \
2372         vax-nbsd-tdep.c \
2373         vax-tdep.c \
2374         windows-nat.c \
2375         windows-tdep.c \
2376         x86-nat.c \
2377         x86-tdep.c \
2378         xcoffread.c \
2379         xstormy16-tdep.c \
2380         xtensa-config.c \
2381         xtensa-linux-nat.c \
2382         xtensa-linux-tdep.c \
2383         xtensa-tdep.c \
2384         xtensa-xtregs.c \
2385         common/mingw-strerror.c \
2386         common/posix-strerror.c
2387
2388 # Some files need explicit build rules (due to -Werror problems) or due
2389 # to sub-directory fun 'n' games.
2390
2391 # Do not try to build "printcmd.c" with -Wformat-nonliteral.  It manually
2392 # checks format strings.
2393 printcmd.o: $(srcdir)/printcmd.c
2394         $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) \
2395                 $(GDB_WARN_CFLAGS_NO_FORMAT) $(COMPILE.post) \
2396                 $(srcdir)/printcmd.c
2397         $(POSTCOMPILE)
2398
2399 # Same for "target-float.c".
2400 target-float.o: $(srcdir)/target-float.c
2401         $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) \
2402                 $(GDB_WARN_CFLAGS_NO_FORMAT) $(COMPILE.post) \
2403                 $(srcdir)/target-float.c
2404
2405 # ada-exp.c can appear in srcdir, for releases; or in ., for
2406 # development builds.
2407 ADA_EXP_C = `if test -f ada-exp.c; then echo ada-exp.c; else echo $(srcdir)/ada-exp.c; fi`
2408
2409 # Some versions of flex give output that triggers
2410 # -Wold-style-definition.
2411 ada-exp.o: ada-exp.c
2412         $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) \
2413                 $(GDB_WARN_CFLAGS_NO_DEFS) $(COMPILE.post) $(ADA_EXP_C)
2414         $(POSTCOMPILE)
2415
2416 # Message files.  Based on code in gcc/Makefile.in.
2417
2418 # Rules for generating translated message descriptions.  Disabled by
2419 # autoconf if the tools are not available.
2420
2421 .PHONY: all-po install-po uninstall-po clean-po update-po $(PACKAGE).pot
2422
2423 all-po: $(CATALOGS)
2424
2425 # This notation should be acceptable to all Make implementations used
2426 # by people who are interested in updating .po files.
2427 update-po: $(CATALOGS:.gmo=.pox)
2428
2429 # N.B. We do not attempt to copy these into $(srcdir).  The snapshot
2430 # script does that.
2431 %.gmo: %.po
2432         -test -d po || mkdir po
2433         $(GMSGFMT) --statistics -o $@ $<
2434
2435 # The new .po has to be gone over by hand, so we deposit it into
2436 # build/po with a different extension.  If build/po/$(PACKAGE).pot
2437 # exists, use it (it was just created), else use the one in srcdir.
2438 %.pox: %.po
2439         -test -d po || mkdir po
2440         $(MSGMERGE) $< `if test -f po/$(PACKAGE).pot; \
2441                         then echo po/$(PACKAGE).pot; \
2442                         else echo $(srcdir)/po/$(PACKAGE).pot; fi` -o $@
2443
2444 # This rule has to look for .gmo modules in both srcdir and the cwd,
2445 # and has to check that we actually have a catalog for each language,
2446 # in case they weren't built or included with the distribution.
2447 install-po:
2448         $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(datadir)
2449         cats="$(CATALOGS)"; for cat in $$cats; do \
2450           lang=`basename $$cat | sed 's/\.gmo$$//'`; \
2451           if [ -f $$cat ]; then :; \
2452           elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \
2453           else continue; \
2454           fi; \
2455           dir=$(localedir)/$$lang/LC_MESSAGES; \
2456           echo $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$$dir; \
2457           $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$$dir || exit 1; \
2458           echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
2459           $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
2460         done
2461 uninstall-po:
2462         cats="$(CATALOGS)"; for cat in $$cats; do \
2463           lang=`basename $$cat | sed 's/\.gmo$$//'`; \
2464           if [ -f $$cat ]; then :; \
2465           elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \
2466           else continue; \
2467           fi; \
2468           dir=$(localedir)/$$lang/LC_MESSAGES; \
2469           rm -f $(DESTDIR)$$dir/$(PACKAGE).mo; \
2470         done
2471 # Delete po/*.gmo only if we are not building in the source directory.
2472 clean-po:
2473         -if [ ! -f Makefile.in ]; then rm -f po/*.gmo; fi
2474
2475 # Rule for regenerating the message template (gdb.pot).  Instead of
2476 # forcing everyone to edit POTFILES.in, which proved impractical, this
2477 # rule has no dependencies and always regenerates gdb.pot.  This is
2478 # relatively harmless since the .po files do not directly depend on
2479 # it.  The .pot file is left in the build directory.  Since GDB's
2480 # Makefile lacks a cannonical list of sources (missing xm, tm and nm
2481 # files) force this rule.
2482 $(PACKAGE).pot: po/$(PACKAGE).pot
2483 po/$(PACKAGE).pot: force
2484         -test -d po || mkdir po
2485         sh -e $(srcdir)/po/gdbtext $(XGETTEXT) $(PACKAGE) . $(srcdir)
2486
2487
2488 #
2489 # YACC/LEX dependencies
2490 #
2491 # LANG-exp.c is generated in objdir from LANG-exp.y if it doesn't
2492 # exist in srcdir, then compiled in objdir to LANG-exp.o.  If we
2493 # said LANG-exp.c rather than ./c-exp.c some makes would
2494 # sometimes re-write it into $(srcdir)/c-exp.c.  Remove bogus
2495 # decls for malloc/realloc/free which conflict with everything else.
2496 # Strictly speaking c-exp.c should therefore depend on
2497 # Makefile.in, but that was a pretty big annoyance.
2498
2499 %.c: %.y
2500         $(ECHO_YACC) $(SHELL) $(YLWRAP) $< y.tab.c $@.tmp -- \
2501                 $(YACC) $(YFLAGS) || (rm -f $@.tmp; false)
2502         @sed -e '/extern.*malloc/d' \
2503              -e '/extern.*realloc/d' \
2504              -e '/extern.*free/d' \
2505              -e '/include.*malloc.h/d' \
2506              -e 's/\([^x]\)malloc/\1xmalloc/g' \
2507              -e 's/\([^x]\)realloc/\1xrealloc/g' \
2508              -e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
2509              -e 's/\([ \t;,(]\)free$$/\1xfree/g' \
2510              -e '/^#line.*y.tab.c/d' \
2511              -e 's/YY_NULL/YY_NULLPTR/g' \
2512           < $@.tmp > $@.new && \
2513           rm -f $@.tmp && \
2514           mv $@.new $@
2515 %.c: %.l
2516         $(ECHO_LEX) $(FLEX) -t $<  \
2517             | sed -e '/extern.*malloc/d' \
2518                 -e '/extern.*realloc/d' \
2519                 -e '/extern.*free/d' \
2520                 -e '/include.*malloc.h/d' \
2521                 -e 's/\([^x]\)malloc/\1xmalloc/g' \
2522                 -e 's/\([^x]\)realloc/\1xrealloc/g' \
2523                 -e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
2524                 -e 's/\([ \t;,(]\)free$$/\1xfree/g' \
2525                 -e 's/yy_flex_xrealloc/yyxrealloc/g' \
2526               > $@.new && \
2527             mv $@.new $@
2528
2529 .PRECIOUS: ada-lex.c
2530
2531 # XML rules
2532
2533 xml-builtin.c: stamp-xml; @true
2534 stamp-xml: $(srcdir)/features/feature_to_c.sh Makefile $(XMLFILES)
2535         $(SILENCE) rm -f xml-builtin.tmp
2536         $(ECHO_GEN_XML_BUILTIN) AWK="$(AWK)" \
2537           $(SHELL) $(srcdir)/features/feature_to_c.sh \
2538           xml-builtin.tmp $(XMLFILES)
2539         $(SILENCE) $(SHELL) $(srcdir)/../move-if-change xml-builtin.tmp xml-builtin.c
2540         $(SILENCE) echo stamp > stamp-xml
2541
2542 .PRECIOUS: xml-builtin.c
2543
2544 #
2545 # GDBTK sub-directory
2546 #
2547
2548 all-gdbtk: insight$(EXEEXT)
2549
2550 install-gdbtk:
2551         transformed_name=`t='$(program_transform_name)'; \
2552                   echo insight | sed -e $$t` ; \
2553         if test "x$$transformed_name" = x; then \
2554           transformed_name=insight ; \
2555         else \
2556           true ; \
2557         fi ; \
2558         $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir); \
2559         $(INSTALL_PROGRAM) insight$(EXEEXT) \
2560                 $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
2561         $(SHELL) $(srcdir)/../mkinstalldirs \
2562                 $(DESTDIR)$(GDBTK_LIBRARY) ; \
2563         $(SHELL) $(srcdir)/../mkinstalldirs \
2564                 $(DESTDIR)$(libdir)/insight$(GDBTK_VERSION) ; \
2565         $(INSTALL_DATA) $(srcdir)/gdbtk/plugins/plugins.tcl \
2566                 $(DESTDIR)$(libdir)/insight$(GDBTK_VERSION)/plugins.tcl ; \
2567         $(SHELL) $(srcdir)/../mkinstalldirs \
2568                 $(DESTDIR)$(GDBTK_LIBRARY)/images \
2569                 $(DESTDIR)$(GDBTK_LIBRARY)/images2 ; \
2570         $(SHELL) $(srcdir)/../mkinstalldirs \
2571                 $(DESTDIR)$(GDBTK_LIBRARY)/help \
2572                 $(DESTDIR)$(GDBTK_LIBRARY)/help/images \
2573                 $(DESTDIR)$(GDBTK_LIBRARY)/help/trace ; \
2574         cd $(srcdir)/gdbtk/library ; \
2575         for i in *.tcl *.itcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html  help/trace/*.html help/trace/index.toc help/images/*.gif help/images/*.png; \
2576           do \
2577                 $(INSTALL_DATA) $$i $(DESTDIR)$(GDBTK_LIBRARY)/$$i ; \
2578           done ;
2579
2580 uninstall-gdbtk:
2581         transformed_name=`t='$(program_transform_name)'; \
2582                   echo insight | sed -e $$t` ; \
2583         if test "x$$transformed_name" = x; then \
2584                 transformed_name=insight ; \
2585         else \
2586                 true ; \
2587         fi ; \
2588         rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
2589         rm -rf $(DESTDIR)$(GDBTK_LIBRARY)
2590
2591 clean-gdbtk:
2592         rm -f insight$(EXEEXT)
2593
2594 # Removing the old gdb first works better if it is running, at least on SunOS.
2595 insight$(EXEEXT): gdbtk-main.o libgdb.a $(CDEPS) $(TDEPLIBS)
2596         rm -f insight$(EXEEXT)
2597         $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
2598                 -o insight$(EXEEXT) gdbtk-main.o libgdb.a \
2599                 $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
2600
2601 gdbres.o: $(srcdir)/gdbtk/gdb.rc $(srcdir)/gdbtk/gdbtool.ico
2602         $(WINDRES) --include $(srcdir)/gdbtk $(srcdir)/gdbtk/gdb.rc gdbres.o
2603
2604 all_gdbtk_cflags = $(IDE_CFLAGS) $(ITCL_CFLAGS) \
2605                 $(ITK_CFLAGS) $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \
2606                 $(GDBTK_CFLAGS) \
2607                 -DGDBTK_LIBRARY=\"$(GDBTK_LIBRARY)\" \
2608                 -DSRC_DIR=\"$(GDBTK_SRC_DIR)\"
2609
2610 #
2611 # Dependency tracking.
2612 #
2613
2614 ifeq ($(DEPMODE),depmode=gcc3)
2615 # Note that we put the dependencies into a .Tpo file, then move them
2616 # into place if the compile succeeds.  We need this because gcc does
2617 # not atomically write the dependency output file.
2618 override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \
2619         -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo
2620 override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \
2621         $(@D)/$(DEPDIR)/$(basename $(@F)).Po
2622 else
2623 override COMPILE.pre = source='$<' object='$@' libtool=no \
2624         DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) \
2625         $(CXX) -x c++ $(CXX_DIALECT)
2626 # depcomp handles atomicity for us, so we don't need a postcompile
2627 # step.
2628 override POSTCOMPILE =
2629 endif
2630
2631 # A list of all the objects we might care about in this build, for
2632 # dependency tracking.
2633 all_object_files = gdb.o $(LIBGDB_OBS) gdbtk-main.o \
2634         test-cp-name-parser.o
2635
2636 # All the .deps files to include.
2637 all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
2638     $(dir $(dep))/$(DEPDIR)/$(notdir $(dep)))
2639
2640 # Ensure that generated files are created early.  Use order-only
2641 # dependencies if available.  They require GNU make 3.80 or newer,
2642 # and the .VARIABLES variable was introduced at the same time.
2643 ifdef .VARIABLES
2644 $(all_object_files): | $(generated_files)
2645 else
2646 $(all_object_files) : $(generated_files)
2647 endif
2648
2649 # Dependencies.
2650 -include $(all_deps_files)
2651
2652 # Disable implicit make rules.
2653 include $(srcdir)/disable-implicit-rules.mk
2654
2655 ### end of the gdb Makefile.in.