1## Copyright (C) 2014 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 \
23	-I $(srcdir)/../gcc/c -I $(srcdir)/../gcc/c-family \
24	-I $(srcdir)/../libcpp/include $(GMPINC)
25AM_CXXFLAGS = $(WARN_FLAGS) $(WERROR) $(visibility)
26override CXXFLAGS := $(filter-out -fsanitize=address,$(CXXFLAGS))
27override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
28# Can be simplified when libiberty becomes a normal convenience library.
29libiberty_normal = ../libiberty/libiberty.a
30libiberty_noasan = ../libiberty/noasan/libiberty.a
31libiberty_pic = ../libiberty/pic/libiberty.a
32Wc=-Wc,
33libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
34	    $(if $(wildcard $(libiberty_pic)),$(Wc)$(libiberty_pic), \
35	    $(Wc)$(libiberty_normal)))
36libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
37
38plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
39cc1libdir = $(libdir)/$(libsuffix)
40
41if ENABLE_PLUGIN
42plugin_LTLIBRARIES = libcc1plugin.la
43cc1lib_LTLIBRARIES = libcc1.la
44endif
45
46BUILT_SOURCES = compiler-name.h
47
48# Put this in a header so we don't run sed for each compilation.  This
49# is also simpler to debug as one can easily see the constant.
50compiler-name.h: Makefile
51	echo "#define COMPILER_NAME \"`echo gcc | sed '$(transform)'`\"" > compiler-name.h
52
53
54shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \
55    marshall.cc marshall.hh rpc.hh status.hh
56
57libcc1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1plugin.sym
58libcc1plugin_la_SOURCES = plugin.cc $(shared_source)
59libcc1plugin_la_LIBADD = $(libiberty)
60libcc1plugin_la_DEPENDENCIES = $(libiberty_dep)
61libcc1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
62	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
63	$(CXXFLAGS) $(libcc1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@
64
65LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
66libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym
67libcc1_la_SOURCES = findcomp.cc libcc1.cc names.cc names.hh $(shared_source)
68libcc1_la_LIBADD = $(libiberty)
69libcc1_la_DEPENDENCIES = $(libiberty_dep)
70libcc1_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
71	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
72	$(CXXFLAGS) $(libcc1_la_LDFLAGS) $(LTLDFLAGS) -o $@
73