1 | # Top level makefile fragment for GNU C++. |
---|
2 | # Copyright (C) 1994, 1995 Free Software Foundation, Inc. |
---|
3 | |
---|
4 | #This file is part of GNU CC. |
---|
5 | |
---|
6 | #GNU CC is free software; you can redistribute it and/or modify |
---|
7 | #it under the terms of the GNU General Public License as published by |
---|
8 | #the Free Software Foundation; either version 2, or (at your option) |
---|
9 | #any later version. |
---|
10 | |
---|
11 | #GNU CC is distributed in the hope that it will be useful, |
---|
12 | #but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | #GNU General Public License for more details. |
---|
15 | |
---|
16 | #You should have received a copy of the GNU General Public License |
---|
17 | #along with GNU CC; see the file COPYING. If not, write to |
---|
18 | #the Free Software Foundation, 59 Temple Place - Suite 330, |
---|
19 | #Boston, MA 02111-1307, USA. |
---|
20 | |
---|
21 | # This file provides the language dependent support in the main Makefile. |
---|
22 | # Each language makefile fragment must provide the following targets: |
---|
23 | # |
---|
24 | # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap, |
---|
25 | # foo.info, foo.dvi, |
---|
26 | # foo.install-normal, foo.install-common, foo.install-info, foo.install-man, |
---|
27 | # foo.uninstall, foo.distdir, |
---|
28 | # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean, |
---|
29 | # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 |
---|
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. |
---|
38 | |
---|
39 | # Extra flags to pass to recursive makes. |
---|
40 | CXX_FLAGS_TO_PASS = \ |
---|
41 | "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \ |
---|
42 | "CXXFLAGS=$(CXXFLAGS)" \ |
---|
43 | "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" |
---|
44 | |
---|
45 | # Actual names to use when installing a native compiler. |
---|
46 | CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t` |
---|
47 | GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t` |
---|
48 | |
---|
49 | # Actual names to use when installing a cross-compiler. |
---|
50 | CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t` |
---|
51 | GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t` |
---|
52 | |
---|
53 | # The name to use for the demangler program. |
---|
54 | DEMANGLER_PROG = c++filt |
---|
55 | |
---|
56 | # Define the names for selecting c++ in LANGUAGES. |
---|
57 | # Note that it would be nice to move the dependency on g++ |
---|
58 | # into the C++ rule, but that needs a little bit of work |
---|
59 | # to do the right thing within all.cross. |
---|
60 | C++ c++: cc1plus |
---|
61 | |
---|
62 | # Tell GNU make to ignore these if they exist. |
---|
63 | .PHONY: C++ c++ |
---|
64 | |
---|
65 | # Create the compiler driver for g++. |
---|
66 | g++: $(srcdir)/cp/g++.c $(CONFIG_H) $(LIBDEPS) |
---|
67 | $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o $@ $(srcdir)/cp/g++.c $(LIBS) |
---|
68 | |
---|
69 | # Create a version of the g++ driver which calls the cross-compiler. |
---|
70 | g++-cross: $(srcdir)/cp/g++.c version.o $(LIBDEPS) |
---|
71 | $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o $@ \ |
---|
72 | -DGCC_NAME=\"$(GCC_CROSS_NAME)\" $(srcdir)/cp/g++.c version.o $(LIBS) |
---|
73 | |
---|
74 | cxxmain.o: cplus-dem.c demangle.h |
---|
75 | rm -f cxxmain.c |
---|
76 | ln -s $(srcdir)/cplus-dem.c cxxmain.c > /dev/null 2>&1 \ |
---|
77 | || cp $(srcdir)/cplus-dem.c cxxmain.c |
---|
78 | $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ |
---|
79 | -DVERSION=\"$(version)\" cxxmain.c |
---|
80 | rm -f cxxmain.c |
---|
81 | |
---|
82 | $(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o $(LIBDEPS) |
---|
83 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(LIBS) -o $@ \ |
---|
84 | cxxmain.o underscore.o getopt.o getopt1.o |
---|
85 | |
---|
86 | CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \ |
---|
87 | $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \ |
---|
88 | $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \ |
---|
89 | $(srcdir)/cp/edsel.c $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \ |
---|
90 | $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \ |
---|
91 | $(srcdir)/cp/errfn.c $(srcdir)/cp/gc.c $(srcdir)/cp/method.c \ |
---|
92 | $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \ |
---|
93 | $(srcdir)/cp/error.c $(srcdir)/cp/init.c $(srcdir)/cp/parse.y \ |
---|
94 | $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c $(srcdir)/cp/repo.c |
---|
95 | |
---|
96 | cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o |
---|
97 | cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus |
---|
98 | |
---|
99 | # Build hooks: |
---|
100 | |
---|
101 | c++.all.build: g++ $(DEMANGLER_PROG) |
---|
102 | c++.all.cross: g++-cross $(DEMANGLER_PROG) |
---|
103 | c++.start.encap: g++ |
---|
104 | c++.rest.encap: $(DEMANGLER_PROG) |
---|
105 | |
---|
106 | c++.info: |
---|
107 | c++.dvi: |
---|
108 | |
---|
109 | # Install hooks: |
---|
110 | # cc1plus is installed elsewhere as part of $(COMPILERS). |
---|
111 | |
---|
112 | # Nothing to do here. |
---|
113 | c++.install-normal: |
---|
114 | |
---|
115 | # Install the driver program as $(target)-g++ |
---|
116 | # and also as either g++ (if native) or $(tooldir)/bin/g++. |
---|
117 | c++.install-common: |
---|
118 | -if [ -f cc1plus$(exeext) ] ; then \ |
---|
119 | if [ -f g++-cross$(exeext) ] ; then \ |
---|
120 | rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \ |
---|
121 | $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \ |
---|
122 | chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \ |
---|
123 | rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \ |
---|
124 | ln $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) \ |
---|
125 | > /dev/null 2>&1 \ |
---|
126 | || cp $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) ; \ |
---|
127 | else \ |
---|
128 | rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ |
---|
129 | $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ |
---|
130 | chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ |
---|
131 | rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ |
---|
132 | ln $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) \ |
---|
133 | > /dev/null 2>&1 \ |
---|
134 | || cp $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) ; \ |
---|
135 | fi ; \ |
---|
136 | fi |
---|
137 | |
---|
138 | c++.install-info: |
---|
139 | |
---|
140 | c++.install-man: $(srcdir)/cp/g++.1 |
---|
141 | -if [ -f cc1plus$(exeext) ] ; then \ |
---|
142 | if [ -f g++-cross$(exeext) ] ; then \ |
---|
143 | rm -f $(mandir)/$(GXX_CROSS_NAME)$(manext); \ |
---|
144 | $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_CROSS_NAME)$(manext); \ |
---|
145 | chmod a-x $(mandir)/$(GXX_CROSS_NAME)$(manext); \ |
---|
146 | else \ |
---|
147 | rm -f $(mandir)/$(GXX_INSTALL_NAME)$(manext); \ |
---|
148 | $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_INSTALL_NAME)$(manext); \ |
---|
149 | chmod a-x $(mandir)/$(GXX_INSTALL_NAME)$(manext); \ |
---|
150 | fi; \ |
---|
151 | else true; fi |
---|
152 | |
---|
153 | c++.uninstall: |
---|
154 | -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext) |
---|
155 | -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext) |
---|
156 | -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext) |
---|
157 | -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext) |
---|
158 | -rm -rf $(mandir)/$(GXX_INSTALL_NAME)$(manext) |
---|
159 | -rm -rf $(mandir)/$(GXX_CROSS_NAME)$(manext) |
---|
160 | |
---|
161 | # Clean hooks: |
---|
162 | # A lot of the ancillary files are deleted by the main makefile. |
---|
163 | # We just have to delete files specific to us. |
---|
164 | |
---|
165 | c++.mostlyclean: |
---|
166 | -rm -f cp/*$(objext) $(DEMANGLER_PROG) |
---|
167 | c++.clean: |
---|
168 | c++.distclean: |
---|
169 | -rm -f cp/config.status cp/Makefile |
---|
170 | -rm -f cp/parse.output |
---|
171 | c++.extraclean: |
---|
172 | c++.maintainer-clean: |
---|
173 | -rm -f cp/parse.c cp/parse.h |
---|
174 | |
---|
175 | # Stage hooks: |
---|
176 | # The main makefile has already created stage?/cp. |
---|
177 | |
---|
178 | c++.stage1: |
---|
179 | -mv cp/*$(objext) stage1/cp |
---|
180 | c++.stage2: |
---|
181 | -mv cp/*$(objext) stage2/cp |
---|
182 | c++.stage3: |
---|
183 | -mv cp/*$(objext) stage3/cp |
---|
184 | c++.stage4: |
---|
185 | -mv cp/*$(objext) stage4/cp |
---|
186 | |
---|
187 | # Maintenance hooks: |
---|
188 | |
---|
189 | # This target creates the files that can be rebuilt, but go in the |
---|
190 | # distribution anyway. It then copies the files to the distdir directory. |
---|
191 | c++.distdir: |
---|
192 | mkdir tmp/cp |
---|
193 | cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h |
---|
194 | cd cp; \ |
---|
195 | for file in *[0-9a-zA-Z+]; do \ |
---|
196 | ln $$file ../tmp/cp >/dev/null 2>&1 || cp $$file ../tmp/cp; \ |
---|
197 | done |
---|