2005-06-28 Paul Brook <paul@codesourcery.com>
[official-gcc.git] / libstdc++-v3 / libsupc++ / Makefile.am
blobc67c294fca07c4cac2a1de7dc020b5171ec51014
1 ## Makefile for the GNU C++ Support library.
2 ##
3 ## Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4 ##
5 ## Process this file with automake to produce Makefile.in.
6 ##
7 ## This file is part of GCC.
8 ##
9 ## GCC is free software; you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation; either version 2, or (at your option)
12 ## any later version.
14 ## GCC is distributed in the hope that it will be useful,
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ## GNU General Public License for more details.
19 ## You should have received a copy of the GNU General Public License
20 ## along with GCC; see the file COPYING.  If not, write to
21 ## the Free Software Foundation, 59 Temple Place - Suite 330,
22 ## Boston, MA 02111-1307, USA.
24 include $(top_srcdir)/fragment.am
26 # Need this library to both be part of libstdc++.a, and installed
27 # separately too.
28 # 1) separate libsupc++.la
29 toolexeclib_LTLIBRARIES = libsupc++.la
30 # 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a
31 noinst_LTLIBRARIES = libsupc++convenience.la
34 headers = \
35         exception new typeinfo cxxabi.h exception_defines.h
37 if GLIBCXX_HOSTED
38   c_sources = \
39         cp-demangle.c 
40 endif
42 sources = \
43         del_op.cc \
44         del_opnt.cc \
45         del_opv.cc \
46         del_opvnt.cc \
47         eh_alloc.cc \
48         eh_arm.cc \
49         eh_aux_runtime.cc \
50         eh_call.cc \
51         eh_catch.cc \
52         eh_exception.cc \
53         eh_globals.cc \
54         eh_personality.cc \
55         eh_term_handler.cc \
56         eh_terminate.cc \
57         eh_throw.cc \
58         eh_type.cc \
59         eh_unex_handler.cc \
60         guard.cc \
61         new_handler.cc \
62         new_op.cc \
63         new_opnt.cc \
64         new_opv.cc \
65         new_opvnt.cc \
66         pure.cc \
67         tinfo.cc \
68         tinfo2.cc \
69         vec.cc \
70         vterminate.cc
72 libsupc___la_SOURCES = $(sources) $(c_sources)
73 libsupc__convenience_la_SOURCES = $(sources) $(c_sources)
75 glibcxxinstalldir = $(gxx_include_dir)
76 glibcxxinstall_HEADERS = $(headers)
78 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
79 # modified in a per-library or per-sub-library way.  Need to manually
80 # set this option because CONFIG_CXXFLAGS has to be after
81 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
82 # as the occasion call for it.
83 AM_CXXFLAGS = \
84         -fno-implicit-templates \
85         $(LIBSUPCXX_PICFLAGS) \
86         $(WARN_CXXFLAGS) \
87         $(OPTIMIZE_CXXFLAGS) \
88         $(CONFIG_CXXFLAGS)
90 AM_MAKEFLAGS = \
91         "gxx_include_dir=$(gxx_include_dir)"
94 # Use special rules for pulling things out of libiberty.  These
95 # objects should be compiled with the "C" compiler, not the C++
96 # compiler, and also should not use the C++ includes.
97 C_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
98 C_COMPILE = \
99         $(CC) $(DEFS) $(C_INCLUDES) \
100         $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
102 # LTCOMPILE is copied from LTCXXCOMPILE below.
103 LTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared --mode=compile $(CC) \
104             $(DEFS) $(C_INCLUDES) $(LIBSUPCXX_PICFLAGS) \
105             $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
107 cp-demangle.c:
108         rm -f $@
109         $(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@
110 cp-demangle.lo: cp-demangle.c
111         $(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
112 cp-demangle.o: cp-demangle.c
113         $(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
116 # libstdc++ libtool notes
118 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
119 # last. (That way, things like -O2 passed down from the toplevel can
120 # be overridden by --enable-debug.)
122 # 2) In general, libtool expects an argument such as `--tag=CXX' when
123 # using the C++ compiler, because that will enable the settings
124 # detected when C++ support was being configured.  However, when no
125 # such flag is given in the command line, libtool attempts to figure
126 # it out by matching the compiler name in each configuration section
127 # against a prefix of the command line.  The problem is that, if the
128 # compiler name and its initial flags stored in the libtool
129 # configuration file don't match those in the command line, libtool
130 # can't decide which configuration to use, and it gives up.  The
131 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
132 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
133 # attempt to infer which configuration to use.
135 # We have to put --tag disable-shared after --tag CXX lest things
136 # CXX undo the affect of disable-shared.
137 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
138                --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
139                $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
141 # 3) We'd have a problem when building the shared libstdc++ object if
142 # the rules automake generates would be used.  We cannot allow g++ to
143 # be used since this would add -lstdc++ to the link line which of
144 # course is problematic at this point.  So, we get the top-level
145 # directory to configure libstdc++-v3 to use gcc as the C++
146 # compilation driver.
147 CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
148           --mode=link $(CXX) \
149           $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
151 # We have to have rules modified from the default to counteract SUN make
152 # prepending each of $(glibcxxinstall_HEADERS) with VPATH below.
153 install-glibcxxinstallHEADERS: $(glibcxxinstall_HEADERS)
154         @$(NORMAL_INSTALL)
155         $(mkinstalldirs) $(DESTDIR)$(glibcxxinstalldir)
156         @list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
157           q=`echo $$p | sed -e 's,.*/,,'`; \
158           if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
159           echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q"; \
160           $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q; \
161         done
163 uninstall-glibcxxinstallHEADERS:
164         @$(NORMAL_UNINSTALL)
165         list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
166           q=`echo $$p | sed -e 's,.*/,,'`; \
167           rm -f $(DESTDIR)$(glibcxxinstalldir)/$$q; \
168         done