1 # Top level makefile fragment for GNU C++.
2 # Copyright (C) 1994, 1995 Free Software Foundation, Inc.
4 #This file is part of GNU CC.
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)
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.
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.
20 # This file provides the language dependent support in the main Makefile.
21 # Each language makefile fragment must provide the following targets:
23 # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
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
30 # where `foo' is the name of the language.
32 # It should also provide rules for:
34 # - making any compiler driver (eg: g++)
35 # - the compiler proper (eg: cc1plus)
36 # - define the names for selecting the language in LANGUAGES.
38 # Extra flags to pass to recursive makes.
40 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
41 "CXXFLAGS=$(CXXFLAGS)" \
42 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
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`
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`
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.
59 # Tell GNU make to ignore these if they exist.
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)
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)
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
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
87 c++.all.cross: g++-cross
95 # cc1plus is installed elsewhere as part of $(COMPILERS).
100 # Install the driver program as $(target)-g++
101 # and also as either g++ (if native) or $(tooldir)/bin/g++.
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) \
111 || cp $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) ; \
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) \
119 || cp $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) ; \
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); \
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); \
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)
147 # A lot of the ancillary files are deleted by the main makefile.
148 # We just have to delete files specific to us.
154 -rm -f cp/config.status cp/Makefile
155 -rm -f cp/parse.output
158 -rm -f cp/parse.c cp/parse.h
161 # The main makefile has already created stage?/cp.
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.
178 cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
180 for file in *[0-9a-zA-Z+]; do \
181 ln $$file ../tmp/cp >/dev/null 2>&1 || cp $$file ../tmp/cp; \