OSDN Git Service

62nd Cygnus<->FSF merge
[pf3gnuchains/gcc-fork.git] / gcc / cp / Make-lang.in
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, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 # This file provides the language dependent support in the main Makefile.
21 # Each language makefile fragment must provide the following targets:
22 #
23 # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
24 # foo.info, foo.dvi,
25 # foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
26 # foo.uninstall, foo.distdir,
27 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean, foo.realclean,
28 # foo.stage1, foo.stage2, foo.stage3, foo.stage4
29 #
30 # where `foo' is the name of the language.
31 #
32 # It should also provide rules for:
33 #
34 # - making any compiler driver (eg: g++)
35 # - the compiler proper (eg: cc1plus)
36 # - define the names for selecting the language in LANGUAGES.
37 \f
38 # Extra flags to pass to recursive makes.
39 CXX_FLAGS_TO_PASS = \
40         "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
41         "CXXFLAGS=$(CXXFLAGS)" \
42         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
43
44 # Actual names to use when installing a native compiler.
45 CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t`
46 GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
47
48 # Actual names to use when installing a cross-compiler.
49 CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
50 GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
51
52 \f
53 # Define the names for selecting c++ in LANGUAGES.
54 # Note that it would be nice to move the dependency on g++
55 # into the C++ rule, but that needs a little bit of work
56 # to do the right thing within all.cross.
57 C++ c++: cc1plus
58
59 # Tell GNU make to ignore these if they exist.
60 .PHONY: C++ c++
61
62 # Create the compiler driver for g++.
63 g++: $(srcdir)/cp/g++.c $(CONFIG_H) $(LIBDEPS)
64         $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++ $(srcdir)/cp/g++.c $(LIBS)
65
66 # Create a version of the g++ driver which calls the cross-compiler.
67 g++-cross: $(srcdir)/cp/g++.c version.o $(LIBDEPS)
68         $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \
69            -DGCC_NAME=\"$(GCC_CROSS_NAME)\" $(srcdir)/cp/g++.c version.o $(LIBS)
70
71 CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
72  $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
73  $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
74  $(srcdir)/cp/edsel.c $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
75  $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \
76  $(srcdir)/cp/errfn.c $(srcdir)/cp/gc.c $(srcdir)/cp/method.c \
77  $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \
78  $(srcdir)/cp/error.c $(srcdir)/cp/init.c $(srcdir)/cp/parse.y \
79  $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c $(srcdir)/cp/repo.c
80
81 cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o
82         cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus
83 \f
84 # Build hooks:
85
86 c++.all.build: g++
87 c++.all.cross: g++-cross
88 c++.start.encap: g++
89 c++.rest.encap:
90
91 c++.info:
92 c++.dvi:
93 \f
94 # Install hooks:
95 # cc1plus is installed elsewhere as part of $(COMPILERS).
96
97 # Nothing to do here.
98 c++.install-normal:
99
100 # Install the driver program as $(target)-g++
101 # and also as either g++ (if native) or $(tooldir)/bin/g++.
102 c++.install-common:
103         -if [ -f cc1plus$(exeext) ] ; then \
104           if [ -f g++-cross$(exeext) ] ; then \
105             rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
106             $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
107             chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
108             rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
109             ln $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) \
110               > /dev/null 2>&1 \
111               || cp $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) ; \
112           else \
113             rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
114             $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
115             chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
116             rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
117             ln $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) \
118               > /dev/null 2>&1 \
119               || cp $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) ; \
120           fi ; \
121         fi
122
123 c++.install-info:
124
125 c++.install-man: $(srcdir)/cp/g++.1
126         -if [ -f cc1plus$(exeext) ] ; then \
127           if [ -f g++-cross ] ; then \
128             rm -f $(mandir)/$(GXX_CROSS_NAME)$(manext); \
129             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_CROSS_NAME)$(manext); \
130             chmod a-x $(mandir)/$(GXX_CROSS_NAME)$(manext); \
131           else \
132             rm -f $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
133             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
134             chmod a-x $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
135           fi; \
136         else true; fi
137
138 c++.uninstall:
139         -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
140         -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
141         -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
142         -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
143         -rm -rf $(mandir)/$(GXX_INSTALL_NAME)$(manext)
144         -rm -rf $(mandir)/$(GXX_CROSS_NAME)$(manext)
145 \f
146 # Clean hooks:
147 # A lot of the ancillary files are deleted by the main makefile.
148 # We just have to delete files specific to us.
149
150 c++.mostlyclean:
151         -rm -f cp/*.o
152 c++.clean:
153 c++.distclean:
154         -rm -f cp/config.status cp/Makefile
155         -rm -f cp/parse.output
156 c++.extraclean:
157 c++.realclean:
158         -rm -f cp/parse.c cp/parse.h
159 \f
160 # Stage hooks:
161 # The main makefile has already created stage?/cp.
162
163 c++.stage1:
164         -mv cp/*.o stage1/cp
165 c++.stage2:
166         -mv cp/*.o stage2/cp
167 c++.stage3:
168         -mv cp/*.o stage3/cp
169 c++.stage4:
170         -mv cp/*.o stage4/cp
171 \f
172 # Maintenance hooks:
173
174 # This target creates the files that can be rebuilt, but go in the
175 # distribution anyway.  It then copies the files to the distdir directory.
176 c++.distdir:
177         mkdir tmp/cp
178         cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
179         cd cp; \
180         for file in *[0-9a-zA-Z+]; do \
181           ln $$file ../tmp/cp >/dev/null 2>&1 || cp $$file ../tmp/cp; \
182         done