Makefile.am revision 1.6
1## Copyright (C) 2014-2020 Free Software Foundation, Inc.
2
3## This file is part of GCC.
4
5## GCC is free software; you can redistribute it and/or modify it under
6## the terms of the GNU General Public License as published by the Free
7## Software Foundation; either version 3, or (at your option) any later
8## version.
9
10## GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11## WARRANTY; without even the implied warranty of MERCHANTABILITY or
12## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13## for more details.
14
15## You should have received a copy of the GNU General Public License
16## along with GCC; see the file COPYING3.  If not see
17## <http://www.gnu.org/licenses/>.
18
19ACLOCAL_AMFLAGS = -I .. -I ../config
20gcc_build_dir = ../gcc
21AM_CPPFLAGS = -I $(srcdir)/../include -I $(srcdir)/../libgcc \
22	-I $(gcc_build_dir) -I$(srcdir)/../gcc $($@_CPPFLAGS) $(GMPINC)
23CPPFLAGS_FOR_C_FAMILY = -I $(srcdir)/../gcc/c-family \
24	-I $(srcdir)/../libcpp/include
25CPPFLAGS_FOR_C = $(CPPFLAGS_FOR_C_FAMILY) -I $(srcdir)/../gcc/c
26CPPFLAGS_FOR_CXX = $(CPPFLAGS_FOR_C_FAMILY) -I $(srcdir)/../gcc/cp
27AM_CXXFLAGS = $(WARN_FLAGS) $(WERROR) $(visibility)
28if DARWIN_DYNAMIC_LOOKUP
29AM_CXXFLAGS += -Wl,-undefined,dynamic_lookup
30endif
31override CXXFLAGS := $(subst -mdynamic-no-pic,-fPIC,$(CXXFLAGS))
32override CXXFLAGS := $(filter-out -fsanitize=address,$(CXXFLAGS))
33override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
34# Can be simplified when libiberty becomes a normal convenience library.
35libiberty_normal = ../libiberty/libiberty.a
36libiberty_noasan = ../libiberty/noasan/libiberty.a
37libiberty_pic = ../libiberty/pic/libiberty.a
38Wc=-Wc,
39libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
40	    $(if $(wildcard $(libiberty_pic)),$(Wc)$(libiberty_pic), \
41	    $(Wc)$(libiberty_normal)))
42libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
43
44plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
45cc1libdir = $(libdir)/$(libsuffix)
46
47if ENABLE_PLUGIN
48plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
49cc1lib_LTLIBRARIES = libcc1.la
50endif
51
52shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \
53    marshall.cc marshall.hh rpc.hh status.hh
54
55marshall_c_source = marshall-c.hh
56marshall_cxx_source = marshall-cp.hh
57
58libcc1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1plugin.sym
59libcc1plugin_la_SOURCES = libcc1plugin.cc $(shared_source) $(marshall_c_source)
60libcc1plugin.lo_CPPFLAGS = $(CPPFLAGS_FOR_C)
61libcc1plugin_la_LIBADD = $(libiberty)
62libcc1plugin_la_DEPENDENCIES = $(libiberty_dep)
63libcc1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
64	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
65	$(CXXFLAGS) $(libcc1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@
66
67libcp1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcp1plugin.sym
68libcp1plugin_la_SOURCES = libcp1plugin.cc $(shared_source) $(marshall_cxx_source)
69libcp1plugin.lo_CPPFLAGS = $(CPPFLAGS_FOR_CXX)
70libcp1plugin_la_LIBADD = $(libiberty)
71libcp1plugin_la_DEPENDENCIES = $(libiberty_dep)
72libcp1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
73	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
74	$(CXXFLAGS) $(libcp1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@
75
76LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
77libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym
78libcc1_la_SOURCES = findcomp.cc libcc1.cc libcp1.cc \
79		names.cc names.hh $(shared_source) \
80		$(marshall_c_source) $(marshall_cxx_source)
81libcc1_la_LIBADD = $(libiberty)
82libcc1_la_DEPENDENCIES = $(libiberty_dep)
83libcc1_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
84	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
85	$(CXXFLAGS) $(libcc1_la_LDFLAGS) $(LTLDFLAGS) -o $@
86