xref: /netbsd-src/external/gpl3/gcc/dist/c++tools/Makefile.in (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1# Makefile for c++tools
2#   Copyright (C) 2020-2022 Free Software Foundation, Inc.
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; see the file COPYING3.  If not see
16# <http://www.gnu.org/licenses/>.
17
18srcdir := @srcdir@
19prefix := @prefix@
20bindir := @bindir@
21libexecdir := @libexecdir@
22target_noncanonical := @target_noncanonical@
23gcc_version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER)
24libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
25INSTALL_PROGRAM := @INSTALL_PROGRAM@
26INSTALL_STRIP_PROGRAM := $(srcdir)/../install-sh -c -s
27AUTOCONF := @AUTOCONF@
28AUTOHEADER := @AUTOHEADER@
29CXX := @CXX@
30CXXFLAGS := @CXXFLAGS@
31PIEFLAG := @PIEFLAG@
32CXXOPTS := $(CXXFLAGS) $(PIEFLAG) -fno-exceptions -fno-rtti
33LDFLAGS := @LDFLAGS@
34exeext := @EXEEXT@
35LIBIBERTY := ../libiberty/libiberty.a
36NETLIBS := @NETLIBS@
37VERSION.O := ../gcc/version.o
38
39all::
40
41mostlyclean::
42	rm -f $(MAPPER.O)
43
44clean::
45	rm -f g++-mapper-server$(exeext)
46
47distclean::
48	rm -f config.log config.status config.h
49
50maintainer-clean::
51
52install::
53
54check::
55installcheck::
56dvi::
57pdf::
58html::
59info::
60install-info::
61install-pdf::
62install-dvi::
63install-man::
64install-html::
65
66install-strip: override INSTALL_PROGRAM = $(INSTALL_STRIP_PROGRAM)
67ifneq ($(STRIP),)
68install-strip: STRIPPROG = $(STRIP)
69export STRIPPROG
70endif
71install-strip: install
72
73vpath %.cc $(srcdir)
74vpath %.in $(srcdir)
75.SUFFIXES:
76.SUFFIXES: .cc .o
77
78# Per-source & per-directory compile flags (warning: recursive)
79SRC_CXXFLAGS = $(CXXFLAGS$(patsubst $(srcdir)%,%,$1)) \
80	$(if $(filter-out $(srcdir)/,$1),\
81	  $(call $0,$(dir $(patsubst %/,%,$1))))
82
83%.o: %.cc
84	$(CXX) $(strip $(CXXOPTS) $(call SRC_CXXFLAGS,$<) $(CXXINC)) \
85	  -MMD -MP -MF ${@:.o=.d} -c -o $@ $<
86
87ifeq (@CXX_AUX_TOOLS@,yes)
88
89all::g++-mapper-server$(exeext)
90
91MAPPER.O := server.o resolver.o
92CODYLIB = ../libcody/libcody.a
93CXXINC += -I$(srcdir)/../libcody -I$(srcdir)/../include -I$(srcdir)/../gcc -I. -I../gcc
94g++-mapper-server$(exeext): $(MAPPER.O) $(CODYLIB)
95	+$(CXX) $(LDFLAGS) $(PIEFLAG) -o $@ $^ $(LIBIBERTY) $(NETLIBS)
96
97# copy to gcc dir so tests there can run
98all::../gcc/g++-mapper-server$(exeext)
99
100../gcc/g++-mapper-server$(exeext): g++-mapper-server$(exeext)
101	$(INSTALL) $< $@
102
103install::
104	$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(libexecsubdir)
105	$(INSTALL_PROGRAM) g++-mapper-server$(exeext) $(DESTDIR)$(libexecsubdir)
106endif
107
108ifneq ($(MAINTAINER),)
109override MAINTAINER += $1
110endif
111ifeq (@MAINTAINER@,yes)
112MAINTAINER = $2
113else
114MAINTAINER = \# --enable-maintainer-mode to rebuild $1, or make MAINTAINER=touch
115endif
116
117all:: Makefile
118
119Makefile: $(srcdir)/Makefile.in config.status
120	$(SHELL) ./config.status Makefile
121
122$(srcdir)/configure: $(srcdir)/configure.ac
123	$(call MAINTAINER,$@,cd $(@D) && $(AUTOCONF) -W all,error)
124
125$(srcdir)/config.h.in: $(srcdir)/configure.ac
126	$(call MAINTAINER,$@,cd $(@D) && $(AUTOHEADER) -f -W all,error)
127
128config.h: config.status config.h.in
129	./$< --header=$@
130	touch $@
131
132config.status: $(srcdir)/configure $(srcdir)/config.h.in
133	if test -x $@; then ./$@ -recheck; else $< @configure_args@; fi
134
135.PHONY: all check clean distclean maintainer-clean
136
137-include $(MAPPER.O:.o=.d)
138