]>
Commit | Line | Data |
---|---|---|
c00996a3 | 1 | # Top level -*- makefile -*- fragment for GNU C++. |
17211ab5 | 2 | # Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 |
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. |
b21d216c AF |
40 | CXX_INSTALL_NAME = `echo c++|sed '$(program_transform_name)'` |
41 | GXX_INSTALL_NAME = `echo g++|sed '$(program_transform_name)'` | |
43aba518 NN |
42 | CXX_TARGET_INSTALL_NAME = $(target_noncanonical)-`echo c++|sed '$(program_transform_name)'` |
43 | GXX_TARGET_INSTALL_NAME = $(target_noncanonical)-`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 | |
a723baf1 | 61 | po-generated: |
b077493b | 62 | |
a5943075 | 63 | # Create the compiler driver for g++. |
08dc830e | 64 | GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o |
ab87f8c8 JL |
65 | g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) |
66 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ | |
67 | $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) | |
a5943075 DE |
68 | |
69 | # Create a version of the g++ driver which calls the cross-compiler. | |
d2e5ee5c MS |
70 | g++-cross$(exeext): g++$(exeext) |
71 | -rm -f g++-cross$(exeext) | |
72 | cp g++$(exeext) g++-cross$(exeext) | |
a5943075 | 73 | |
b8dad04b ZW |
74 | # The compiler itself. |
75 | # Shared with C front end: | |
bb9f8221 | 76 | CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ |
5793b276 | 77 | c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \ |
d7b42618 | 78 | c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o |
b8dad04b ZW |
79 | |
80 | # Language-specific object files. | |
749ced52 | 81 | CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ |
a723baf1 MM |
82 | cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \ |
83 | cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ | |
e1a4dd13 GDR |
84 | cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \ |
85 | cp/mangle.o cp/cp-lang.o cp/name-lookup.o cp/cxx-pretty-print.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) \ | |
056487e7 | 91 | libcpp.a $(LIBDEPS) |
b8dad04b | 92 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ |
056487e7 | 93 | $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(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: |
03787dfd | 111 | c++.srcextra: |
a5943075 | 112 | |
b87141b3 | 113 | c++.tags: force |
7d60db05 JM |
114 | cd $(srcdir)/cp; etags -o TAGS.sub *.c *.h --language=none \ |
115 | --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' cp-tree.def; \ | |
116 | etags --include TAGS.sub --include ../TAGS.sub | |
b87141b3 | 117 | |
58416236 | 118 | generated-manpages:: $(docobjdir)/g++.1 |
23de1fbf | 119 | |
49a41726 JM |
120 | check-c++ : check-g++ |
121 | lang_checks += check-g++ | |
122 | ||
6633d636 | 123 | #\f |
a5943075 DE |
124 | # Install hooks: |
125 | # cc1plus is installed elsewhere as part of $(COMPILERS). | |
126 | ||
127 | # Nothing to do here. | |
128 | c++.install-normal: | |
129 | ||
130 | # Install the driver program as $(target)-g++ | |
131 | # and also as either g++ (if native) or $(tooldir)/bin/g++. | |
e658449e | 132 | c++.install-common: installdirs |
439020ec KC |
133 | -rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) |
134 | -$(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) | |
135 | -chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) | |
136 | -rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext) | |
137 | -( cd $(DESTDIR)$(bindir) && \ | |
138 | $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ) | |
be81d4d7 DR |
139 | -if [ -f cc1plus$(exeext) ] ; then \ |
140 | if [ -f g++-cross$(exeext) ] ; then \ | |
2c6ce97e CC |
141 | if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ |
142 | rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \ | |
143 | $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \ | |
144 | rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \ | |
145 | ( cd $(DESTDIR)$(gcc_tooldir)/bin && \ | |
146 | $(LN) g++$(exeext) c++$(exeext) ); \ | |
2d2586a4 | 147 | else true; fi; \ |
a5943075 | 148 | else \ |
2c6ce97e CC |
149 | rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \ |
150 | ( cd $(DESTDIR)$(bindir) && \ | |
151 | $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \ | |
152 | rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \ | |
153 | ( cd $(DESTDIR)$(bindir) && \ | |
154 | $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \ | |
a5943075 DE |
155 | fi ; \ |
156 | fi | |
157 | ||
c90501d0 NN |
158 | # We can't use links because not everyone supports them, and we can't use |
159 | # .so because Irix 6.5 doesn't support them. So just copy the manpage. | |
160 | $(docobjdir)/g++.1: $(docobjdir)/gcc.1 | |
161 | cp $(docobjdir)/gcc.1 $(docobjdir)/g++.1 | |
2bfe542b | 162 | |
58416236 | 163 | c++.install-man: installdirs $(docobjdir)/g++.1 |
be81d4d7 | 164 | -if [ -f cc1plus$(exeext) ] ; then \ |
439020ec | 165 | rm -f $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ |
58416236 | 166 | $(INSTALL_DATA) $(docobjdir)/g++.1 $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ |
439020ec | 167 | chmod a-x $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ |
a5943075 DE |
168 | else true; fi |
169 | ||
170 | c++.uninstall: | |
2c6ce97e | 171 | -rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext) |
2c6ce97e | 172 | -rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) |
2c6ce97e | 173 | -rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext) |
6633d636 | 174 | #\f |
a5943075 DE |
175 | # Clean hooks: |
176 | # A lot of the ancillary files are deleted by the main makefile. | |
177 | # We just have to delete files specific to us. | |
178 | ||
179 | c++.mostlyclean: | |
58416236 | 180 | -rm -f $(docobjdir)/g++.1 |
f989ed67 | 181 | -rm -f cp/*$(objext) |
22aa533e | 182 | -rm -f cp/*$(coverageexts) |
a5943075 DE |
183 | c++.clean: |
184 | c++.distclean: | |
185 | -rm -f cp/config.status cp/Makefile | |
f1908d70 | 186 | c++.maintainer-clean: |
6633d636 | 187 | #\f |
a5943075 DE |
188 | # Stage hooks: |
189 | # The main makefile has already created stage?/cp. | |
190 | ||
faf5394a | 191 | c++.stage1: stage1-start |
251580ee | 192 | -mv cp/*$(objext) stage1/cp |
faf5394a | 193 | c++.stage2: stage2-start |
251580ee | 194 | -mv cp/*$(objext) stage2/cp |
faf5394a | 195 | c++.stage3: stage3-start |
251580ee | 196 | -mv cp/*$(objext) stage3/cp |
faf5394a | 197 | c++.stage4: stage4-start |
251580ee | 198 | -mv cp/*$(objext) stage4/cp |
8f231b5d JH |
199 | c++.stageprofile: stageprofile-start |
200 | -mv cp/*$(objext) stageprofile/cp | |
201 | c++.stagefeedback: stagefeedback-start | |
202 | -mv cp/*$(objext) stagefeedback/cp | |
b8dad04b ZW |
203 | |
204 | #\f | |
205 | # .o: .h dependencies. | |
aed81407 GDR |
206 | CXX_TREE_H = $(TREE_H) cp/name-lookup.h cp/cp-tree.h c-common.h \ |
207 | cp/cp-tree.def c-common.def \ | |
4977bab6 | 208 | function.h varray.h $(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) \ |
17211ab5 | 209 | $(GGC_H) \ |
b8dad04b ZW |
210 | $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h |
211 | ||
e1a4dd13 GDR |
212 | CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H) |
213 | ||
a723baf1 | 214 | cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \ |
37fa72e9 | 215 | c-pragma.h toplev.h output.h input.h cp/operators.def $(TM_P_H) |
4977bab6 | 216 | cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \ |
e1a4dd13 | 217 | $(LANGHOOKS_DEF_H) c-common.h $(CXX_PRETTY_PRINT_H) $(DIAGNOSTIC_H) |
4977bab6 | 218 | cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \ |
17211ab5 | 219 | output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \ |
e2500fed | 220 | cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \ |
22ffcc6f | 221 | debug.h gt-cp-decl.h gtype-cp.h timevar.h |
4977bab6 | 222 | cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \ |
8cd2462c | 223 | output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h cgraph.h |
4977bab6 | 224 | cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h output.h $(TM_P_H) \ |
2a2b2d43 | 225 | diagnostic.h |
4977bab6 | 226 | cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ |
7b6d72fc MM |
227 | diagnostic.h convert.h |
228 | cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(TARGET_H) convert.h | |
4977bab6 | 229 | cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \ |
7d149679 | 230 | diagnostic.h intl.h gt-cp-call.h convert.h target.h |
4977bab6 ZW |
231 | cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) toplev.h $(EXPR_H) |
232 | cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ | |
17211ab5 GK |
233 | except.h |
234 | cp/method.o: cp/method.c $(CXX_TREE_H) $(TM_H) toplev.h $(RTL_H) $(EXPR_H) \ | |
89ce1c8f | 235 | $(TM_P_H) $(TARGET_H) gt-cp-method.h |
4977bab6 ZW |
236 | cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h flags.h toplev.h convert.h |
237 | cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) stack.h flags.h toplev.h $(RTL_H) | |
17211ab5 | 238 | cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \ |
8a3c9180 | 239 | insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h $(TARGET_H) |
4977bab6 | 240 | cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H) |
7b6d72fc | 241 | cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h convert.h |
4977bab6 | 242 | cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) except.h toplev.h \ |
6f30f1f1 | 243 | cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h |
4977bab6 | 244 | cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ |
11642c3a | 245 | except.h $(TM_P_H) |
a723baf1 | 246 | cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \ |
17211ab5 | 247 | toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h |
b6fe0bb8 | 248 | cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \ |
e1a4dd13 | 249 | flags.h real.h $(LANGHOOKS_DEF_H) $(CXX_PRETTY_PRINT_H) |
17211ab5 | 250 | cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \ |
e2500fed | 251 | gt-cp-repo.h |
4977bab6 | 252 | cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \ |
17211ab5 | 253 | flags.h debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \ |
8cd2462c | 254 | tree-inline.h cgraph.h |
4977bab6 ZW |
255 | cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) tree-dump.h |
256 | cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h integrate.h insn-config.h \ | |
25af8512 | 257 | input.h $(PARAMS_H) debug.h tree-inline.h |
24386c5e | 258 | cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h real.h gt-cp-mangle.h $(TM_P_H) |
b8dad04b | 259 | |
a723baf1 | 260 | cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h output.h |
aed81407 | 261 | |
7c71dc2b | 262 | cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ |
00e8de68 | 263 | $(TM_H) $(CXX_TREE_H) timevar.h gt-cp-name-lookup.h toplev.h \ |
a5e6b29b | 264 | $(DIAGNOSTIC_H) flags.h |
e1a4dd13 GDR |
265 | |
266 | cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \ | |
267 | $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H) |