1# Copyright (C) 2010-2013 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 19srcdir = @srcdir@ 20SYSCALLS_SRCDIR = $(srcdir)/../syscalls 21PYTHON_SRCDIR = $(srcdir)/../python/lib 22VPATH = $(srcdir):$(SYSCALLS_SRCDIR):$(PYTHON_SRCDIR) 23 24top_srcdir = @top_srcdir@ 25top_builddir = @top_builddir@ 26 27prefix = @prefix@ 28exec_prefix = @exec_prefix@ 29 30datarootdir = @datarootdir@ 31datadir = @datadir@ 32 33SHELL = @SHELL@ 34 35LN_S = @LN_S@ 36 37INSTALL = @INSTALL@ 38INSTALL_DATA = @INSTALL_DATA@ 39INSTALL_DIR = $(SHELL) $(srcdir)/../../mkinstalldirs 40 41GDB_DATADIR = @GDB_DATADIR@ 42 43SYSCALLS_DIR = syscalls 44SYSCALLS_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SYSCALLS_DIR) 45SYSCALLS_FILES = \ 46 gdb-syscalls.dtd \ 47 ppc-linux.xml ppc64-linux.xml \ 48 i386-linux.xml amd64-linux.xml \ 49 sparc-linux.xml sparc64-linux.xml \ 50 mips-o32-linux.xml mips-n32-linux.xml mips-n64-linux.xml 51 52PYTHON_DIR = python 53PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) 54PYTHON_FILES = \ 55 gdb/__init__.py \ 56 gdb/types.py \ 57 gdb/printing.py \ 58 gdb/prompt.py \ 59 gdb/command/__init__.py \ 60 gdb/command/type_printers.py \ 61 gdb/command/pretty_printers.py \ 62 gdb/command/prompt.py \ 63 gdb/command/explore.py \ 64 gdb/function/__init__.py \ 65 gdb/function/strfns.py 66 67FLAGS_TO_PASS = \ 68 "prefix=$(prefix)" \ 69 "exec_prefix=$(exec_prefix)" \ 70 "infodir=$(infodir)" \ 71 "datarootdir=$(datarootdir)" \ 72 "docdir=$(docdir)" \ 73 "htmldir=$(htmldir)" \ 74 "pdfdir=$(pdfdir)" \ 75 "libdir=$(libdir)" \ 76 "mandir=$(mandir)" \ 77 "datadir=$(datadir)" \ 78 "includedir=$(includedir)" \ 79 "against=$(against)" \ 80 "DESTDIR=$(DESTDIR)" \ 81 "AR=$(AR)" \ 82 "AR_FLAGS=$(AR_FLAGS)" \ 83 "CC=$(CC)" \ 84 "CFLAGS=$(CFLAGS)" \ 85 "CXX=$(CXX)" \ 86 "CXXFLAGS=$(CXXFLAGS)" \ 87 "DLLTOOL=$(DLLTOOL)" \ 88 "LDFLAGS=$(LDFLAGS)" \ 89 "RANLIB=$(RANLIB)" \ 90 "MAKEINFO=$(MAKEINFO)" \ 91 "MAKEHTML=$(MAKEHTML)" \ 92 "MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \ 93 "INSTALL=$(INSTALL)" \ 94 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ 95 "INSTALL_DATA=$(INSTALL_DATA)" \ 96 "RUNTEST=$(RUNTEST)" \ 97 "RUNTESTFLAGS=$(RUNTESTFLAGS)" 98 99.PHONY: all 100all: stamp-syscalls stamp-python 101 102# For portability's sake, we need to handle systems that don't have 103# symbolic links. 104stamp-syscalls: Makefile $(SYSCALLS_FILES) 105 rm -rf ./$(SYSCALLS_DIR) 106 mkdir ./$(SYSCALLS_DIR) 107 files='$(SYSCALLS_FILES)' ; \ 108 for file in $$files ; do \ 109 f=$(SYSCALLS_SRCDIR)/$$file ; \ 110 if test -f $$f ; then \ 111 $(INSTALL_DATA) $$f ./$(SYSCALLS_DIR) ; \ 112 fi ; \ 113 done 114 touch $@ 115 116.PHONY: clean-syscalls 117clean-syscalls: 118 rm -rf $(SYSCALLS_DIR) 119 rm -f stamp-syscalls 120 121# This target is responsible for properly installing the syscalls' 122# XML files in the system. 123.PHONY: install-syscalls 124install-syscalls: 125 $(INSTALL_DIR) $(SYSCALLS_INSTALL_DIR) 126 files='$(SYSCALLS_FILES)' ; \ 127 for file in $$files; do \ 128 f=$(SYSCALLS_SRCDIR)/$$file ; \ 129 if test -f $$f ; then \ 130 $(INSTALL_DATA) $$f $(SYSCALLS_INSTALL_DIR) ; \ 131 fi ; \ 132 done 133 134.PHONY: uninstall-syscalls 135uninstall-syscalls: 136 files='$(SYSCALLS_FILES)' ; \ 137 for file in $$files ; do \ 138 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \ 139 rm -f $(SYSCALLS_INSTALL_DIR)/$$file ; \ 140 while test "x$$file" != "x$$slashdir" ; do \ 141 rmdir 2>/dev/null "$(SYSCALLS_INSTALL_DIR)$$slashdir" ; \ 142 file="$$slashdir" ; \ 143 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 144 done \ 145 done 146 147stamp-python: Makefile $(PYTHON_FILES) 148 rm -rf ./$(PYTHON_DIR) 149 files='$(PYTHON_FILES)' ; \ 150 for file in $$files ; do \ 151 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 152 $(INSTALL_DIR) ./$(PYTHON_DIR)/$$dir ; \ 153 $(INSTALL_DATA) $(PYTHON_SRCDIR)/$$file ./$(PYTHON_DIR)/$$dir ; \ 154 done 155 touch $@ 156 157.PHONY: clean-python 158clean-python: 159 rm -rf $(PYTHON_DIR) 160 rm -f stamp-python 161 162.PHONY: install-python 163install-python: 164 files='$(PYTHON_FILES)' ; \ 165 for file in $$files ; do \ 166 dir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 167 $(INSTALL_DIR) $(PYTHON_INSTALL_DIR)/$$dir ; \ 168 $(INSTALL_DATA) ./$(PYTHON_DIR)/$$file $(PYTHON_INSTALL_DIR)/$$dir ; \ 169 done 170 171.PHONY: uninstall-python 172uninstall-python: 173 files='$(PYTHON_FILES)' ; \ 174 for file in $$files ; do \ 175 slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \ 176 rm -f $(PYTHON_INSTALL_DIR)/$$file ; \ 177 while test "x$$file" != "x$$slashdir" ; do \ 178 rmdir 2>/dev/null "$(PYTHON_INSTALL_DIR)$$slashdir" ; \ 179 file="$$slashdir" ; \ 180 slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \ 181 done \ 182 done 183 184# Traditionally "install" depends on "all". But it may be useful 185# not to; for example, if the user has made some trivial change to a 186# source file and doesn't care about rebuilding or just wants to save the 187# time it takes for make to check that all is up to date. 188# install-only is intended to address that need. 189.PHONY: install 190install: all 191 @$(MAKE) $(FLAGS_TO_PASS) install-only 192 193.PHONY: install-only 194install-only: install-syscalls install-python 195 196.PHONY: uninstall 197uninstall: uninstall-syscalls uninstall-python 198 199.PHONY: clean 200clean: clean-syscalls clean-python 201 202.PHONY: maintainer-clean realclean distclean 203maintainer-clean realclean distclean: clean 204 rm -f Makefile 205 206.PHONY: check installcheck info dvi pdf html 207.PHONY: install-info install-pdf install-html clean-info 208check installcheck: 209info dvi pdf html: 210install-info install-pdf install-html: 211clean-info: 212 213# GNU Make has an annoying habit of putting *all* the Makefile variables 214# into the environment, unless you include this target as a circumvention. 215# Rumor is that this will be fixed (and this target can be removed) 216# in GNU Make 4.0. 217.NOEXPORT: 218 219# GNU Make 3.63 has a different problem: it keeps tacking command line 220# overrides onto the definition of $(MAKE). This variable setting 221# will remove them. 222MAKEOVERRIDES= 223 224Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 225 cd $(top_builddir) && $(MAKE) data-directory/Makefile 226