]>
Commit | Line | Data |
---|---|---|
c00996a3 | 1 | # Top level -*- makefile -*- fragment for GNU C++. |
521cc508 | 2 | # Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
ca888935 | 3 | # Free Software Foundation, Inc. |
a5943075 | 4 | |
b599b135 | 5 | #This file is part of GCC. |
a5943075 | 6 | |
b599b135 | 7 | #GCC is free software; you can redistribute it and/or modify |
a5943075 DE |
8 | #it under the terms of the GNU General Public License as published by |
9 | #the Free Software Foundation; either version 2, or (at your option) | |
10 | #any later version. | |
11 | ||
b599b135 | 12 | #GCC is distributed in the hope that it will be useful, |
a5943075 DE |
13 | #but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | #GNU General Public License for more details. | |
16 | ||
17 | #You should have received a copy of the GNU General Public License | |
b599b135 | 18 | #along with GCC; see the file COPYING. If not, write to |
de18aff3 RK |
19 | #the Free Software Foundation, 59 Temple Place - Suite 330, |
20 | #Boston, MA 02111-1307, USA. | |
a5943075 DE |
21 | |
22 | # This file provides the language dependent support in the main Makefile. | |
23 | # Each language makefile fragment must provide the following targets: | |
24 | # | |
25 | # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap, | |
97ae108d | 26 | # foo.install-normal, foo.install-common, foo.install-man, |
436a88a6 | 27 | # foo.uninstall, |
a03ad584 | 28 | # foo.mostlyclean, foo.clean, foo.distclean, |
f1908d70 | 29 | # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 |
a5943075 DE |
30 | # |
31 | # where `foo' is the name of the language. | |
32 | # | |
33 | # It should also provide rules for: | |
34 | # | |
35 | # - making any compiler driver (eg: g++) | |
36 | # - the compiler proper (eg: cc1plus) | |
37 | # - define the names for selecting the language in LANGUAGES. | |
a5943075 | 38 | |
a0a33927 | 39 | # Actual names to use when installing a native compiler. |
e165d61b KC |
40 | CXX_INSTALL_NAME := $(shell echo c++|sed '$(program_transform_name)') |
41 | GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)') | |
42 | CXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo c++|sed '$(program_transform_name)') | |
43 | GXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo g++|sed '$(program_transform_name)') | |
a0a33927 | 44 | |
6633d636 | 45 | #\f |
a5943075 DE |
46 | # Define the names for selecting c++ in LANGUAGES. |
47 | # Note that it would be nice to move the dependency on g++ | |
48 | # into the C++ rule, but that needs a little bit of work | |
49 | # to do the right thing within all.cross. | |
a73cab0f | 50 | C++ c++: cc1plus$(exeext) |
a5943075 | 51 | |
5edb8b93 MS |
52 | # Tell GNU make to ignore these if they exist. |
53 | .PHONY: C++ c++ | |
54 | ||
4977bab6 | 55 | g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) $(CONFIG_H) |
8c310e3f MM |
56 | (SHLIB_LINK='$(SHLIB_LINK)' \ |
57 | SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \ | |
049f6ec9 | 58 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ |
8c310e3f | 59 | $(INCLUDES) $(srcdir)/cp/g++spec.c) |
d2e5ee5c | 60 | |
a5943075 | 61 | # Create the compiler driver for g++. |
08dc830e | 62 | GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o |
ab87f8c8 JL |
63 | g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) |
64 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ | |
65 | $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) | |
a5943075 DE |
66 | |
67 | # Create a version of the g++ driver which calls the cross-compiler. | |
d2e5ee5c MS |
68 | g++-cross$(exeext): g++$(exeext) |
69 | -rm -f g++-cross$(exeext) | |
70 | cp g++$(exeext) g++-cross$(exeext) | |
a5943075 | 71 | |
b8dad04b ZW |
72 | # The compiler itself. |
73 | # Shared with C front end: | |
bb9f8221 | 74 | CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ |
5793b276 | 75 | c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \ |
6de9cd9a | 76 | c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \ |
eadf906f | 77 | c-gimplify.o tree-inline.o |
b8dad04b ZW |
78 | |
79 | # Language-specific object files. | |
749ced52 | 80 | CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ |
a723baf1 MM |
81 | cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \ |
82 | cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ | |
e1a4dd13 | 83 | cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \ |
6de9cd9a | 84 | cp/mangle.o cp/cp-lang.o cp/name-lookup.o cp/cxx-pretty-print.o \ |
eadf906f | 85 | cp/cp-gimplify.o tree-mudflap.o cp/cp-mudflap.o |
b8dad04b | 86 | |
d893ff33 KG |
87 | # Use strict warnings for this front end. |
88 | cp-warn = $(STRICT_WARN) $(WERROR) | |
b8dad04b ZW |
89 | |
90 | cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \ | |
4f4e53dd | 91 | $(LIBDEPS) |
b8dad04b | 92 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ |
4f4e53dd | 93 | $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) $(LIBS) |
b8dad04b ZW |
94 | |
95 | # Special build rules. | |
96 | $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf | |
5671bf27 | 97 | gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \ |
b8dad04b ZW |
98 | $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h |
99 | ||
e2500fed | 100 | gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true |
89ce1c8f | 101 | gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h gt-cp-method.h : s-gtype; @true |
0de298af | 102 | gt-cp-tree.h gt-cp-mangle.h gt-cp-name-lookup.h: s-gtype; @true |
e2500fed | 103 | |
6633d636 | 104 | #\f |
a5943075 DE |
105 | # Build hooks: |
106 | ||
da372c07 | 107 | c++.all.build: g++$(exeext) |
f989ed67 | 108 | c++.all.cross: g++-cross$(exeext) |
824b9a4c | 109 | c++.start.encap: g++$(exeext) |
f989ed67 | 110 | c++.rest.encap: |
a541f69d KC |
111 | c++.info: |
112 | c++.srcinfo: | |
03787dfd | 113 | c++.srcextra: |
a5943075 | 114 | |
b87141b3 | 115 | c++.tags: force |
7d60db05 JM |
116 | cd $(srcdir)/cp; etags -o TAGS.sub *.c *.h --language=none \ |
117 | --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' cp-tree.def; \ | |
118 | etags --include TAGS.sub --include ../TAGS.sub | |
b87141b3 | 119 | |
a541f69d KC |
120 | c++.man: doc/g++.1 |
121 | ||
122 | c++.srcman: doc/g++.1 | |
123 | -cp -p $^ $(srcdir)/doc | |
23de1fbf | 124 | |
49a41726 JM |
125 | check-c++ : check-g++ |
126 | lang_checks += check-g++ | |
127 | ||
6633d636 | 128 | #\f |
a5943075 DE |
129 | # Install hooks: |
130 | # cc1plus is installed elsewhere as part of $(COMPILERS). | |
131 | ||
132 | # Nothing to do here. | |
133 | c++.install-normal: | |
134 | ||
135 | # Install the driver program as $(target)-g++ | |
136 | # and also as either g++ (if native) or $(tooldir)/bin/g++. | |
e658449e | 137 | c++.install-common: installdirs |
439020ec KC |
138 | -rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) |
139 | -$(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) | |
140 | -chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) | |
141 | -rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext) | |
142 | -( cd $(DESTDIR)$(bindir) && \ | |
143 | $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ) | |
be81d4d7 DR |
144 | -if [ -f cc1plus$(exeext) ] ; then \ |
145 | if [ -f g++-cross$(exeext) ] ; then \ | |
2c6ce97e CC |
146 | if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ |
147 | rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \ | |
148 | $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \ | |
149 | rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \ | |
150 | ( cd $(DESTDIR)$(gcc_tooldir)/bin && \ | |
151 | $(LN) g++$(exeext) c++$(exeext) ); \ | |
2d2586a4 | 152 | else true; fi; \ |
a5943075 | 153 | else \ |
2c6ce97e CC |
154 | rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \ |
155 | ( cd $(DESTDIR)$(bindir) && \ | |
156 | $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \ | |
157 | rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \ | |
158 | ( cd $(DESTDIR)$(bindir) && \ | |
159 | $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \ | |
a5943075 DE |
160 | fi ; \ |
161 | fi | |
162 | ||
c90501d0 NN |
163 | # We can't use links because not everyone supports them, and we can't use |
164 | # .so because Irix 6.5 doesn't support them. So just copy the manpage. | |
a541f69d KC |
165 | doc/g++.1: doc/gcc.1 |
166 | cp doc/gcc.1 doc/g++.1 | |
2bfe542b | 167 | |
a541f69d KC |
168 | c++.install-man: installdirs $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext) |
169 | ||
170 | $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext): doc/g++.1 | |
171 | -rm -f $@ | |
172 | -$(INSTALL_DATA) $< $@ | |
173 | -chmod a-x $@ | |
a5943075 DE |
174 | |
175 | c++.uninstall: | |
2c6ce97e | 176 | -rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext) |
2c6ce97e | 177 | -rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) |
2c6ce97e | 178 | -rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext) |
6633d636 | 179 | #\f |
a5943075 DE |
180 | # Clean hooks: |
181 | # A lot of the ancillary files are deleted by the main makefile. | |
182 | # We just have to delete files specific to us. | |
183 | ||
184 | c++.mostlyclean: | |
a541f69d | 185 | -rm -f doc/g++.1 |
f989ed67 | 186 | -rm -f cp/*$(objext) |
22aa533e | 187 | -rm -f cp/*$(coverageexts) |
a5943075 DE |
188 | c++.clean: |
189 | c++.distclean: | |
190 | -rm -f cp/config.status cp/Makefile | |
f1908d70 | 191 | c++.maintainer-clean: |
6633d636 | 192 | #\f |
a5943075 DE |
193 | # Stage hooks: |
194 | # The main makefile has already created stage?/cp. | |
195 | ||
faf5394a | 196 | c++.stage1: stage1-start |
251580ee | 197 | -mv cp/*$(objext) stage1/cp |
faf5394a | 198 | c++.stage2: stage2-start |
251580ee | 199 | -mv cp/*$(objext) stage2/cp |
faf5394a | 200 | c++.stage3: stage3-start |
251580ee | 201 | -mv cp/*$(objext) stage3/cp |
faf5394a | 202 | c++.stage4: stage4-start |
251580ee | 203 | -mv cp/*$(objext) stage4/cp |
8f231b5d JH |
204 | c++.stageprofile: stageprofile-start |
205 | -mv cp/*$(objext) stageprofile/cp | |
206 | c++.stagefeedback: stagefeedback-start | |
207 | -mv cp/*$(objext) stagefeedback/cp | |
b8dad04b ZW |
208 | |
209 | #\f | |
210 | # .o: .h dependencies. | |
aed81407 GDR |
211 | CXX_TREE_H = $(TREE_H) cp/name-lookup.h cp/cp-tree.h c-common.h \ |
212 | cp/cp-tree.def c-common.def \ | |
4977bab6 | 213 | function.h varray.h $(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) \ |
17211ab5 | 214 | $(GGC_H) \ |
b8dad04b ZW |
215 | $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h |
216 | ||
e1a4dd13 GDR |
217 | CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H) |
218 | ||
a723baf1 | 219 | cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \ |
37fa72e9 | 220 | c-pragma.h toplev.h output.h input.h cp/operators.def $(TM_P_H) |
4977bab6 | 221 | cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \ |
e1a4dd13 | 222 | $(LANGHOOKS_DEF_H) c-common.h $(CXX_PRETTY_PRINT_H) $(DIAGNOSTIC_H) |
4977bab6 | 223 | cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \ |
17211ab5 | 224 | output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \ |
e2500fed | 225 | cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \ |
6de9cd9a | 226 | debug.h gt-cp-decl.h gtype-cp.h timevar.h $(TREE_FLOW_H) |
4977bab6 | 227 | cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \ |
8cd2462c | 228 | output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h cgraph.h |
4977bab6 | 229 | cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h output.h $(TM_P_H) \ |
2a2b2d43 | 230 | diagnostic.h |
4977bab6 | 231 | cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ |
7b6d72fc MM |
232 | diagnostic.h convert.h |
233 | cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(TARGET_H) convert.h | |
4977bab6 | 234 | cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \ |
7d149679 | 235 | diagnostic.h intl.h gt-cp-call.h convert.h target.h |
4977bab6 ZW |
236 | cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) toplev.h $(EXPR_H) |
237 | cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ | |
17211ab5 GK |
238 | except.h |
239 | cp/method.o: cp/method.c $(CXX_TREE_H) $(TM_H) toplev.h $(RTL_H) $(EXPR_H) \ | |
89ce1c8f | 240 | $(TM_P_H) $(TARGET_H) gt-cp-method.h |
4977bab6 ZW |
241 | cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h flags.h toplev.h convert.h |
242 | cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) stack.h flags.h toplev.h $(RTL_H) | |
17211ab5 | 243 | cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \ |
8a3c9180 | 244 | insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h $(TARGET_H) |
4977bab6 | 245 | cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H) |
7b6d72fc | 246 | cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h convert.h |
4977bab6 | 247 | cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) except.h toplev.h \ |
6f30f1f1 | 248 | cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h |
4977bab6 | 249 | cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ |
11642c3a | 250 | except.h $(TM_P_H) |
a723baf1 | 251 | cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \ |
17211ab5 | 252 | toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h |
b6fe0bb8 | 253 | cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \ |
e1a4dd13 | 254 | flags.h real.h $(LANGHOOKS_DEF_H) $(CXX_PRETTY_PRINT_H) |
17211ab5 | 255 | cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \ |
e2500fed | 256 | gt-cp-repo.h |
4977bab6 | 257 | cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \ |
17211ab5 | 258 | flags.h debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \ |
8cd2462c | 259 | tree-inline.h cgraph.h |
4977bab6 ZW |
260 | cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) tree-dump.h |
261 | cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h integrate.h insn-config.h \ | |
eadf906f | 262 | input.h $(PARAMS_H) debug.h tree-inline.h tree-gimple.h |
f18eca82 ZL |
263 | cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h real.h gt-cp-mangle.h \ |
264 | $(TARGET_H) $(TM_P_H) | |
b8dad04b | 265 | |
6097b0c3 DP |
266 | cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h \ |
267 | output.h | |
eadf906f | 268 | cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) toplev.h c-common.h \ |
6de9cd9a DN |
269 | $(TM_H) coretypes.h |
270 | cp/cp-mudflap.o: cp/cp-mudflap.c $(CXX_TREE_H) toplev.h c-common.h \ | |
271 | $(TM_H) coretypes.h | |
aed81407 | 272 | |
7c71dc2b | 273 | cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ |
00e8de68 | 274 | $(TM_H) $(CXX_TREE_H) timevar.h gt-cp-name-lookup.h toplev.h \ |
6097b0c3 | 275 | $(DIAGNOSTIC_H) flags.h debug.h |
e1a4dd13 GDR |
276 | |
277 | cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \ | |
278 | $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H) |