]>
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, | |
26 | # foo.info, foo.dvi, | |
27 | # foo.install-normal, foo.install-common, foo.install-info, foo.install-man, | |
436a88a6 | 28 | # foo.uninstall, |
f1908d70 RK |
29 | # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean, |
30 | # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 | |
a5943075 DE |
31 | # |
32 | # where `foo' is the name of the language. | |
33 | # | |
34 | # It should also provide rules for: | |
35 | # | |
36 | # - making any compiler driver (eg: g++) | |
37 | # - the compiler proper (eg: cc1plus) | |
38 | # - define the names for selecting the language in LANGUAGES. | |
a5943075 | 39 | |
a0a33927 | 40 | # Actual names to use when installing a native compiler. |
b21d216c AF |
41 | CXX_INSTALL_NAME = `echo c++|sed '$(program_transform_name)'` |
42 | GXX_INSTALL_NAME = `echo g++|sed '$(program_transform_name)'` | |
b21d216c AF |
43 | CXX_TARGET_INSTALL_NAME = $(target_alias)-`echo c++|sed '$(program_transform_name)'` |
44 | GXX_TARGET_INSTALL_NAME = $(target_alias)-`echo g++|sed '$(program_transform_name)'` | |
a0a33927 MS |
45 | |
46 | # Actual names to use when installing a cross-compiler. | |
b21d216c AF |
47 | CXX_CROSS_NAME = `echo c++|sed '$(program_transform_cross_name)'` |
48 | GXX_CROSS_NAME = `echo g++|sed '$(program_transform_cross_name)'` | |
5156628f | 49 | |
6633d636 | 50 | #\f |
a5943075 DE |
51 | # Define the names for selecting c++ in LANGUAGES. |
52 | # Note that it would be nice to move the dependency on g++ | |
53 | # into the C++ rule, but that needs a little bit of work | |
54 | # to do the right thing within all.cross. | |
a73cab0f | 55 | C++ c++: cc1plus$(exeext) |
a5943075 | 56 | |
5edb8b93 MS |
57 | # Tell GNU make to ignore these if they exist. |
58 | .PHONY: C++ c++ | |
59 | ||
4977bab6 | 60 | g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) $(CONFIG_H) |
8c310e3f MM |
61 | (SHLIB_LINK='$(SHLIB_LINK)' \ |
62 | SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \ | |
049f6ec9 | 63 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ |
8c310e3f | 64 | $(INCLUDES) $(srcdir)/cp/g++spec.c) |
d2e5ee5c | 65 | |
a723baf1 | 66 | po-generated: |
b077493b | 67 | |
a5943075 | 68 | # Create the compiler driver for g++. |
08dc830e | 69 | GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o |
ab87f8c8 JL |
70 | g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) |
71 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ | |
72 | $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) | |
a5943075 DE |
73 | |
74 | # Create a version of the g++ driver which calls the cross-compiler. | |
d2e5ee5c MS |
75 | g++-cross$(exeext): g++$(exeext) |
76 | -rm -f g++-cross$(exeext) | |
77 | cp g++$(exeext) g++-cross$(exeext) | |
a5943075 | 78 | |
b8dad04b ZW |
79 | # The compiler itself. |
80 | # Shared with C front end: | |
bb9f8221 | 81 | CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ |
5793b276 | 82 | c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \ |
c1bad961 | 83 | c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o |
b8dad04b ZW |
84 | |
85 | # Language-specific object files. | |
749ced52 | 86 | CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ |
a723baf1 MM |
87 | cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \ |
88 | cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ | |
9780c24f | 89 | cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \ |
aed81407 | 90 | cp/optimize.o cp/mangle.o cp/cp-lang.o cp/name-lookup.o |
b8dad04b | 91 | |
d893ff33 KG |
92 | # Use strict warnings for this front end. |
93 | cp-warn = $(STRICT_WARN) $(WERROR) | |
b8dad04b ZW |
94 | |
95 | cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \ | |
056487e7 | 96 | libcpp.a $(LIBDEPS) |
b8dad04b | 97 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ |
056487e7 | 98 | $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS) |
b8dad04b ZW |
99 | |
100 | # Special build rules. | |
101 | $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf | |
102 | gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \ | |
103 | $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h | |
104 | ||
e2500fed | 105 | gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true |
afd9b9dd | 106 | gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h : s-gtype; @true |
0de298af | 107 | gt-cp-tree.h gt-cp-mangle.h gt-cp-name-lookup.h: s-gtype; @true |
e2500fed | 108 | |
6633d636 | 109 | #\f |
a5943075 DE |
110 | # Build hooks: |
111 | ||
da372c07 | 112 | c++.all.build: g++$(exeext) |
f989ed67 | 113 | c++.all.cross: g++-cross$(exeext) |
824b9a4c | 114 | c++.start.encap: g++$(exeext) |
f989ed67 | 115 | c++.rest.encap: |
a5943075 | 116 | |
b87141b3 TT |
117 | c++.tags: force |
118 | cd $(srcdir)/cp; etags *.c *.h | |
119 | ||
c3aac512 | 120 | c++.info: |
a5943075 | 121 | c++.dvi: |
2bfe542b | 122 | c++.generated-manpages: cp/g++.1 |
23de1fbf | 123 | |
6633d636 | 124 | #\f |
a5943075 DE |
125 | # Install hooks: |
126 | # cc1plus is installed elsewhere as part of $(COMPILERS). | |
127 | ||
128 | # Nothing to do here. | |
129 | c++.install-normal: | |
130 | ||
131 | # Install the driver program as $(target)-g++ | |
132 | # and also as either g++ (if native) or $(tooldir)/bin/g++. | |
e658449e | 133 | c++.install-common: installdirs |
be81d4d7 DR |
134 | -if [ -f cc1plus$(exeext) ] ; then \ |
135 | if [ -f g++-cross$(exeext) ] ; then \ | |
2c6ce97e CC |
136 | rm -f $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \ |
137 | $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \ | |
138 | chmod a+x $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \ | |
139 | rm -f $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext); \ | |
140 | ( cd $(DESTDIR)$(bindir) && \ | |
141 | $(LN) $(GXX_CROSS_NAME)$(exeext) $(CXX_CROSS_NAME)$(exeext) ); \ | |
142 | if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ | |
143 | rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \ | |
144 | $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \ | |
145 | rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \ | |
146 | ( cd $(DESTDIR)$(gcc_tooldir)/bin && \ | |
147 | $(LN) g++$(exeext) c++$(exeext) ); \ | |
2d2586a4 | 148 | else true; fi; \ |
a5943075 | 149 | else \ |
2c6ce97e CC |
150 | rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ |
151 | $(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ | |
152 | chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ | |
153 | rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ | |
154 | ( cd $(DESTDIR)$(bindir) && \ | |
155 | $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ); \ | |
156 | rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \ | |
157 | ( cd $(DESTDIR)$(bindir) && \ | |
158 | $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \ | |
159 | rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \ | |
160 | ( cd $(DESTDIR)$(bindir) && \ | |
161 | $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \ | |
a5943075 DE |
162 | fi ; \ |
163 | fi | |
164 | ||
c3aac512 | 165 | c++.install-info: |
a5943075 | 166 | |
2bfe542b AO |
167 | cp/g++.1: |
168 | -rm -f $@ | |
169 | if [ "$(ALL)" = all.cross ]; then \ | |
170 | echo ".so man1/$(GCC_CROSS_NAME).1" > $@ ; \ | |
171 | else \ | |
172 | echo ".so man1/$(GCC_INSTALL_NAME).1" > $@ ; \ | |
173 | fi | |
174 | ||
175 | c++.install-man: installdirs cp/g++.1 | |
be81d4d7 | 176 | -if [ -f cc1plus$(exeext) ] ; then \ |
251580ee | 177 | if [ -f g++-cross$(exeext) ] ; then \ |
2c6ce97e | 178 | rm -f $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \ |
2bfe542b | 179 | $(INSTALL_DATA) cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \ |
2c6ce97e | 180 | chmod a-x $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \ |
04dbaf1f | 181 | else \ |
2c6ce97e | 182 | rm -f $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ |
2bfe542b | 183 | $(INSTALL_DATA) cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ |
2c6ce97e | 184 | chmod a-x $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ |
04dbaf1f | 185 | fi; \ |
a5943075 DE |
186 | else true; fi |
187 | ||
188 | c++.uninstall: | |
2c6ce97e CC |
189 | -rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext) |
190 | -rm -rf $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext) | |
191 | -rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) | |
192 | -rm -rf $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext) | |
193 | -rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext) | |
194 | -rm -rf $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext) | |
6633d636 | 195 | #\f |
a5943075 DE |
196 | # Clean hooks: |
197 | # A lot of the ancillary files are deleted by the main makefile. | |
198 | # We just have to delete files specific to us. | |
199 | ||
200 | c++.mostlyclean: | |
2bfe542b | 201 | -rm -f cp/g++.1 |
f989ed67 | 202 | -rm -f cp/*$(objext) |
22aa533e | 203 | -rm -f cp/*$(coverageexts) |
a5943075 DE |
204 | c++.clean: |
205 | c++.distclean: | |
206 | -rm -f cp/config.status cp/Makefile | |
a5943075 | 207 | c++.extraclean: |
f1908d70 | 208 | c++.maintainer-clean: |
6633d636 | 209 | #\f |
a5943075 DE |
210 | # Stage hooks: |
211 | # The main makefile has already created stage?/cp. | |
212 | ||
faf5394a | 213 | c++.stage1: stage1-start |
251580ee | 214 | -mv cp/*$(objext) stage1/cp |
faf5394a | 215 | c++.stage2: stage2-start |
251580ee | 216 | -mv cp/*$(objext) stage2/cp |
faf5394a | 217 | c++.stage3: stage3-start |
251580ee | 218 | -mv cp/*$(objext) stage3/cp |
faf5394a | 219 | c++.stage4: stage4-start |
251580ee | 220 | -mv cp/*$(objext) stage4/cp |
b8dad04b ZW |
221 | |
222 | #\f | |
223 | # .o: .h dependencies. | |
aed81407 GDR |
224 | CXX_TREE_H = $(TREE_H) cp/name-lookup.h cp/cp-tree.h c-common.h \ |
225 | cp/cp-tree.def c-common.def \ | |
4977bab6 | 226 | function.h varray.h $(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) \ |
17211ab5 | 227 | $(GGC_H) \ |
b8dad04b ZW |
228 | $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h |
229 | ||
a723baf1 | 230 | cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \ |
6338b358 | 231 | c-pragma.h toplev.h output.h input.h diagnostic.h \ |
d0067571 | 232 | cp/operators.def $(TM_P_H) |
4977bab6 ZW |
233 | cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \ |
234 | $(LANGHOOKS_DEF_H) c-common.h | |
235 | cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \ | |
17211ab5 | 236 | output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \ |
e2500fed | 237 | cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \ |
22ffcc6f | 238 | debug.h gt-cp-decl.h gtype-cp.h timevar.h |
4977bab6 | 239 | cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \ |
17211ab5 | 240 | output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h |
4977bab6 | 241 | cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h output.h $(TM_P_H) \ |
2a2b2d43 | 242 | diagnostic.h |
4977bab6 | 243 | cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ |
2a2b2d43 | 244 | diagnostic.h |
4977bab6 ZW |
245 | cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(TARGET_H) |
246 | cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \ | |
a9c89a57 | 247 | diagnostic.h intl.h gt-cp-call.h |
4977bab6 ZW |
248 | cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) toplev.h $(EXPR_H) |
249 | cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ | |
17211ab5 GK |
250 | except.h |
251 | cp/method.o: cp/method.c $(CXX_TREE_H) $(TM_H) toplev.h $(RTL_H) $(EXPR_H) \ | |
483ab821 | 252 | $(TM_P_H) $(TARGET_H) |
4977bab6 ZW |
253 | cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h flags.h toplev.h convert.h |
254 | cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) stack.h flags.h toplev.h $(RTL_H) | |
17211ab5 | 255 | cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \ |
8a3c9180 | 256 | insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h $(TARGET_H) |
4977bab6 ZW |
257 | cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H) |
258 | cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h | |
259 | cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) except.h toplev.h \ | |
6f30f1f1 | 260 | cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h |
4977bab6 | 261 | cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ |
11642c3a | 262 | except.h $(TM_P_H) |
a723baf1 | 263 | cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \ |
17211ab5 | 264 | toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h |
4977bab6 | 265 | cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h flags.h real.h \ |
e5f3b786 | 266 | $(LANGHOOKS_DEF_H) |
17211ab5 | 267 | cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \ |
e2500fed | 268 | gt-cp-repo.h |
4977bab6 | 269 | cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \ |
17211ab5 | 270 | flags.h debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \ |
25af8512 | 271 | tree-inline.h |
4977bab6 ZW |
272 | cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) tree-dump.h |
273 | cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h integrate.h insn-config.h \ | |
25af8512 | 274 | input.h $(PARAMS_H) debug.h tree-inline.h |
0de298af | 275 | cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h real.h gt-cp-mangle.h |
b8dad04b | 276 | |
a723baf1 | 277 | cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h output.h |
aed81407 | 278 | |
7c71dc2b | 279 | cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ |
28ea4c88 | 280 | $(TM_H) $(CXX_TREE_H) timevar.h gt-cp-name-lookup.h |