1 # Copyright (C) 2010-2016 Free Software Foundation, Inc.
3 # Makefile for building a staged copy of the data-directory.
4 # This file is part of GDB.
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.
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.
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/>.
20 SYSCALLS_SRCDIR = $(srcdir)/../syscalls
21 PYTHON_SRCDIR = $(srcdir)/../python/lib
22 GUILE_SRCDIR = $(srcdir)/../guile/lib
23 SYSTEM_GDBINIT_SRCDIR = $(srcdir)/../system-gdbinit
24 VPATH = $(srcdir):$(SYSCALLS_SRCDIR):$(PYTHON_SRCDIR):$(GUILE_SRCDIR):$(SYSTEM_GDBINIT_SRCDIR)
26 top_srcdir = @top_srcdir@
27 top_builddir = @top_builddir@
30 exec_prefix = @exec_prefix@
32 datarootdir = @datarootdir@
40 INSTALL_DATA = @INSTALL_DATA@
41 INSTALL_DIR = $(SHELL) $(srcdir)/../../mkinstalldirs
43 GDB_DATADIR = @GDB_DATADIR@
45 SYSCALLS_DIR = syscalls
46 SYSCALLS_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SYSCALLS_DIR)
49 arm-linux.xml aarch64-linux.xml \
50 ppc-linux.xml ppc64-linux.xml \
51 i386-linux.xml amd64-linux.xml \
52 sparc-linux.xml sparc64-linux.xml \
53 mips-o32-linux.xml mips-n32-linux.xml mips-n64-linux.xml \
54 s390-linux.xml s390x-linux.xml
57 PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR)
61 gdb/FrameIterator.py \
62 gdb/FrameDecorator.py \
68 gdb/command/__init__.py \
69 gdb/command/xmethods.py \
70 gdb/command/frame_filters.py \
71 gdb/command/unwinders.py \
72 gdb/command/type_printers.py \
73 gdb/command/pretty_printers.py \
74 gdb/command/prompt.py \
75 gdb/command/explore.py \
76 gdb/function/__init__.py \
77 gdb/function/as_string.py \
78 gdb/function/caller_is.py \
79 gdb/function/strfns.py \
80 gdb/printer/__init__.py \
81 gdb/printer/bound_registers.py
83 @HAVE_PYTHON_TRUE@PYTHON_FILES = $(PYTHON_FILE_LIST)
84 @HAVE_PYTHON_FALSE@PYTHON_FILES =
87 GUILE_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(GUILE_DIR)
89 GUILE_SOURCE_FILES = \
92 gdb/experimental.scm \
99 GUILE_COMPILED_FILES = \
101 gdb/experimental.go \
107 @HAVE_GUILE_TRUE@GUILE_FILES = $(GUILE_SOURCE_FILES) $(GUILE_COMPILED_FILES)
108 @HAVE_GUILE_FALSE@GUILE_FILES =
111 GUILD_TARGET_FLAG = @GUILD_TARGET_FLAG@
113 # Flags passed to 'guild compile'.
114 # Note: We can't use -Wunbound-variable because all the variables
115 # defined in C aren't visible when we compile.
116 # Note: To work around a guile 2.0.5 issue (it can't find gdb/init.scm even if
117 # we pass -L <dir>) we have to compile in the directory containing gdb.scm.
118 # We still need to pass "-L ." so that other modules are found.
119 GUILD_COMPILE_FLAGS = \
120 $(GUILD_TARGET_FLAG) \
121 -Warity-mismatch -Wformat -Wunused-toplevel \
124 SYSTEM_GDBINIT_DIR = system-gdbinit
125 SYSTEM_GDBINIT_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SYSTEM_GDBINIT_DIR)
126 SYSTEM_GDBINIT_FILES = \
132 "exec_prefix=$(exec_prefix)" \
133 "infodir=$(infodir)" \
134 "datarootdir=$(datarootdir)" \
136 "htmldir=$(htmldir)" \
140 "datadir=$(datadir)" \
141 "includedir=$(includedir)" \
142 "against=$(against)" \
143 "DESTDIR=$(DESTDIR)" \
145 "AR_FLAGS=$(AR_FLAGS)" \
149 "CXXFLAGS=$(CXXFLAGS)" \
150 "DLLTOOL=$(DLLTOOL)" \
151 "LDFLAGS=$(LDFLAGS)" \
153 "MAKEINFO=$(MAKEINFO)" \
154 "MAKEHTML=$(MAKEHTML)" \
155 "MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
156 "INSTALL=$(INSTALL)" \
157 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
158 "INSTALL_DATA=$(INSTALL_DATA)" \
159 "RUNTEST=$(RUNTEST)" \
160 "RUNTESTFLAGS=$(RUNTESTFLAGS)"
163 all: stamp-syscalls stamp-python stamp-guile stamp-system-gdbinit
165 # For portability's sake, we need to handle systems that don't have
167 stamp-syscalls: Makefile $(SYSCALLS_FILES)
168 rm -rf ./$(SYSCALLS_DIR)
169 mkdir ./$(SYSCALLS_DIR)
170 files='$(SYSCALLS_FILES)' ; \
171 for file in $$files ; do \
172 f=$(SYSCALLS_SRCDIR)/$$file ; \
173 if test -f $$f ; then \
174 $(INSTALL_DATA) $$f ./$(SYSCALLS_DIR) ; \
179 .PHONY: clean-syscalls
181 rm -rf $(SYSCALLS_DIR)
184 # This target is responsible for properly installing the syscalls'
185 # XML files in the system.
186 .PHONY: install-syscalls
188 $(INSTALL_DIR) $(SYSCALLS_INSTALL_DIR)
189 files='$(SYSCALLS_FILES)' ; \
190 for file in $$files; do \
191 f=$(SYSCALLS_SRCDIR)/$$file ; \
192 if test -f $$f ; then \
193 $(INSTALL_DATA) $$f $(SYSCALLS_INSTALL_DIR) ; \
197 .PHONY: uninstall-syscalls
199 files='$(SYSCALLS_FILES)' ; \
200 for file in $$files ; do \
201 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
202 rm -f $(SYSCALLS_INSTALL_DIR)/$$file ; \
203 while test "x$$file" != "x$$slashdir" ; do \
204 rmdir 2>/dev/null "$(SYSCALLS_INSTALL_DIR)$$slashdir" ; \
205 file="$$slashdir" ; \
206 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
210 stamp-python: Makefile $(PYTHON_FILES)
211 rm -rf ./$(PYTHON_DIR)
212 files='$(PYTHON_FILES)' ; \
213 if test "x$$files" != x ; then \
214 for file in $$files ; do \
215 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
216 $(INSTALL_DIR) ./$(PYTHON_DIR)/$$dir ; \
217 $(INSTALL_DATA) $(PYTHON_SRCDIR)/$$file ./$(PYTHON_DIR)/$$dir ; \
227 .PHONY: install-python
229 files='$(PYTHON_FILES)' ; \
230 if test "x$$files" != x ; then \
231 for file in $$files ; do \
232 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
233 $(INSTALL_DIR) $(PYTHON_INSTALL_DIR)/$$dir ; \
234 $(INSTALL_DATA) ./$(PYTHON_DIR)/$$file $(PYTHON_INSTALL_DIR)/$$dir ; \
238 .PHONY: uninstall-python
240 files='$(PYTHON_FILES)' ; \
241 if test "x$$files" != x ; then \
242 for file in $$files ; do \
243 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
244 rm -f $(PYTHON_INSTALL_DIR)/$$file ; \
245 while test "x$$file" != "x$$slashdir" ; do \
246 rmdir 2>/dev/null "$(PYTHON_INSTALL_DIR)$$slashdir" ; \
247 file="$$slashdir" ; \
248 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
253 stamp-guile: Makefile $(GUILE_SOURCE_FILES)
254 rm -rf ./$(GUILE_DIR)
255 if test "x$(GUILE_FILES)" != x ; then \
256 files='$(GUILE_SOURCE_FILES)' ; \
257 for file in $$files ; do \
258 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
259 $(INSTALL_DIR) ./$(GUILE_DIR)/$$dir ; \
260 $(INSTALL_DATA) $(GUILE_SRCDIR)/$$file ./$(GUILE_DIR)/$$dir ; \
262 files='$(GUILE_COMPILED_FILES)' ; \
263 cd ./$(GUILE_DIR) ; \
264 for go in $$files ; do \
265 source="`echo $$go | sed 's/\.go$$/.scm/'`" ; \
266 echo $(GUILD) compile $(GUILD_COMPILE_FLAGS) -o "$$go" "$$source" ; \
267 $(GUILD) compile $(GUILD_COMPILE_FLAGS) -o "$$go" "$$source" || exit 1 ; \
277 .PHONY: install-guile
279 files='$(GUILE_FILES)' ; \
280 if test "x$$files" != x ; then \
281 for file in $$files ; do \
282 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
283 $(INSTALL_DIR) $(GUILE_INSTALL_DIR)/$$dir ; \
284 $(INSTALL_DATA) ./$(GUILE_DIR)/$$file $(GUILE_INSTALL_DIR)/$$dir ; \
288 .PHONY: uninstall-guile
290 files='$(GUILE_FILES)' ; \
291 if test "x$$files" != x ; then \
292 for file in $$files ; do \
293 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
294 rm -f $(GUILE_INSTALL_DIR)/$$file ; \
295 while test "x$$file" != "x$$slashdir" ; do \
296 rmdir 2>/dev/null "$(GUILE_INSTALL_DIR)$$slashdir" ; \
297 file="$$slashdir" ; \
298 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
303 stamp-system-gdbinit: Makefile $(SYSTEM_GDBINIT_FILES)
304 rm -rf ./$(SYSTEM_GDBINIT_DIR)
305 mkdir ./$(SYSTEM_GDBINIT_DIR)
306 files='$(SYSTEM_GDBINIT_FILES)' ; \
307 for file in $$files ; do \
308 f=$(SYSTEM_GDBINIT_SRCDIR)/$$file ; \
309 if test -f $$f ; then \
310 $(INSTALL_DATA) $$f ./$(SYSTEM_GDBINIT_DIR) ; \
315 .PHONY: clean-system-gdbinit
316 clean-system-gdbinit:
317 rm -rf $(SYSTEM_GDBINIT_DIR)
318 rm -f stamp-system-gdbinit
320 .PHONY: install-system-gdbinit
321 install-system-gdbinit:
322 $(INSTALL_DIR) $(SYSTEM_GDBINIT_INSTALL_DIR)
323 files='$(SYSTEM_GDBINIT_FILES)' ; \
324 for file in $$files; do \
325 f=$(SYSTEM_GDBINIT_SRCDIR)/$$file ; \
326 if test -f $$f ; then \
327 $(INSTALL_DATA) $$f $(SYSTEM_GDBINIT_INSTALL_DIR) ; \
331 .PHONY: uninstall-system-gdbinit
332 uninstall-system-gdbinit:
333 files='$(SYSTEM_GDBINIT_FILES)' ; \
334 for file in $$files ; do \
335 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
336 rm -f $(SYSTEM_GDBINIT_INSTALL_DIR)/$$file ; \
337 while test "x$$file" != "x$$slashdir" ; do \
338 rmdir 2>/dev/null "$(SYSTEM_GDBINIT_INSTALL_DIR)$$slashdir" ; \
339 file="$$slashdir" ; \
340 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
344 # Traditionally "install" depends on "all". But it may be useful
345 # not to; for example, if the user has made some trivial change to a
346 # source file and doesn't care about rebuilding or just wants to save the
347 # time it takes for make to check that all is up to date.
348 # install-only is intended to address that need.
351 @$(MAKE) $(FLAGS_TO_PASS) install-only
354 install-only: install-syscalls install-python install-guile \
355 install-system-gdbinit
358 uninstall: uninstall-syscalls uninstall-python uninstall-guile \
359 uninstall-system-gdbinit
362 clean: clean-syscalls clean-python clean-guile clean-system-gdbinit
364 .PHONY: maintainer-clean realclean distclean
365 maintainer-clean realclean distclean: clean
368 .PHONY: check installcheck info dvi pdf html
369 .PHONY: install-info install-pdf install-html clean-info
372 install-info install-pdf install-html:
375 # GNU Make has an annoying habit of putting *all* the Makefile variables
376 # into the environment, unless you include this target as a circumvention.
377 # Rumor is that this will be fixed (and this target can be removed)
381 # GNU Make 3.63 has a different problem: it keeps tacking command line
382 # overrides onto the definition of $(MAKE). This variable setting
386 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
387 cd $(top_builddir) && $(MAKE) data-directory/Makefile