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