1 # Copyright (C) 1989-2024 Free Software Foundation, Inc.
3 # This file is part of GDB.
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.
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.
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/>.
18 # Please keep lists in this file sorted alphabetically, with one item per line.
19 # See gdb/Makefile.in for guidelines on ordering files and directories.
22 exec_prefix = @
exec_prefix@
24 host_alias
= @host_noncanonical@
25 target_alias
= @target_noncanonical@
26 program_transform_name
= @program_transform_name@
30 CONFIG_SRC_SUBDIR
= @CONFIG_SRC_SUBDIR@
32 install_sh
= @install_sh@
38 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
39 INSTALL_STRIP_PROGRAM
= @INSTALL_STRIP_PROGRAM@
40 INSTALL_DATA
= @INSTALL_DATA@
45 CXX_DIALECT
= @CXX_DIALECT@
50 # Dependency tracking information.
53 depcomp
= $(SHELL
) $(srcdir)/..
/depcomp
55 # Directory containing source files. Don't clean up the spacing,
56 # this exact string is matched for by the "configure" script.
58 abs_top_srcdir
= @abs_top_srcdir@
59 abs_srcdir
= @abs_srcdir@
64 include $(srcdir)/..
/gdb
/silent-rules.mk
66 # Note that these are overridden by GNU make-specific code below if
67 # GNU make is used. The overrides implement dependency tracking.
68 COMPILE.pre
= $(CXX
) $(CXX_DIALECT
)
69 COMPILE.post
= -c
-o
$@
72 INCLUDE_SERVER_H
= -include $(srcdir)/server.h
74 # CXXFLAGS is at the very end on purpose, so that user-supplied flags can
75 # override internal flags.
76 COMPILE
= $(ECHO_CXX
) $(COMPILE.pre
) $(INTERNAL_CFLAGS
) $(INCLUDE_SERVER_H
) \
77 $(CXXFLAGS
) $(COMPILE.post
)
79 # It is also possible that you will need to add -I/usr/include/sys to the
80 # CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
81 # is where it should be according to Posix).
83 # Set this up with gcc if you have gnu ld and the loader will print out
84 # line numbers for undefinded refs.
86 CC_LD
= $(CXX
) $(CXX_DIALECT
)
88 # Where is the "include" directory? Traditionally ../include or ./include
89 INCLUDE_DIR
= ${srcdir}/..
/include
90 INCLUDE_DEP
= $$(INCLUDE_DIR
)
92 LIBIBERTY_BUILDDIR
= ..
/libiberty
93 LIBIBERTY_NORMAL
= $(LIBIBERTY_BUILDDIR
)/libiberty.a
94 LIBIBERTY_NOASAN
= $(LIBIBERTY_BUILDDIR
)/noasan
/libiberty.a
95 LIBIBERTY_PIC
= $(LIBIBERTY_BUILDDIR
)/pic
/libiberty.a
96 LIBIBERTY_FOR_SHLIB
= \
97 $(if
$(wildcard $(LIBIBERTY_NOASAN
)),\
99 $(if
$(wildcard $(LIBIBERTY_PIC
)),\
101 $(LIBIBERTY_NORMAL
)))
102 LIBIBERTY
= $(LIBIBERTY_NORMAL
)
104 GDBSUPPORT_BUILDDIR
= ..
/gdbsupport
105 GDBSUPPORT
= $(GDBSUPPORT_BUILDDIR
)/libgdbsupport.a
107 # Where is ust? These will be empty if ust was not available.
112 GNULIB_PARENT_DIR
= ..
113 include $(GNULIB_PARENT_DIR
)/gnulib
/Makefile.gnulib.inc
115 # Where is the INTL library? Typically in ../intl.
117 INTL_DEPS
= @LIBINTL_DEP@
118 INTL_CFLAGS
= @INCINTL@
124 # All the includes used for CFLAGS and for lint.
125 # -I. for config files.
126 # -I${srcdir} for our headers.
127 # -I$(srcdir)/../gdb/regformats for regdef.h.
129 # We do not include ../target or ../nat in here because headers
130 # in those directories should be included with the subdirectory.
131 # e.g.: "target/wait.h".
136 -I
$(srcdir)/..
/gdb
/regformats \
144 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
145 # from the config/ directory.
146 GLOBAL_CFLAGS
= ${MT_CFLAGS} ${MH_CFLAGS}
147 #PROFILE_CFLAGS = -pg
149 WARN_CFLAGS
= @WARN_CFLAGS@
150 WERROR_CFLAGS
= @WERROR_CFLAGS@
152 WARN_CFLAGS_NO_FORMAT
= `echo " $(WARN_CFLAGS) " \
153 | sed "s/ -Wformat-nonliteral / -Wno-format-nonliteral /g"`
155 # These are specifically reserved for setting from the command line
156 # when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
158 CXXFLAGS
= @CXXFLAGS@
159 CPPFLAGS
= @CPPFLAGS@
161 PTHREAD_CFLAGS
= @PTHREAD_CFLAGS@
162 PTHREAD_LIBS
= @PTHREAD_LIBS@
164 WIN32APILIBS
= @WIN32APILIBS@
166 MAYBE_LIBICONV
= @MAYBE_LIBICONV@
168 # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
179 # LDFLAGS is specifically reserved for setting from the command line
182 INTERNAL_LDFLAGS
= $(LDFLAGS
) @RDYNAMIC@
184 # All source files that go into linking GDB remote server.
189 $(srcdir)/gdbreplay.
cc \
190 $(srcdir)/hostio.
cc \
191 $(srcdir)/i387-fp.
cc \
192 $(srcdir)/inferiors.
cc \
193 $(srcdir)/linux-aarch64-low.
cc \
194 $(srcdir)/linux-arc-low.
cc \
195 $(srcdir)/linux-arm-low.
cc \
196 $(srcdir)/linux-csky-low.
cc \
197 $(srcdir)/linux-ia64-low.
cc \
198 $(srcdir)/linux-loongarch-low.
cc \
199 $(srcdir)/linux-low.
cc \
200 $(srcdir)/linux-m68k-low.
cc \
201 $(srcdir)/linux-mips-low.
cc \
202 $(srcdir)/linux-nios2-low.
cc \
203 $(srcdir)/linux-or1k-low.
cc \
204 $(srcdir)/linux-ppc-low.
cc \
205 $(srcdir)/linux-riscv-low.
cc \
206 $(srcdir)/linux-s390-low.
cc \
207 $(srcdir)/linux-sh-low.
cc \
208 $(srcdir)/linux-sparc-low.
cc \
209 $(srcdir)/linux-x86-low.
cc \
210 $(srcdir)/linux-xtensa-low.
cc \
211 $(srcdir)/mem-break.
cc \
212 $(srcdir)/netbsd-aarch64-low.
cc \
213 $(srcdir)/netbsd-amd64-low.
cc \
214 $(srcdir)/netbsd-i386-low.
cc \
215 $(srcdir)/netbsd-low.
cc \
216 $(srcdir)/netbsd-low.h \
217 $(srcdir)/proc-service.
cc \
218 $(srcdir)/proc-service.list \
219 $(srcdir)/regcache.
cc \
220 $(srcdir)/remote-utils.
cc \
221 $(srcdir)/server.
cc \
222 $(srcdir)/symbol.
cc \
223 $(srcdir)/target.
cc \
224 $(srcdir)/thread-db.
cc \
226 $(srcdir)/win32-i386-low.
cc \
227 $(srcdir)/win32-low.
cc \
228 $(srcdir)/x86-low.
cc \
229 $(srcdir)/..
/gdb
/alloc.c \
230 $(srcdir)/..
/gdb
/arch
/arc.c \
231 $(srcdir)/..
/gdb
/arch
/arm.c \
232 $(srcdir)/..
/gdb
/arch
/arm-get-next-pcs.c \
233 $(srcdir)/..
/gdb
/arch
/arm-linux.c \
234 $(srcdir)/..
/gdb
/arch
/csky.c \
235 $(srcdir)/..
/gdb
/arch
/loongarch.c \
236 $(srcdir)/..
/gdb
/arch
/ppc-linux-common.c \
237 $(srcdir)/..
/gdb
/arch
/riscv.c \
238 $(srcdir)/..
/gdb
/nat
/aarch64-mte-linux-ptrace.c \
239 $(srcdir)/..
/gdb
/nat
/aarch64-scalable-linux-ptrace.c \
240 $(srcdir)/..
/gdb
/nat
/linux-btrace.c \
241 $(srcdir)/..
/gdb
/nat
/linux-namespaces.c \
242 $(srcdir)/..
/gdb
/nat
/linux-osdata.c \
243 $(srcdir)/..
/gdb
/nat
/linux-personality.c \
244 $(srcdir)/..
/gdb
/nat
/mips-linux-watch.c \
245 $(srcdir)/..
/gdb
/nat
/ppc-linux.c \
246 $(srcdir)/..
/gdb
/nat
/riscv-linux-tdesc.c \
247 $(srcdir)/..
/gdb
/nat
/fork-inferior.c \
248 $(srcdir)/..
/gdb
/target
/target.c \
249 $(srcdir)/..
/gdb
/target
/waitstatus.c
251 DEPFILES
= @GDBSERVER_DEPFILES@
256 TAGFILES
= $(SOURCES
)
277 target
/waitstatus.o \
287 GDBSERVER_LIBS
= @GDBSERVER_LIBS@
$(PTHREAD_LIBS
)
289 CDEPS
= $(srcdir)/proc-service.list
291 # XML files to compile in to gdbserver, if any.
292 XML_DIR
= $(srcdir)/..
/gdb
/features
293 XML_FILES
= @srv_xmlfiles@
294 XML_BUILTIN
= @srv_xmlbuiltin@
296 IPA_DEPFILES
= @IPA_DEPFILES@
297 extra_libraries
= @extra_libraries@
301 "exec_prefix=$(exec_prefix)" \
303 "DESTDIR=$(DESTDIR)" \
305 "AR_FLAGS=$(AR_FLAGS)" \
309 "CXXFLAGS=$(CXXFLAGS)" \
310 "DLLTOOL=$(DLLTOOL)" \
311 "LDFLAGS=$(LDFLAGS)" \
313 "MAKEINFO=$(MAKEINFO)" \
314 "MAKEHTML=$(MAKEHTML)" \
315 "MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
316 "INSTALL=$(INSTALL)" \
317 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
318 "INSTALL_DATA=$(INSTALL_DATA)" \
319 "RUNTEST=$(RUNTEST)" \
320 "RUNTESTFLAGS=$(RUNTESTFLAGS)"
322 # All generated files which can be included by another file.
323 generated_files
= config.h
325 all: gdbserver
$(EXEEXT
) gdbreplay
$(EXEEXT
) $(extra_libraries
)
327 # Traditionally "install" depends on "all". But it may be useful
328 # not to; for example, if the user has made some trivial change to a
329 # source file and doesn't care about rebuilding or just wants to save the
330 # time it takes for make to check that all is up to date.
331 # install-only is intended to address that need.
333 @
$(MAKE
) $(FLAGS_TO_PASS
) install-only
336 n
=`echo gdbserver | sed '$(program_transform_name)'`; \
337 if
[ x
$$n = x
]; then n
=gdbserver
; else true
; fi
; \
338 if
[ x
"$(IPA_DEPFILES)" != x
]; then \
339 $(SHELL
) $(srcdir)/..
/mkinstalldirs
$(DESTDIR
)$(libdir); \
340 $(INSTALL_PROGRAM_ENV
) $(INSTALL_PROGRAM
) $(IPA_LIB
) $(DESTDIR
)$(libdir)/$(IPA_LIB
); \
342 $(SHELL
) $(srcdir)/..
/mkinstalldirs
$(DESTDIR
)$(bindir); \
343 $(INSTALL_PROGRAM_ENV
) $(INSTALL_PROGRAM
) gdbserver
$(EXEEXT
) $(DESTDIR
)$(bindir)/$$n$(EXEEXT
)
346 $(MAKE
) $(FLAGS_TO_PASS
) INSTALL_PROGRAM
="$(INSTALL_STRIP_PROGRAM)" \
347 install_sh_PROGRAM
="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG
=-s \
348 `test -z '$(STRIP)' || \
349 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install-only
352 n
=`echo gdbserver | sed '$(program_transform_name)'`; \
353 if
[ x
$$n = x
]; then n
=gdbserver
; else true
; fi
; \
354 if
[ x
"$(IPA_DEPFILES)" != x
]; then \
355 rm -f
$(DESTDIR
)$(libdir)/$(IPA_LIB
); \
357 rm -f
$(DESTDIR
)/$(bindir)/$$n$(EXEEXT
)
369 gdbserver
$(EXEEXT
): $(sort $(OBS
)) ${CDEPS} $(LIBGNU
) $(LIBIBERTY
) \
370 $(INTL_DEPS
) $(GDBSUPPORT
)
371 $(SILENCE
) rm -f gdbserver
$(EXEEXT
)
372 $(ECHO_CXXLD
) $(CC_LD
) $(INTERNAL_CFLAGS
) $(INTERNAL_LDFLAGS
) \
374 -o gdbserver
$(EXEEXT
) $(OBS
) $(GDBSUPPORT
) $(LIBGNU
) \
375 $(LIBGNU_EXTRA_LIBS
) $(LIBIBERTY
) $(INTL
) \
376 $(GDBSERVER_LIBS
) $(XM_CLIBS
) $(WIN32APILIBS
) $(MAYBE_LIBICONV
)
378 gdbreplay
$(EXEEXT
): $(sort $(GDBREPLAY_OBS
)) $(LIBGNU
) $(LIBIBERTY
) \
379 $(INTL_DEPS
) $(GDBSUPPORT
)
380 $(SILENCE
) rm -f gdbreplay
$(EXEEXT
)
381 $(ECHO_CXXLD
) $(CC_LD
) $(INTERNAL_CFLAGS
) $(INTERNAL_LDFLAGS
) \
383 -o gdbreplay
$(EXEEXT
) $(GDBREPLAY_OBS
) $(XM_CLIBS
) \
384 $(GDBSUPPORT
) $(LIBGNU
) $(LIBGNU_EXTRA_LIBS
) \
385 $(LIBIBERTY
) $(INTL
) $(WIN32APILIBS
)
390 gdbsupport
/common-utils-ipa.o \
391 gdbsupport
/errors-ipa.o \
392 gdbsupport
/format-ipa.o \
393 gdbsupport
/print-utils-ipa.o \
394 gdbsupport
/rsp-low-ipa.o \
395 gdbsupport
/safe-strerror-ipa.o \
396 gdbsupport
/tdesc-ipa.o \
404 IPA_LIB
= libinproctrace.so
406 $(IPA_LIB
): $(sort $(IPA_OBJS
)) ${CDEPS}
407 $(SILENCE
) rm -f
$(IPA_LIB
)
408 $(ECHO_CXXLD
) $(CC_LD
) -shared
-fPIC
-Wl
,--soname
=$(IPA_LIB
) \
409 -Wl
,--no-undefined
$(INTERNAL_CFLAGS
) $(INTERNAL_LDFLAGS
) \
411 -o
$(IPA_LIB
) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB
) -ldl
-pthread
413 # Put the proper machine-specific files first, so M-. on a machine
414 # specific routine gets the one for the correct machine.
415 # The xyzzy stuff below deals with empty DEPFILES
418 `for i in yzzy ${DEPFILES}; do \
419 if [ x$$i != xyzzy ]; then \
420 echo ${srcdir}/$$i | \
421 sed -e 's,/\(\(arch\|nat\|target\)/.*\)\.o$$,/../gdb/\1.c,' \
422 -e 's/\.o$$/\.cc/'; \
429 rm -f
*.o
${ADD_FILES} *~
430 rm -f gdbserver
$(EXEEXT
) gdbreplay
$(EXEEXT
) core make.log
435 for i in
$(CONFIG_SRC_SUBDIR
); do \
437 rm -f
$$i/$(DEPDIR
)/*; \
440 maintainer-clean
realclean distclean: clean
441 rm -f Makefile config.status config.h stamp-h config.log config.cache
442 for i in
$(CONFIG_SRC_SUBDIR
); do \
443 rmdir
$$i/$(DEPDIR
); \
446 config.h
: stamp-h
; @true
447 stamp-h
: config.in config.status
448 $(SHELL
) .
/config.status config.h
450 Makefile
: Makefile.in config.status
451 $(SHELL
) .
/config.status
$@
453 config.status
: configure configure.srv
$(srcdir)/..
/bfd
/development.sh
454 $(SHELL
) .
/config.status
--recheck
456 # automatic rebuilding in automake-generated Makefiles requires
457 # this rule in the toplevel Makefile, which, with GNU make, causes
458 # the desired updates through the implicit regeneration of the Makefile
459 # and all of its prerequisites.
465 version-generated.
cc: Makefile
$(srcdir)/..
/gdb
/version.in
$(srcdir)/..
/bfd
/version.h
$(srcdir)/..
/gdbsupport
/create-version.sh
466 $(ECHO_GEN
) $(SHELL
) $(srcdir)/..
/gdbsupport
/create-version.sh
$(srcdir)/..
/gdb \
467 $(host_alias
) $(target_alias
) $@
469 xml-builtin-generated.
cc: stamp-xml
; @true
470 stamp-xml
: $(XML_DIR
)/feature_to_c.sh Makefile
$(XML_FILES
)
471 $(SILENCE
) rm -f xml-builtin.tmp
472 $(ECHO_GEN_XML_BUILTIN_GENERATED
) $(SHELL
) $(XML_DIR
)/feature_to_c.sh \
473 xml-builtin.tmp
$(XML_FILES
)
474 $(SILENCE
) $(SHELL
) $(srcdir)/..
/move-if-change xml-builtin.tmp xml-builtin-generated.
cc
475 $(SILENCE
) echo stamp
> stamp-xml
477 .PRECIOUS
: xml-builtin.
cc
479 # GNU Make has an annoying habit of putting *all* the Makefile variables
480 # into the environment, unless you include this target as a circumvention.
481 # Rumor is that this will be fixed (and this target can be removed)
485 # GNU Make 3.63 has a different problem: it keeps tacking command line
486 # overrides onto the definition of $(MAKE). This variable setting
490 regdat_sh
= $(srcdir)/..
/gdb
/regformats
/regdat.sh
491 osabi_def
= $(srcdir)/..
/gdbsupport
/osabi.def
495 -DCONFIG_UST_GDB_INTEGRATION
497 # Undo gnulib replacements for the IPA shared library build.
498 # The gnulib headers are still needed, but gnulib is not linked
499 # into the IPA lib so replacement apis don't work.
500 UNDO_GNULIB_CFLAGS
= \
501 -Drpl_strerror_r
=strerror_r \
503 -Drpl_malloc
=malloc \
504 -Drpl_realloc
=realloc
506 # Note, we only build the IPA if -fvisibility=hidden is supported in
511 $(UNDO_GNULIB_CFLAGS
) \
512 -fPIC
-DIN_PROCESS_AGENT \
515 # CXXFLAGS is at the very end on purpose, so that user-supplied flags can
516 # override internal flags.
517 IPAGENT_COMPILE
= $(ECHO_CXX
) $(COMPILE.pre
) $(IPAGENT_CFLAGS
) \
518 $(INCLUDE_SERVER_H
) $(CXXFLAGS
) $(COMPILE.post
)
520 # Rules for special cases.
523 $(IPAGENT_COMPILE
) $(WARN_CFLAGS_NO_FORMAT
) $<
527 $(COMPILE
) $(WARN_CFLAGS_NO_FORMAT
) $<
530 # Rules for objects that go in the in-process agent.
532 arch
/%-ipa.o
: ..
/gdb
/arch
/%.c
533 $(IPAGENT_COMPILE
) -x c
++ $<
536 gdbsupport
/%-ipa.o
: ..
/gdbsupport
/%.
cc
537 $(IPAGENT_COMPILE
) $<
540 %-ipa.o
: %-generated.
cc
541 $(IPAGENT_COMPILE
) $<
545 $(IPAGENT_COMPILE
) $<
549 $(IPAGENT_COMPILE
) -x c
++ $<
552 # Note: Between two matching pattern rules, GNU Make 3.81 chooses the first one.
553 # Therefore, this one needs to be before "%.o: %.cc" for it to be considered for
554 # files such as linux-amd64-ipa.o generated from linux-amd64-ipa.cc.
556 # Later versions of GNU Make choose the rule with the shortest stem, so it would
560 $(IPAGENT_COMPILE
) $<
563 # Rules for objects that go in the gdbserver binary.
565 arch
/%.o
: ..
/gdb
/arch
/%.c
577 nat
/%.o
: ..
/gdb
/nat
/%.c
581 target
/%.o
: ..
/gdb
/target
/%.c
589 # Rules for register format descriptions. Suffix destination files with
590 # -generated to identify and clean them easily.
592 %-generated.
cc: ..
/gdb
/regformats
/%.dat
$(osabi_def
) $(regdat_sh
)
593 $(ECHO_REGDAT
) $(SHELL
) $(regdat_sh
) $< $(osabi_def
) $@
595 %-generated.
cc: ..
/gdb
/regformats
/rs6000
/%.dat
$(osabi_def
) $(regdat_sh
)
596 $(ECHO_REGDAT
) $(SHELL
) $(regdat_sh
) $< $(osabi_def
) $@
598 # Rule for gdbreplay.o. This is the same as COMPILE, but includes common-defs.h
599 # instead of server.h.
600 gdbreplay.o
: gdbreplay.
cc
601 $(ECHO_CXX
) $(COMPILE.pre
) $(INTERNAL_CFLAGS
) $(CXXFLAGS
) \
602 -include gdbsupport
/common-defs.h
$(COMPILE.post
) $<
605 # Dependency tracking.
608 ifeq ($(DEPMODE
),depmode
=gcc3
)
609 # Note that we put the dependencies into a .Tpo file, then move them
610 # into place if the compile succeeds. We need this because gcc does
611 # not atomically write the dependency output file.
612 override COMPILE.post
= -c
-o
$@
-MT
$@
-MMD
-MP \
613 -MF
$(@D
)/$(DEPDIR
)/$(basename $(@F
)).Tpo
614 override POSTCOMPILE
= @mv
$(@D
)/$(DEPDIR
)/$(basename $(@F
)).Tpo \
615 $(@D
)/$(DEPDIR
)/$(basename $(@F
)).Po
617 override COMPILE.pre
= source
='$<' object
='$@' libtool
=no \
618 DEPDIR
=$(DEPDIR
) $(DEPMODE
) $(depcomp
) \
619 $(CXX
) $(CXX_DIALECT
)
620 # depcomp handles atomicity for us, so we don't need a postcompile
622 override POSTCOMPILE
=
625 # A list of all the objects we might care about in this build, for
626 # dependency tracking.
627 all_object_files
= $(OBS
) $(GDBREPLAY_OBS
) $(IPA_OBJS
)
629 # Ensure that generated files are created early. Use order-only
630 # dependencies if available. They require GNU make 3.80 or newer,
631 # and the .VARIABLES variable was introduced at the same time.
633 $(all_object_files
): |
$(generated_files
)
635 $(all_object_files
) : $(generated_files
)
638 # All the .deps files to include.
639 all_deps_files
= $(foreach dep
,$(patsubst %.o
,%.Po
,$(all_object_files
)),\
640 $(dir $(dep
))/$(DEPDIR
)/$(notdir $(dep
)))
643 -include $(all_deps_files
)
645 # Disable implicit make rules.
646 include $(srcdir)/..
/gdb
/disable-implicit-rules.mk
648 # Do not delete intermediate files (e.g. *-generated.cc).
651 # This is the end of "Makefile.in".