1## Makefile for the VTV library.
2##
3## Copyright (C) 2013 Free Software Foundation, Inc.
4##
5## Process this file with automake to produce Makefile.in.
6##
7## This file is part of the Vtable Verification (VTV) Library.  This
8## library is free software; you can redistribute it and/or modify it
9## under the terms of the GNU General Public License as published by
10## the Free Software Foundation; either version 3, or (at your option)
11## any later version.
12
13## This library is distributed in the hope that it will be useful, but
14## WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16## General Public License for more details.
17
18## You should have received a copy of the GNU General Public License
19## along with this library; see the file COPYING3.  If not see
20## <http://www.gnu.org/licenses/>.
21
22if ENABLE_VTABLE_VERIFY
23  SUBDIRS = testsuite
24else
25  SUBDIRS=
26endif
27
28ACLOCAL_AMFLAGS = -I .. -I ../config
29
30# May be used by toolexeclibdir.
31gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
32
33DEFS = @DEFS@
34AM_CPPFLAGS = -I$(top_srcdir)/../include
35AM_CFLAGS = $(XCFLAGS)
36AM_CCASFLAGS = $(XCFLAGS)
37AM_CXXFLAGS = $(XCFLAGS)  
38AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
39AM_CXXFLAGS += -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end
40
41if VTV_CYGMIN
42  toolexeclib_LTLIBRARIES = libvtv.la libvtv_stubs.la
43else
44  toolexeclib_LTLIBRARIES = libvtv.la
45endif
46
47vtv_headers = \
48	vtv_map.h \
49	vtv_malloc.h \
50	vtv_fail.h \
51	vtv_set.h \
52	vtv_utils.h \
53	vtv_rts.h
54
55vtv_sources = \
56	vtv_start.c \
57        vtv_malloc.cc \
58        vtv_rts.cc \
59        vtv_utils.cc \
60	vtv_end.c
61
62vtv_stubs_sources = \
63	vtv_start.c \
64	vtv_stubs.cc \
65	vtv_end.c
66
67libvtv_includedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
68
69# Link in vtv_start and vtv_end. 
70BUILT_SOURCES = vtv_start.c vtv_end.c
71vtv_start.c:
72	rm -f $@
73	$(LN_S) $(toplevel_srcdir)/libgcc/vtv_start.c $@
74
75vtv_end.c:
76	rm -f $@
77	$(LN_S) $(toplevel_srcdir)/libgcc/vtv_end.c $@
78
79if VTV_CYGMIN
80  obstack.c:
81	  rm -f $@
82	  $(LN_S) $(toplevel_srcdir)/libiberty/obstack.c $@
83  
84  vtv_stubs.cc:
85	  rm -f $@
86	  $(LN_S) $(toplevel_srcdir)/libstdc++-v3/libsupc++/vtv_stubs.cc $@
87endif
88
89if VTV_CYGMIN
90  libvtv_la_LIBADD = -lpsapi
91  libvtv_la_LDFLAGS = $(lt_host_flags)
92  libvtv_stubs_la_LDFLAGS = $(lt_host_flags)
93endif
94
95if ENABLE_VTABLE_VERIFY
96if VTV_CYGMIN
97  libvtv_la_SOURCES = $(vtv_sources) obstack.c
98  libvtv_stubs_la_SOURCES = $(vtv_stubs_sources)
99else
100  libvtv_la_SOURCES = $(vtv_sources)
101endif
102  libvtv_include_HEADERS = $(vtv_headers)
103else
104  libvtv_la_SOURCES =
105  libvtv_include_HEADERS =
106endif
107
108# Least ordering for dependencies mean linking w/o libstdc++ for as
109# long as the development of libvtv does not absolutely require it.
110CXXVTV=$(CC_FOR_TARGET)
111CXXLD=$(CC_FOR_TARGET)
112
113LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
114	--mode=compile $(CXXVTV) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
115	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
116
117CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
118	--mode=link $(CXXVTV) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
119	$(LDFLAGS) -o $@
120