1## Makefile for the python subdirectory of the GNU C++ Standard library.
2##
3## Copyright (C) 2009-2021 Free Software Foundation, Inc.
4##
5## This file is part of the libstdc++ version 3 distribution.
6## Process this file with automake to produce Makefile.in.
7
8## This file is part of the GNU ISO C++ Library.  This library is free
9## software; you can redistribute it and/or modify it under the
10## terms of the GNU General Public License as published by the
11## Free Software Foundation; either version 3, or (at your option)
12## any later version.
13##
14## This library is distributed in the hope that it will be useful,
15## but WITHOUT ANY WARRANTY; without even the implied warranty of
16## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17## GNU General Public License for more details.
18##
19## You should have received a copy of the GNU General Public License along
20## with this library; see the file COPYING3.  If not see
21## <http://www.gnu.org/licenses/>.
22
23include $(top_srcdir)/fragment.am
24
25## Where to install the module code.
26if ENABLE_PYTHONDIR
27pythondir = $(prefix)/$(python_mod_dir)
28else
29pythondir = $(datadir)/gcc-$(gcc_version)/python
30endif
31
32all-local: gdb.py
33
34nobase_python_DATA = \
35    libstdcxx/v6/printers.py \
36    libstdcxx/v6/xmethods.py \
37    libstdcxx/v6/__init__.py \
38    libstdcxx/__init__.py
39
40gdb.py: hook.in Makefile
41	sed -e 's,@pythondir@,$(pythondir),' \
42	    -e 's,@toolexeclibdir@,$(toolexeclibdir),' < $(srcdir)/hook.in > $@
43
44install-data-local: gdb.py
45	@$(mkdir_p) $(DESTDIR)$(toolexeclibdir)
46## We want to install gdb.py as SOMETHING-gdb.py.  SOMETHING is the
47## full name of the final library.  We use the libtool .la file to get
48## the correct name.
49	@libname=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
50	          $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \
51	if [ -z "$$libname" ]; then \
52	  libname=`sed -ne "/^old_library=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
53		  $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \
54	fi; \
55	echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
56	$(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py
57