-# Copyright (C) 1989-2020 Free Software Foundation, Inc.
+# Copyright (C) 1989-2021 Free Software Foundation, Inc.
# This file is part of GDB.
# GNU make is used. The overrides implement dependency tracking.
COMPILE.pre = $(CXX) $(CXX_DIALECT)
COMPILE.post = -c -o $@
-COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
POSTCOMPILE = @true
+# CXXFLAGS is at the very end on purpose, so that user-supplied flags can
+# override internal flags.
+COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(CXXFLAGS) $(COMPILE.post)
+
# It is also possible that you will need to add -I/usr/include/sys to the
# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
# is where it should be according to Posix).
INCLUDE_DEP = $$(INCLUDE_DIR)
LIBIBERTY_BUILDDIR = ../libiberty
-LIBIBERTY = $(LIBIBERTY_BUILDDIR)/libiberty.a
+LIBIBERTY_NORMAL = $(LIBIBERTY_BUILDDIR)/libiberty.a
+LIBIBERTY_NOASAN = $(LIBIBERTY_BUILDDIR)/noasan/libiberty.a
+LIBIBERTY_PIC = $(LIBIBERTY_BUILDDIR)/pic/libiberty.a
+LIBIBERTY_FOR_SHLIB = \
+ $(if $(wildcard $(LIBIBERTY_NOASAN)),\
+ $(LIBIBERTY_NOASAN),\
+ $(if $(wildcard $(LIBIBERTY_PIC)),\
+ $(LIBIBERTY_PIC),\
+ $(LIBIBERTY_NORMAL)))
+LIBIBERTY = $(LIBIBERTY_NORMAL)
+
+GDBSUPPORT_BUILDDIR = ../gdbsupport
+GDBSUPPORT = $(GDBSUPPORT_BUILDDIR)/libgdbsupport.a
# Where is ust? These will be empty if ust was not available.
ustlibs = @ustlibs@
ustinc = @ustinc@
# gnulib
-GNULIB_BUILDDIR = ../gnulib
-LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
-INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import
+GNULIB_PARENT_DIR = ..
+include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
# Where is the INTL library? Typically in ../intl.
INTL = @LIBINTL@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
+WIN32APILIBS = @WIN32APILIBS@
+
# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
-INTERNAL_CFLAGS_BASE = ${CXXFLAGS} ${GLOBAL_CFLAGS} \
+INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \
${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS)
INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
$(srcdir)/dll.cc \
$(srcdir)/gdbreplay.cc \
$(srcdir)/hostio.cc \
- $(srcdir)/hostio-errno.cc \
$(srcdir)/i387-fp.cc \
$(srcdir)/inferiors.cc \
$(srcdir)/linux-aarch64-low.cc \
+ $(srcdir)/linux-arc-low.cc \
$(srcdir)/linux-arm-low.cc \
- $(srcdir)/linux-bfin-low.cc \
- $(srcdir)/linux-cris-low.cc \
- $(srcdir)/linux-crisv32-low.cc \
$(srcdir)/linux-ia64-low.cc \
$(srcdir)/linux-low.cc \
- $(srcdir)/linux-m32r-low.cc \
$(srcdir)/linux-m68k-low.cc \
$(srcdir)/linux-mips-low.cc \
$(srcdir)/linux-nios2-low.cc \
$(srcdir)/linux-s390-low.cc \
$(srcdir)/linux-sh-low.cc \
$(srcdir)/linux-sparc-low.cc \
- $(srcdir)/linux-tile-low.cc \
$(srcdir)/linux-x86-low.cc \
$(srcdir)/linux-xtensa-low.cc \
$(srcdir)/mem-break.cc \
+ $(srcdir)/netbsd-aarch64-low.cc \
+ $(srcdir)/netbsd-amd64-low.cc \
+ $(srcdir)/netbsd-i386-low.cc \
+ $(srcdir)/netbsd-low.cc \
+ $(srcdir)/netbsd-low.h \
$(srcdir)/proc-service.cc \
$(srcdir)/proc-service.list \
$(srcdir)/regcache.cc \
$(srcdir)/target.cc \
$(srcdir)/thread-db.cc \
$(srcdir)/utils.cc \
- $(srcdir)/win32-arm-low.cc \
$(srcdir)/win32-i386-low.cc \
$(srcdir)/win32-low.cc \
- $(srcdir)/wincecompat.cc \
$(srcdir)/x86-low.cc \
$(srcdir)/../gdb/alloc.c \
+ $(srcdir)/../gdb/arch/arc.c \
$(srcdir)/../gdb/arch/arm.c \
$(srcdir)/../gdb/arch/arm-get-next-pcs.c \
$(srcdir)/../gdb/arch/arm-linux.c \
$(srcdir)/../gdb/arch/ppc-linux-common.c \
$(srcdir)/../gdb/arch/riscv.c \
- $(srcdir)/../gdbsupport/btrace-common.cc \
- $(srcdir)/../gdbsupport/buffer.cc \
- $(srcdir)/../gdbsupport/cleanups.cc \
- $(srcdir)/../gdbsupport/common-debug.cc \
- $(srcdir)/../gdbsupport/common-exceptions.cc \
- $(srcdir)/../gdbsupport/common-inferior.cc \
- $(srcdir)/../gdbsupport/common-regcache.cc \
- $(srcdir)/../gdbsupport/common-utils.cc \
- $(srcdir)/../gdbsupport/errors.cc \
- $(srcdir)/../gdbsupport/environ.cc \
- $(srcdir)/../gdbsupport/fileio.cc \
- $(srcdir)/../gdbsupport/filestuff.cc \
- $(srcdir)/../gdbsupport/job-control.cc \
- $(srcdir)/../gdbsupport/gdb-dlfcn.cc \
- $(srcdir)/../gdbsupport/gdb_tilde_expand.cc \
- $(srcdir)/../gdbsupport/gdb_vecs.cc \
- $(srcdir)/../gdbsupport/gdb_wait.cc \
- $(srcdir)/../gdbsupport/netstuff.cc \
- $(srcdir)/../gdbsupport/new-op.cc \
- $(srcdir)/../gdbsupport/pathstuff.cc \
- $(srcdir)/../gdbsupport/print-utils.cc \
- $(srcdir)/../gdbsupport/ptid.cc \
- $(srcdir)/../gdbsupport/rsp-low.cc \
- $(srcdir)/../gdbsupport/safe-strerror.cc \
- $(srcdir)/../gdbsupport/tdesc.cc \
- $(srcdir)/../gdbsupport/xml-utils.cc \
+ $(srcdir)/../gdb/nat/aarch64-mte-linux-ptrace.c \
$(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \
$(srcdir)/../gdb/nat/linux-btrace.c \
$(srcdir)/../gdb/nat/linux-namespaces.c \
OBS = \
alloc.o \
ax.o \
- gdbsupport/agent.o \
- gdbsupport/btrace-common.o \
- gdbsupport/buffer.o \
- gdbsupport/cleanups.o \
- gdbsupport/common-debug.o \
- gdbsupport/common-exceptions.o \
- gdbsupport/common-inferior.o \
- gdbsupport/job-control.o \
- gdbsupport/common-regcache.o \
- gdbsupport/common-utils.o \
- gdbsupport/errors.o \
- gdbsupport/environ.o \
- gdbsupport/fileio.o \
- gdbsupport/filestuff.o \
- gdbsupport/format.o \
- gdbsupport/gdb-dlfcn.o \
- gdbsupport/gdb_tilde_expand.o \
- gdbsupport/gdb_vecs.o \
- gdbsupport/gdb_wait.o \
- gdbsupport/netstuff.o \
- gdbsupport/new-op.o \
- gdbsupport/pathstuff.o \
- gdbsupport/print-utils.o \
- gdbsupport/ptid.o \
- gdbsupport/rsp-low.o \
- gdbsupport/safe-strerror.o \
- gdbsupport/signals.o \
- gdbsupport/signals-state-save-restore.o \
- gdbsupport/tdesc.o \
- gdbsupport/xml-utils.o \
debug.o \
dll.o \
- event-loop.o \
hostio.o \
inferiors.o \
mem-break.o \
$(XML_BUILTIN)
GDBREPLAY_OBS = \
- gdbsupport/cleanups.o \
- gdbsupport/common-exceptions.o \
- gdbsupport/common-utils.o \
- gdbsupport/rsp-low.o \
- gdbsupport/errors.o \
- gdbsupport/netstuff.o \
- gdbsupport/print-utils.o \
- gdbsupport/safe-strerror.o \
gdbreplay.o \
utils.o \
version.o
clean-info:
gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY) \
- $(INTL_DEPS)
+ $(INTL_DEPS) $(GDBSUPPORT)
$(SILENCE) rm -f gdbserver$(EXEEXT)
$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
- -o gdbserver$(EXEEXT) $(OBS) $(LIBGNU) $(LIBIBERTY) \
- $(INTL) $(GDBSERVER_LIBS) $(XM_CLIBS)
+ $(CXXFLAGS) \
+ -o gdbserver$(EXEEXT) $(OBS) $(GDBSUPPORT) $(LIBGNU) \
+ $(LIBGNU_EXTRA_LIBS) $(LIBIBERTY) $(INTL) \
+ $(GDBSERVER_LIBS) $(XM_CLIBS) $(WIN32APILIBS)
gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY) \
- $(INTL_DEPS)
+ $(INTL_DEPS) $(GDBSUPPORT)
$(SILENCE) rm -f gdbreplay$(EXEEXT)
$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
- -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) $(LIBGNU) \
- $(LIBIBERTY) $(INTL)
+ $(CXXFLAGS) \
+ -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) \
+ $(GDBSUPPORT) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) \
+ $(LIBIBERTY) $(INTL) $(WIN32APILIBS)
IPA_OBJS = \
alloc-ipa.o \
$(SILENCE) rm -f $(IPA_LIB)
$(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
-Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
- -o $(IPA_LIB) ${IPA_OBJS} -ldl -pthread
+ $(CXXFLAGS) \
+ -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) -ldl -pthread
# Put the proper machine-specific files first, so M-. on a machine
# specific routine gets the one for the correct machine.
if [ x$$i != xyzzy ]; then \
echo ${srcdir}/$$i | sed -e 's/\.o$$/\.cc/' \
-e 's,/\(arch\|nat\|target\)/,/../\1/,' \
- -e 's,/\(gdbsupport\)/,/../../\1/,'; \
fi; \
done` \
${TAGFILES}
# Undo gnulib replacements for the IPA shared library build.
# The gnulib headers are still needed, but gnulib is not linked
# into the IPA lib so replacement apis don't work.
-UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r
+UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r -Drpl_free=free
# Note, we only build the IPA if -fvisibility=hidden is supported in
# the first place.
-fPIC -DIN_PROCESS_AGENT \
-fvisibility=hidden
-IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) $(COMPILE.post)
+# CXXFLAGS is at the very end on purpose, so that user-supplied flags can
+# override internal flags.
+IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) $(CXXFLAGS) $(COMPILE.post)
# Rules for special cases.
$(COMPILE) -x c++ $<
$(POSTCOMPILE)
-gdbsupport/%.o: ../gdbsupport/%.cc
- $(COMPILE) $<
- $(POSTCOMPILE)
-
%.o: %-generated.cc
$(COMPILE) $<
$(POSTCOMPILE)
%-generated.cc: ../gdb/regformats/%.dat $(regdat_sh)
$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
-%-generated.cc: ../gdb/regformats/arm/%.dat $(regdat_sh)
- $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
-
%-generated.cc: ../gdb/regformats/rs6000/%.dat $(regdat_sh)
$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@