1 # Copyright (C) 2010-2024 Free Software Foundation, Inc. 2 3 # Makefile for building a staged copy of the data-directory. 4 # This file is part of GDB. 5 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; either version 3 of the License, or 9 # (at your option) any later version. 10 # 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 19 # Please keep lists in this file sorted alphabetically, with one item per line. 20 # See gdb/Makefile.in for guidelines on ordering files and directories. 21 22 srcdir = @srcdir@ 23 SYSCALLS_SRCDIR = $(srcdir)/../syscalls 24 PYTHON_SRCDIR = $(srcdir)/../python/lib 25 GUILE_SRCDIR = $(srcdir)/../guile/lib 26 SYSTEM_GDBINIT_SRCDIR = $(srcdir)/../system-gdbinit 27 VPATH = $(srcdir):$(SYSCALLS_SRCDIR):$(PYTHON_SRCDIR):$(GUILE_SRCDIR):$(SYSTEM_GDBINIT_SRCDIR) 28 XSLTPROC = @XSLTPROC@ 29 30 top_srcdir = @top_srcdir@ 31 top_builddir = @top_builddir@ 32 33 prefix = @prefix@ 34 exec_prefix = @exec_prefix@ 35 36 datarootdir = @datarootdir@ 37 datadir = @datadir@ 38 39 include $(srcdir)/../silent-rules.mk 40 41 SHELL = @SHELL@ 42 43 LN_S = @LN_S@ 44 45 INSTALL = @INSTALL@ 46 INSTALL_DATA = @INSTALL_DATA@ 47 INSTALL_DIR = $(SHELL) $(srcdir)/../../install-sh -d 48 49 GDB_DATADIR = @GDB_DATADIR@ 50 51 SYSCALLS_DIR = syscalls 52 SYSCALLS_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SYSCALLS_DIR) 53 GEN_SYSCALLS_FILES = \ 54 aarch64-linux.xml \ 55 amd64-linux.xml \ 56 arm-linux.xml \ 57 i386-linux.xml \ 58 loongarch-linux.xml \ 59 mips-n32-linux.xml \ 60 mips-n64-linux.xml \ 61 mips-o32-linux.xml \ 62 ppc-linux.xml \ 63 ppc64-linux.xml \ 64 s390-linux.xml \ 65 s390x-linux.xml \ 66 sparc-linux.xml \ 67 sparc64-linux.xml 68 69 SYSCALLS_FILES = gdb-syscalls.dtd freebsd.xml netbsd.xml $(GEN_SYSCALLS_FILES) 70 71 PYTHON_DIR = python 72 PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) 73 PYTHON_FILE_LIST = \ 74 gdb/__init__.py \ 75 gdb/disassembler.py \ 76 gdb/FrameDecorator.py \ 77 gdb/FrameIterator.py \ 78 gdb/frames.py \ 79 gdb/missing_debug.py \ 80 gdb/missing_objfile.py \ 81 gdb/missing_files.py \ 82 gdb/printing.py \ 83 gdb/prompt.py \ 84 gdb/ptwrite.py \ 85 gdb/styling.py \ 86 gdb/types.py \ 87 gdb/unwinder.py \ 88 gdb/xmethod.py \ 89 gdb/command/__init__.py \ 90 gdb/command/explore.py \ 91 gdb/command/frame_filters.py \ 92 gdb/command/missing_files.py \ 93 gdb/command/pretty_printers.py \ 94 gdb/command/prompt.py \ 95 gdb/command/type_printers.py \ 96 gdb/command/unwinders.py \ 97 gdb/command/xmethods.py \ 98 gdb/dap/breakpoint.py \ 99 gdb/dap/bt.py \ 100 gdb/dap/disassemble.py \ 101 gdb/dap/evaluate.py \ 102 gdb/dap/events.py \ 103 gdb/dap/frames.py \ 104 gdb/dap/globalvars.py \ 105 gdb/dap/__init__.py \ 106 gdb/dap/io.py \ 107 gdb/dap/launch.py \ 108 gdb/dap/locations.py \ 109 gdb/dap/memory.py \ 110 gdb/dap/modules.py \ 111 gdb/dap/next.py \ 112 gdb/dap/pause.py \ 113 gdb/dap/scopes.py \ 114 gdb/dap/server.py \ 115 gdb/dap/sources.py \ 116 gdb/dap/startup.py \ 117 gdb/dap/state.py \ 118 gdb/dap/threads.py \ 119 gdb/dap/typecheck.py \ 120 gdb/dap/varref.py \ 121 gdb/function/__init__.py \ 122 gdb/function/as_string.py \ 123 gdb/function/caller_is.py \ 124 gdb/function/strfns.py \ 125 gdb/printer/__init__.py 126 127 @HAVE_PYTHON_TRUE@PYTHON_FILES = $(PYTHON_FILE_LIST) 128 @HAVE_PYTHON_FALSE@PYTHON_FILES = 129 130 GUILE_DIR = guile 131 GUILE_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(GUILE_DIR) 132 133 GUILE_SOURCE_FILES = \ 134 ./gdb.scm \ 135 gdb/boot.scm \ 136 gdb/experimental.scm \ 137 gdb/init.scm \ 138 gdb/iterator.scm \ 139 gdb/printing.scm \ 140 gdb/support.scm \ 141 gdb/types.scm 142 143 GUILE_COMPILED_FILES = \ 144 ./gdb.go \ 145 gdb/experimental.go \ 146 gdb/iterator.go \ 147 gdb/printing.go \ 148 gdb/support.go \ 149 gdb/types.go 150 151 @HAVE_GUILE_TRUE@GUILE_FILES = $(GUILE_SOURCE_FILES) $(GUILE_COMPILED_FILES) 152 @HAVE_GUILE_FALSE@GUILE_FILES = 153 154 GUILD = @GUILD@ 155 GUILD_TARGET_FLAG = @GUILD_TARGET_FLAG@ 156 157 # Flags passed to 'guild compile'. 158 # Note: We can't use -Wunbound-variable because all the variables 159 # defined in C aren't visible when we compile. 160 # Note: To work around a guile 2.0.5 issue (it can't find gdb/init.scm even if 161 # we pass -L <dir>) we have to compile in the directory containing gdb.scm. 162 # We still need to pass "-L ." so that other modules are found. 163 GUILD_COMPILE_FLAGS = \ 164 $(GUILD_TARGET_FLAG) \ 165 -Warity-mismatch -Wformat -Wunused-toplevel \ 166 -L . 167 168 SYSTEM_GDBINIT_DIR = system-gdbinit 169 SYSTEM_GDBINIT_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SYSTEM_GDBINIT_DIR) 170 SYSTEM_GDBINIT_FILES = \ 171 elinos.py \ 172 wrs-linux.py 173 174 FLAGS_TO_PASS = \ 175 "prefix=$(prefix)" \ 176 "exec_prefix=$(exec_prefix)" \ 177 "infodir=$(infodir)" \ 178 "datarootdir=$(datarootdir)" \ 179 "docdir=$(docdir)" \ 180 "htmldir=$(htmldir)" \ 181 "pdfdir=$(pdfdir)" \ 182 "libdir=$(libdir)" \ 183 "mandir=$(mandir)" \ 184 "datadir=$(datadir)" \ 185 "includedir=$(includedir)" \ 186 "against=$(against)" \ 187 "DESTDIR=$(DESTDIR)" \ 188 "AR=$(AR)" \ 189 "AR_FLAGS=$(AR_FLAGS)" \ 190 "CC=$(CC)" \ 191 "CFLAGS=$(CFLAGS)" \ 192 "CXX=$(CXX)" \ 193 "CXXFLAGS=$(CXXFLAGS)" \ 194 "DLLTOOL=$(DLLTOOL)" \ 195 "LDFLAGS=$(LDFLAGS)" \ 196 "RANLIB=$(RANLIB)" \ 197 "MAKEINFO=$(MAKEINFO)" \ 198 "MAKEHTML=$(MAKEHTML)" \ 199 "MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \ 200 "INSTALL=$(INSTALL)" \ 201 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ 202 "INSTALL_DATA=$(INSTALL_DATA)" \ 203 "RUNTEST=$(RUNTEST)" \ 204 "RUNTESTFLAGS=$(RUNTESTFLAGS)" 205 206 .PHONY: all 207 all: stamp-syscalls stamp-python stamp-guile stamp-system-gdbinit 208 209 %.xml: @MAINTAINER_MODE_TRUE@ %.xml.in apply-defaults.xsl linux-defaults.xml.in 210 $(ECHO_GEN) $(XSLTPROC) -o $(SYSCALLS_SRCDIR)/$@ $(SYSCALLS_SRCDIR)/apply-defaults.xsl \ 211 $(SYSCALLS_SRCDIR)/$@.in 212 213 .PHONY: syscall-xml 214 syscall-xml: $(GEN_SYSCALLS_FILES) 215 216 .PHONY: clean-syscall-xml 217 # Only clean files generated XML files. 218 clean-syscall-xml: 219 files='$(GEN_SYSCALLS_FILES)' ; \ 220 for file in $$files; do \ 221 rm -f "$(SYSCALLS_SRCDIR)/$$file"; \ 222 done 223 224 # For portability's sake, we need to handle systems that don't have 225 # symbolic links. 226 stamp-syscalls: Makefile $(SYSCALLS_FILES) 227 $(ECHO_GEN) 228 $(SILENCE) rm -rf ./$(SYSCALLS_DIR) 229 $(SILENCE) mkdir ./$(SYSCALLS_DIR) 230 $(SILENCE) files='$(SYSCALLS_FILES)' ; \ 231 for file in $$files ; do \ 232 f=$(SYSCALLS_SRCDIR)/$$file ; \ 233 if test -f $$f ; then \ 234 $(INSTALL_DATA) $$f ./$(SYSCALLS_DIR) ; \ 235 fi ; \ 236 done 237 $(SILENCE) touch $@ 238 239 .PHONY: clean-syscalls 240 clean-syscalls: 241 rm -rf $(SYSCALLS_DIR) 242 rm -f stamp-syscalls 243 244 # This target is responsible for properly installing the syscalls' 245 # XML files in the system. 246 .PHONY: install-syscalls 247 install-syscalls: 248 $(INSTALL_DIR) $(SYSCALLS_INSTALL_DIR) 249 files='$(SYSCALLS_FILES)' ; \ 250 for file in $$files; do \ 251 f=$(SYSCALLS_SRCDIR)/$$file ; \ 252 if test -f $$f ; then \ 253 $(INSTALL_DATA) $$f $(SYSCALLS_INSTALL_DIR) ; \ 254 fi ; \ 255 done 256 257 .PHONY: uninstall-syscalls 258 uninstall-syscalls: 259 files='$(SYSCALLS_FILES)' ; \ 260 for file in $$files ; do \ 261 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \ 262 rm -f $(SYSCALLS_INSTALL_DIR)/$$file ; \ 263 while test "x$$file" != "x$$slashdir" ; do \ 264 rmdir 2>/dev/null "$(SYSCALLS_INSTALL_DIR)$$slashdir" ; \ 265 file="$$slashdir" ; \ 266 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 267 done \ 268 done 269 270 stamp-python: Makefile $(PYTHON_FILES) 271 $(ECHO_GEN) 272 $(SILENCE) rm -rf ./$(PYTHON_DIR) 273 $(SILENCE) files='$(PYTHON_FILES)' ; \ 274 if test "x$$files" != x ; then \ 275 for file in $$files ; do \ 276 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 277 $(INSTALL_DIR) ./$(PYTHON_DIR)/$$dir ; \ 278 $(INSTALL_DATA) $(PYTHON_SRCDIR)/$$file ./$(PYTHON_DIR)/$$dir ; \ 279 done ; \ 280 fi 281 $(SILENCE) touch $@ 282 283 .PHONY: clean-python 284 clean-python: 285 rm -rf $(PYTHON_DIR) 286 rm -f stamp-python 287 288 .PHONY: install-python 289 install-python: 290 files='$(PYTHON_FILES)' ; \ 291 if test "x$$files" != x ; then \ 292 for file in $$files ; do \ 293 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 294 $(INSTALL_DIR) $(PYTHON_INSTALL_DIR)/$$dir ; \ 295 $(INSTALL_DATA) ./$(PYTHON_DIR)/$$file $(PYTHON_INSTALL_DIR)/$$dir ; \ 296 done ; \ 297 fi 298 299 .PHONY: uninstall-python 300 uninstall-python: 301 files='$(PYTHON_FILES)' ; \ 302 if test "x$$files" != x ; then \ 303 for file in $$files ; do \ 304 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \ 305 rm -f $(PYTHON_INSTALL_DIR)/$$file ; \ 306 while test "x$$file" != "x$$slashdir" ; do \ 307 rmdir 2>/dev/null "$(PYTHON_INSTALL_DIR)$$slashdir" ; \ 308 file="$$slashdir" ; \ 309 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 310 done \ 311 done ; \ 312 fi 313 314 stamp-guile: Makefile $(GUILE_SOURCE_FILES) 315 $(ECHO_GEN) 316 $(SILENCE) rm -rf ./$(GUILE_DIR) 317 $(SILENCE) if test "x$(GUILE_FILES)" != x ; then \ 318 files='$(GUILE_SOURCE_FILES)' ; \ 319 for file in $$files ; do \ 320 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 321 $(INSTALL_DIR) ./$(GUILE_DIR)/$$dir ; \ 322 $(INSTALL_DATA) $(GUILE_SRCDIR)/$$file ./$(GUILE_DIR)/$$dir ; \ 323 done ; \ 324 files='$(GUILE_COMPILED_FILES)' ; \ 325 cd ./$(GUILE_DIR) ; \ 326 for go in $$files ; do \ 327 source="`echo $$go | sed 's/\.go$$/.scm/'`" ; \ 328 $(SILENT_ECHO) $(GUILD) compile $(GUILD_COMPILE_FLAGS) -o "$$go" "$$source" ; \ 329 $(GUILD) compile $(GUILD_COMPILE_FLAGS) -o "$$go" "$$source" || exit 1 ; \ 330 done ; \ 331 fi 332 $(SILENCE) touch $@ 333 334 .PHONY: clean-guile 335 clean-guile: 336 rm -rf $(GUILE_DIR) 337 rm -f stamp-guile 338 339 .PHONY: install-guile 340 install-guile: 341 files='$(GUILE_FILES)' ; \ 342 if test "x$$files" != x ; then \ 343 for file in $$files ; do \ 344 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 345 $(INSTALL_DIR) $(GUILE_INSTALL_DIR)/$$dir ; \ 346 $(INSTALL_DATA) ./$(GUILE_DIR)/$$file $(GUILE_INSTALL_DIR)/$$dir ; \ 347 done ; \ 348 fi 349 350 .PHONY: uninstall-guile 351 uninstall-guile: 352 files='$(GUILE_FILES)' ; \ 353 if test "x$$files" != x ; then \ 354 for file in $$files ; do \ 355 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \ 356 rm -f $(GUILE_INSTALL_DIR)/$$file ; \ 357 while test "x$$file" != "x$$slashdir" ; do \ 358 rmdir 2>/dev/null "$(GUILE_INSTALL_DIR)$$slashdir" ; \ 359 file="$$slashdir" ; \ 360 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 361 done \ 362 done ; \ 363 fi 364 365 stamp-system-gdbinit: Makefile $(SYSTEM_GDBINIT_FILES) 366 $(ECHO_GEN) 367 $(SILENCE) rm -rf ./$(SYSTEM_GDBINIT_DIR) 368 $(SILENCE) mkdir ./$(SYSTEM_GDBINIT_DIR) 369 $(SILENCE) files='$(SYSTEM_GDBINIT_FILES)' ; \ 370 for file in $$files ; do \ 371 f=$(SYSTEM_GDBINIT_SRCDIR)/$$file ; \ 372 if test -f $$f ; then \ 373 $(INSTALL_DATA) $$f ./$(SYSTEM_GDBINIT_DIR) ; \ 374 fi ; \ 375 done 376 $(SILENCE) touch $@ 377 378 .PHONY: clean-system-gdbinit 379 clean-system-gdbinit: 380 rm -rf $(SYSTEM_GDBINIT_DIR) 381 rm -f stamp-system-gdbinit 382 383 .PHONY: install-system-gdbinit 384 install-system-gdbinit: 385 $(INSTALL_DIR) $(SYSTEM_GDBINIT_INSTALL_DIR) 386 files='$(SYSTEM_GDBINIT_FILES)' ; \ 387 for file in $$files; do \ 388 f=$(SYSTEM_GDBINIT_SRCDIR)/$$file ; \ 389 if test -f $$f ; then \ 390 $(INSTALL_DATA) $$f $(SYSTEM_GDBINIT_INSTALL_DIR) ; \ 391 fi ; \ 392 done 393 394 .PHONY: uninstall-system-gdbinit 395 uninstall-system-gdbinit: 396 files='$(SYSTEM_GDBINIT_FILES)' ; \ 397 for file in $$files ; do \ 398 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \ 399 rm -f $(SYSTEM_GDBINIT_INSTALL_DIR)/$$file ; \ 400 while test "x$$file" != "x$$slashdir" ; do \ 401 rmdir 2>/dev/null "$(SYSTEM_GDBINIT_INSTALL_DIR)$$slashdir" ; \ 402 file="$$slashdir" ; \ 403 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 404 done \ 405 done 406 407 # Traditionally "install" depends on "all". But it may be useful 408 # not to; for example, if the user has made some trivial change to a 409 # source file and doesn't care about rebuilding or just wants to save the 410 # time it takes for make to check that all is up to date. 411 # install-only is intended to address that need. 412 .PHONY: install 413 install: all 414 @$(MAKE) $(FLAGS_TO_PASS) install-only 415 416 .PHONY: install-only 417 install-only: install-syscalls install-python install-guile \ 418 install-system-gdbinit 419 420 .PHONY: uninstall 421 uninstall: uninstall-syscalls uninstall-python uninstall-guile \ 422 uninstall-system-gdbinit 423 424 .PHONY: clean 425 clean: clean-syscalls clean-python clean-guile clean-system-gdbinit 426 427 .PHONY: maintainer-clean realclean distclean 428 maintainer-clean realclean distclean: clean 429 rm -f Makefile 430 431 .PHONY: check installcheck info dvi pdf html 432 .PHONY: install-info install-pdf install-html clean-info 433 check installcheck: 434 info dvi pdf html: 435 install-info install-dvi install-pdf install-html: 436 clean-info: 437 438 # GNU Make has an annoying habit of putting *all* the Makefile variables 439 # into the environment, unless you include this target as a circumvention. 440 # Rumor is that this will be fixed (and this target can be removed) 441 # in GNU Make 4.0. 442 .NOEXPORT: 443 444 # GNU Make 3.63 has a different problem: it keeps tacking command line 445 # overrides onto the definition of $(MAKE). This variable setting 446 # will remove them. 447 MAKEOVERRIDES= 448 449 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 450 $(ECHO_GEN) cd .. && $(SHELL) ./config.status $(SILENT_FLAG) data-directory/Makefile 451 452 # Disable implicit make rules. 453 include $(srcdir)/../disable-implicit-rules.mk 454