Tweak
[official-gcc.git] / libcc1 / Makefile.am
blob5e61a92a26b05ed756a44c74262b843e01a3c045
1 ## Copyright (C) 2014-2017 Free Software Foundation, Inc.
3 ## This file is part of GCC.
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.
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.
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/>.
19 ACLOCAL_AMFLAGS = -I .. -I ../config
20 gcc_build_dir = ../gcc
21 AM_CPPFLAGS = -I $(srcdir)/../include -I $(srcdir)/../libgcc \
22         -I $(gcc_build_dir) -I$(srcdir)/../gcc $($@_CPPFLAGS) $(GMPINC)
23 CPPFLAGS_FOR_C_FAMILY = -I $(srcdir)/../gcc/c-family \
24         -I $(srcdir)/../libcpp/include
25 CPPFLAGS_FOR_C = $(CPPFLAGS_FOR_C_FAMILY) -I $(srcdir)/../gcc/c
26 CPPFLAGS_FOR_CXX = $(CPPFLAGS_FOR_C_FAMILY) -I $(srcdir)/../gcc/cp
27 AM_CXXFLAGS = $(WARN_FLAGS) $(WERROR) $(visibility)
28 override CXXFLAGS := $(filter-out -fsanitize=address,$(CXXFLAGS))
29 override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
30 # Can be simplified when libiberty becomes a normal convenience library.
31 libiberty_normal = ../libiberty/libiberty.a
32 libiberty_noasan = ../libiberty/noasan/libiberty.a
33 libiberty_pic = ../libiberty/pic/libiberty.a
34 Wc=-Wc,
35 libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
36             $(if $(wildcard $(libiberty_pic)),$(Wc)$(libiberty_pic), \
37             $(Wc)$(libiberty_normal)))
38 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
40 plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
41 cc1libdir = $(libdir)/$(libsuffix)
43 if ENABLE_PLUGIN
44 plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
45 cc1lib_LTLIBRARIES = libcc1.la
46 endif
48 BUILT_SOURCES = c-compiler-name.h cp-compiler-name.h
49 MOSTLYCLEANFILES = c-compiler-name.h cp-compiler-name.h
51 # Put this in a header so we don't run sed for each compilation.  This
52 # is also simpler to debug as one can easily see the constant.
53 # FIXME: compute it in configure.ac and output it in config.status, or
54 # introduce timestamp files for some indirection to avoid rebuilding it
55 # every time.
56 c-compiler-name.h: Makefile
57         -rm -f $@T
58         echo "#define C_COMPILER_NAME \"`echo gcc | sed '$(transform)'`\"" > $@T
59         mv $@T $@ # $(SHELL) $(srcdir)/../move-if-change $@T $@
61 cp-compiler-name.h: Makefile
62         -rm -f $@T
63         echo "#define CP_COMPILER_NAME \"`echo g++ | sed '$(transform)'`\"" > $@T
64         mv $@T $@ # $(SHELL) $(srcdir)/../move-if-change $@T $@
66 shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \
67     marshall.cc marshall.hh rpc.hh status.hh
69 marshall_c_source = marshall-c.hh
70 marshall_cxx_source = marshall-cp.hh
72 libcc1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1plugin.sym
73 libcc1plugin_la_SOURCES = libcc1plugin.cc $(shared_source) $(marshall_c_source)
74 libcc1plugin.lo_CPPFLAGS = $(CPPFLAGS_FOR_C)
75 libcc1plugin_la_LIBADD = $(libiberty)
76 libcc1plugin_la_DEPENDENCIES = $(libiberty_dep)
77 libcc1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
78         $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
79         $(CXXFLAGS) $(libcc1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@
81 libcp1plugin_la_LDFLAGS = -module -export-symbols $(srcdir)/libcp1plugin.sym
82 libcp1plugin_la_SOURCES = libcp1plugin.cc $(shared_source) $(marshall_cxx_source)
83 libcp1plugin.lo_CPPFLAGS = $(CPPFLAGS_FOR_CXX)
84 libcp1plugin_la_LIBADD = $(libiberty)
85 libcp1plugin_la_DEPENDENCIES = $(libiberty_dep)
86 libcp1plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
87         $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
88         $(CXXFLAGS) $(libcp1plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@
90 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
91 libcc1_la_LDFLAGS = -module -export-symbols $(srcdir)/libcc1.sym
92 libcc1_la_SOURCES = findcomp.cc libcc1.cc libcp1.cc \
93                 names.cc names.hh $(shared_source) \
94                 $(marshall_c_source) $(marshall_cxx_source)
95 libcc1_la_LIBADD = $(libiberty)
96 libcc1_la_DEPENDENCIES = $(libiberty_dep)
97 libcc1_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
98         $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
99         $(CXXFLAGS) $(libcc1_la_LDFLAGS) $(LTLDFLAGS) -o $@