Home | History | Annotate | Line # | Download | only in data-directory
      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/printing.py \
     81 	gdb/prompt.py \
     82 	gdb/styling.py \
     83 	gdb/types.py \
     84 	gdb/unwinder.py \
     85 	gdb/xmethod.py \
     86 	gdb/command/__init__.py \
     87 	gdb/command/explore.py \
     88 	gdb/command/frame_filters.py \
     89 	gdb/command/missing_debug.py \
     90 	gdb/command/pretty_printers.py \
     91 	gdb/command/prompt.py \
     92 	gdb/command/type_printers.py \
     93 	gdb/command/unwinders.py \
     94 	gdb/command/xmethods.py \
     95 	gdb/dap/breakpoint.py \
     96 	gdb/dap/bt.py \
     97 	gdb/dap/disassemble.py \
     98 	gdb/dap/evaluate.py \
     99 	gdb/dap/events.py \
    100 	gdb/dap/frames.py \
    101 	gdb/dap/__init__.py \
    102 	gdb/dap/io.py \
    103 	gdb/dap/launch.py \
    104 	gdb/dap/locations.py \
    105 	gdb/dap/memory.py \
    106 	gdb/dap/modules.py \
    107 	gdb/dap/next.py \
    108 	gdb/dap/pause.py \
    109 	gdb/dap/scopes.py \
    110 	gdb/dap/server.py \
    111 	gdb/dap/sources.py \
    112 	gdb/dap/startup.py \
    113 	gdb/dap/state.py \
    114 	gdb/dap/threads.py \
    115 	gdb/dap/typecheck.py \
    116 	gdb/dap/varref.py \
    117 	gdb/function/__init__.py \
    118 	gdb/function/as_string.py \
    119 	gdb/function/caller_is.py \
    120 	gdb/function/strfns.py \
    121 	gdb/printer/__init__.py \
    122 	gdb/printer/bound_registers.py
    123 
    124 @HAVE_PYTHON_TRUE@PYTHON_FILES = $(PYTHON_FILE_LIST)
    125 @HAVE_PYTHON_FALSE@PYTHON_FILES =
    126 
    127 GUILE_DIR = guile
    128 GUILE_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(GUILE_DIR)
    129 
    130 GUILE_SOURCE_FILES = \
    131 	./gdb.scm \
    132 	gdb/boot.scm \
    133 	gdb/experimental.scm \
    134 	gdb/init.scm \
    135 	gdb/iterator.scm \
    136 	gdb/printing.scm \
    137 	gdb/support.scm \
    138 	gdb/types.scm
    139 
    140 GUILE_COMPILED_FILES = \
    141 	./gdb.go \
    142 	gdb/experimental.go \
    143 	gdb/iterator.go \
    144 	gdb/printing.go \
    145 	gdb/support.go \
    146 	gdb/types.go
    147 
    148 @HAVE_GUILE_TRUE@GUILE_FILES = $(GUILE_SOURCE_FILES) $(GUILE_COMPILED_FILES)
    149 @HAVE_GUILE_FALSE@GUILE_FILES =
    150 
    151 GUILD = @GUILD@
    152 GUILD_TARGET_FLAG = @GUILD_TARGET_FLAG@
    153 
    154 # Flags passed to 'guild compile'.
    155 # Note: We can't use -Wunbound-variable because all the variables
    156 # defined in C aren't visible when we compile.
    157 # Note: To work around a guile 2.0.5 issue (it can't find gdb/init.scm even if
    158 # we pass -L <dir>) we have to compile in the directory containing gdb.scm.
    159 # We still need to pass "-L ." so that other modules are found.
    160 GUILD_COMPILE_FLAGS = \
    161 	$(GUILD_TARGET_FLAG) \
    162 	-Warity-mismatch -Wformat -Wunused-toplevel \
    163 	-L .
    164 
    165 SYSTEM_GDBINIT_DIR = system-gdbinit
    166 SYSTEM_GDBINIT_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SYSTEM_GDBINIT_DIR)
    167 SYSTEM_GDBINIT_FILES = \
    168 	elinos.py \
    169 	wrs-linux.py
    170 
    171 FLAGS_TO_PASS = \
    172 	"prefix=$(prefix)" \
    173 	"exec_prefix=$(exec_prefix)" \
    174 	"infodir=$(infodir)" \
    175 	"datarootdir=$(datarootdir)" \
    176 	"docdir=$(docdir)" \
    177 	"htmldir=$(htmldir)" \
    178 	"pdfdir=$(pdfdir)" \
    179 	"libdir=$(libdir)" \
    180 	"mandir=$(mandir)" \
    181 	"datadir=$(datadir)" \
    182 	"includedir=$(includedir)" \
    183 	"against=$(against)" \
    184 	"DESTDIR=$(DESTDIR)" \
    185 	"AR=$(AR)" \
    186 	"AR_FLAGS=$(AR_FLAGS)" \
    187 	"CC=$(CC)" \
    188 	"CFLAGS=$(CFLAGS)" \
    189 	"CXX=$(CXX)" \
    190 	"CXXFLAGS=$(CXXFLAGS)" \
    191 	"DLLTOOL=$(DLLTOOL)" \
    192 	"LDFLAGS=$(LDFLAGS)" \
    193 	"RANLIB=$(RANLIB)" \
    194 	"MAKEINFO=$(MAKEINFO)" \
    195 	"MAKEHTML=$(MAKEHTML)" \
    196 	"MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
    197 	"INSTALL=$(INSTALL)" \
    198 	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
    199 	"INSTALL_DATA=$(INSTALL_DATA)" \
    200 	"RUNTEST=$(RUNTEST)" \
    201 	"RUNTESTFLAGS=$(RUNTESTFLAGS)"
    202 
    203 .PHONY: all
    204 all: stamp-syscalls stamp-python stamp-guile stamp-system-gdbinit
    205 
    206 %.xml: @MAINTAINER_MODE_TRUE@ %.xml.in apply-defaults.xsl linux-defaults.xml.in
    207 	$(ECHO_GEN) $(XSLTPROC) -o $(SYSCALLS_SRCDIR)/$@ $(SYSCALLS_SRCDIR)/apply-defaults.xsl \
    208 		$(SYSCALLS_SRCDIR)/$@.in
    209 
    210 .PHONY: syscall-xml
    211 syscall-xml: $(GEN_SYSCALLS_FILES)
    212 
    213 .PHONY: clean-syscall-xml
    214 # Only clean files generated XML files.
    215 clean-syscall-xml:
    216 	files='$(GEN_SYSCALLS_FILES)' ; \
    217 	for file in $$files; do \
    218 		rm -f "$(SYSCALLS_SRCDIR)/$$file"; \
    219 	done
    220 
    221 # For portability's sake, we need to handle systems that don't have
    222 # symbolic links.
    223 stamp-syscalls: Makefile $(SYSCALLS_FILES)
    224 	$(ECHO_GEN)
    225 	$(SILENCE) rm -rf ./$(SYSCALLS_DIR)
    226 	$(SILENCE) mkdir ./$(SYSCALLS_DIR)
    227 	$(SILENCE) files='$(SYSCALLS_FILES)' ; \
    228 	for file in $$files ; do \
    229 	  f=$(SYSCALLS_SRCDIR)/$$file ; \
    230 	  if test -f $$f ; then \
    231 	    $(INSTALL_DATA) $$f ./$(SYSCALLS_DIR) ; \
    232 	  fi ; \
    233 	done
    234 	$(SILENCE) touch $@
    235 
    236 .PHONY: clean-syscalls
    237 clean-syscalls:
    238 	rm -rf $(SYSCALLS_DIR)
    239 	rm -f stamp-syscalls
    240 
    241 # This target is responsible for properly installing the syscalls'
    242 # XML files in the system.
    243 .PHONY: install-syscalls
    244 install-syscalls:
    245 	$(INSTALL_DIR) $(SYSCALLS_INSTALL_DIR)
    246 	files='$(SYSCALLS_FILES)' ; \
    247 	for file in $$files; do \
    248 	  f=$(SYSCALLS_SRCDIR)/$$file ; \
    249 	  if test -f $$f ; then \
    250 	    $(INSTALL_DATA) $$f $(SYSCALLS_INSTALL_DIR) ; \
    251 	  fi ; \
    252 	done
    253 
    254 .PHONY: uninstall-syscalls
    255 uninstall-syscalls:
    256 	files='$(SYSCALLS_FILES)' ; \
    257 	for file in $$files ; do \
    258 	  slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
    259 	  rm -f $(SYSCALLS_INSTALL_DIR)/$$file ; \
    260 	  while test "x$$file" != "x$$slashdir" ; do \
    261 	    rmdir 2>/dev/null "$(SYSCALLS_INSTALL_DIR)$$slashdir" ; \
    262 	    file="$$slashdir" ; \
    263 	    slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    264 	  done \
    265 	done
    266 
    267 stamp-python: Makefile $(PYTHON_FILES)
    268 	$(ECHO_GEN)
    269 	$(SILENCE) rm -rf ./$(PYTHON_DIR)
    270 	$(SILENCE) files='$(PYTHON_FILES)' ; \
    271 	if test "x$$files" != x ; then \
    272 	  for file in $$files ; do \
    273 	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    274 	    $(INSTALL_DIR) ./$(PYTHON_DIR)/$$dir ; \
    275 	    $(INSTALL_DATA) $(PYTHON_SRCDIR)/$$file ./$(PYTHON_DIR)/$$dir ; \
    276 	  done ; \
    277 	fi
    278 	$(SILENCE) touch $@
    279 
    280 .PHONY: clean-python
    281 clean-python:
    282 	rm -rf $(PYTHON_DIR)
    283 	rm -f stamp-python
    284 
    285 .PHONY: install-python
    286 install-python:
    287 	files='$(PYTHON_FILES)' ; \
    288 	if test "x$$files" != x ; then \
    289 	  for file in $$files ; do \
    290 	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    291 	    $(INSTALL_DIR) $(PYTHON_INSTALL_DIR)/$$dir ; \
    292 	    $(INSTALL_DATA) ./$(PYTHON_DIR)/$$file $(PYTHON_INSTALL_DIR)/$$dir ; \
    293 	  done ; \
    294 	fi
    295 
    296 .PHONY: uninstall-python
    297 uninstall-python:
    298 	files='$(PYTHON_FILES)' ; \
    299 	if test "x$$files" != x ; then \
    300 	  for file in $$files ; do \
    301 	    slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
    302 	    rm -f $(PYTHON_INSTALL_DIR)/$$file ; \
    303 	    while test "x$$file" != "x$$slashdir" ; do \
    304 	      rmdir 2>/dev/null "$(PYTHON_INSTALL_DIR)$$slashdir" ; \
    305 	      file="$$slashdir" ; \
    306 	      slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    307 	    done \
    308 	  done ; \
    309 	fi
    310 
    311 stamp-guile: Makefile $(GUILE_SOURCE_FILES)
    312 	$(ECHO_GEN)
    313 	$(SILENCE) rm -rf ./$(GUILE_DIR)
    314 	$(SILENCE) if test "x$(GUILE_FILES)" != x ; then \
    315 	  files='$(GUILE_SOURCE_FILES)' ; \
    316 	  for file in $$files ; do \
    317 	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    318 	    $(INSTALL_DIR) ./$(GUILE_DIR)/$$dir ; \
    319 	    $(INSTALL_DATA) $(GUILE_SRCDIR)/$$file ./$(GUILE_DIR)/$$dir ; \
    320 	  done ; \
    321 	  files='$(GUILE_COMPILED_FILES)' ; \
    322 	  cd ./$(GUILE_DIR) ; \
    323 	  for go in $$files ; do \
    324 	    source="`echo $$go | sed 's/\.go$$/.scm/'`" ; \
    325 	    $(SILENT_ECHO) $(GUILD) compile $(GUILD_COMPILE_FLAGS) -o "$$go" "$$source" ; \
    326 	    $(GUILD) compile $(GUILD_COMPILE_FLAGS) -o "$$go" "$$source" || exit 1 ; \
    327 	  done ; \
    328 	fi
    329 	$(SILENCE) touch $@
    330 
    331 .PHONY: clean-guile
    332 clean-guile:
    333 	rm -rf $(GUILE_DIR)
    334 	rm -f stamp-guile
    335 
    336 .PHONY: install-guile
    337 install-guile:
    338 	files='$(GUILE_FILES)' ; \
    339 	if test "x$$files" != x ; then \
    340 	  for file in $$files ; do \
    341 	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    342 	    $(INSTALL_DIR) $(GUILE_INSTALL_DIR)/$$dir ; \
    343 	    $(INSTALL_DATA) ./$(GUILE_DIR)/$$file $(GUILE_INSTALL_DIR)/$$dir ; \
    344 	  done ; \
    345 	fi
    346 
    347 .PHONY: uninstall-guile
    348 uninstall-guile:
    349 	files='$(GUILE_FILES)' ; \
    350 	if test "x$$files" != x ; then \
    351 	  for file in $$files ; do \
    352 	    slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
    353 	    rm -f $(GUILE_INSTALL_DIR)/$$file ; \
    354 	    while test "x$$file" != "x$$slashdir" ; do \
    355 	      rmdir 2>/dev/null "$(GUILE_INSTALL_DIR)$$slashdir" ; \
    356 	      file="$$slashdir" ; \
    357 	      slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    358 	    done \
    359 	  done ; \
    360 	fi
    361 
    362 stamp-system-gdbinit: Makefile $(SYSTEM_GDBINIT_FILES)
    363 	$(ECHO_GEN)
    364 	$(SILENCE) rm -rf ./$(SYSTEM_GDBINIT_DIR)
    365 	$(SILENCE) mkdir ./$(SYSTEM_GDBINIT_DIR)
    366 	$(SILENCE) files='$(SYSTEM_GDBINIT_FILES)' ; \
    367 	for file in $$files ; do \
    368 	  f=$(SYSTEM_GDBINIT_SRCDIR)/$$file ; \
    369 	  if test -f $$f ; then \
    370 	    $(INSTALL_DATA) $$f ./$(SYSTEM_GDBINIT_DIR) ; \
    371 	  fi ; \
    372 	done
    373 	$(SILENCE) touch $@
    374 
    375 .PHONY: clean-system-gdbinit
    376 clean-system-gdbinit:
    377 	rm -rf $(SYSTEM_GDBINIT_DIR)
    378 	rm -f stamp-system-gdbinit
    379 
    380 .PHONY: install-system-gdbinit
    381 install-system-gdbinit:
    382 	$(INSTALL_DIR) $(SYSTEM_GDBINIT_INSTALL_DIR)
    383 	files='$(SYSTEM_GDBINIT_FILES)' ; \
    384 	for file in $$files; do \
    385 	  f=$(SYSTEM_GDBINIT_SRCDIR)/$$file ; \
    386 	  if test -f $$f ; then \
    387 	    $(INSTALL_DATA) $$f $(SYSTEM_GDBINIT_INSTALL_DIR) ; \
    388 	  fi ; \
    389 	done
    390 
    391 .PHONY: uninstall-system-gdbinit
    392 uninstall-system-gdbinit:
    393 	files='$(SYSTEM_GDBINIT_FILES)' ; \
    394 	for file in $$files ; do \
    395 	  slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
    396 	  rm -f $(SYSTEM_GDBINIT_INSTALL_DIR)/$$file ; \
    397 	  while test "x$$file" != "x$$slashdir" ; do \
    398 	    rmdir 2>/dev/null "$(SYSTEM_GDBINIT_INSTALL_DIR)$$slashdir" ; \
    399 	    file="$$slashdir" ; \
    400 	    slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
    401 	  done \
    402 	done
    403 
    404 # Traditionally "install" depends on "all".  But it may be useful
    405 # not to; for example, if the user has made some trivial change to a
    406 # source file and doesn't care about rebuilding or just wants to save the
    407 # time it takes for make to check that all is up to date.
    408 # install-only is intended to address that need.
    409 .PHONY: install
    410 install: all
    411 	@$(MAKE) $(FLAGS_TO_PASS) install-only
    412 
    413 .PHONY: install-only
    414 install-only: install-syscalls install-python install-guile \
    415 	install-system-gdbinit
    416 
    417 .PHONY: uninstall
    418 uninstall: uninstall-syscalls uninstall-python uninstall-guile \
    419 	uninstall-system-gdbinit
    420 
    421 .PHONY: clean
    422 clean: clean-syscalls clean-python clean-guile clean-system-gdbinit
    423 
    424 .PHONY: maintainer-clean realclean distclean
    425 maintainer-clean realclean distclean: clean
    426 	rm -f Makefile
    427 
    428 .PHONY: check installcheck info dvi pdf html
    429 .PHONY: install-info install-pdf install-html clean-info
    430 check installcheck:
    431 info dvi pdf html:
    432 install-info install-dvi install-pdf install-html:
    433 clean-info:
    434 
    435 # GNU Make has an annoying habit of putting *all* the Makefile variables
    436 # into the environment, unless you include this target as a circumvention.
    437 # Rumor is that this will be fixed (and this target can be removed)
    438 # in GNU Make 4.0.
    439 .NOEXPORT:
    440 
    441 # GNU Make 3.63 has a different problem: it keeps tacking command line
    442 # overrides onto the definition of $(MAKE).  This variable setting
    443 # will remove them.
    444 MAKEOVERRIDES=
    445 
    446 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    447 	$(ECHO_GEN) cd .. && $(SHELL) ./config.status $(SILENT_FLAG) data-directory/Makefile
    448 
    449 # Disable implicit make rules.
    450 include $(srcdir)/../disable-implicit-rules.mk
    451