Make-lang.in revision 117395
1# Top level -*- makefile -*- fragment for GNU C++. 2# Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001 3# Free Software Foundation, Inc. 4 5#This file is part of GNU CC. 6 7#GNU CC is free software; you can redistribute it and/or modify 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 12#GNU CC is distributed in the hope that it will be useful, 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 18#along with GNU CC; see the file COPYING. If not, write to 19#the Free Software Foundation, 59 Temple Place - Suite 330, 20#Boston, MA 02111-1307, USA. 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, 28# foo.uninstall, 29# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean, 30# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 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. 39 40# Actual names to use when installing a native compiler. 41CXX_INSTALL_NAME = `echo c++|sed '$(program_transform_name)'` 42GXX_INSTALL_NAME = `echo g++|sed '$(program_transform_name)'` 43CXX_TARGET_INSTALL_NAME = $(target_alias)-`echo c++|sed '$(program_transform_name)'` 44GXX_TARGET_INSTALL_NAME = $(target_alias)-`echo g++|sed '$(program_transform_name)'` 45 46# Actual names to use when installing a cross-compiler. 47CXX_CROSS_NAME = `echo c++|sed '$(program_transform_cross_name)'` 48GXX_CROSS_NAME = `echo g++|sed '$(program_transform_cross_name)'` 49 50# 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. 55C++ c++: cc1plus$(exeext) 56 57# Tell GNU make to ignore these if they exist. 58.PHONY: C++ c++ 59 60g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) $(GCC_H) $(CONFIG_H) 61 (SHLIB_LINK='$(SHLIB_LINK)' \ 62 SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \ 63 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ 64 $(INCLUDES) $(srcdir)/cp/g++spec.c) 65 66po-generated: $(srcdir)/cp/parse.c 67 68# Create the compiler driver for g++. 69GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o 70g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) 71 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ 72 $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) 73 74# Create a version of the g++ driver which calls the cross-compiler. 75g++-cross$(exeext): g++$(exeext) 76 -rm -f g++-cross$(exeext) 77 cp g++$(exeext) g++-cross$(exeext) 78 79# The compiler itself. 80# Shared with C front end: 81CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ 82 c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o 83 84# Language-specific object files. 85CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ 86 cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \ 87 cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ 88 cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \ 89 cp/optimize.o cp/mangle.o cp/cp-lang.o 90 91# Use loose warnings for this front end. 92cp-warn = 93 94cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \ 95 libcpp.a $(LIBDEPS) 96 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ 97 $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS) 98 99# Special build rules. 100$(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf 101 gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \ 102 $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h 103 104$(srcdir)/cp/parse.h: $(srcdir)/cp/parse.c 105$(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y 106 @echo "Expect 33 shift/reduce conflicts and 58 reduce/reduce conflicts." 107 cd $(srcdir)/cp && \ 108 if $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y; then \ 109 grep '^#define[ ]*YYEMPTY' p$$$$.c >> p$$$$.h ; \ 110 test -f p$$$$.output && mv -f p$$$$.output parse.output ; \ 111 mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h ; \ 112 else \ 113 rm -f p$$$$.* ; \ 114 false ; \ 115 fi 116 117gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true 118gt-cp-parse.h gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h : s-gtype; @true 119gt-cp-tree.h gt-cp-mangle.h : s-gtype; @true 120 121# 122# Build hooks: 123 124c++.all.build: g++$(exeext) 125c++.all.cross: g++-cross$(exeext) 126c++.start.encap: g++$(exeext) 127c++.rest.encap: 128 129c++.info: 130c++.dvi: 131c++.generated-manpages: 132 133# 134# Install hooks: 135# cc1plus is installed elsewhere as part of $(COMPILERS). 136 137# Nothing to do here. 138c++.install-normal: 139 140# Install the driver program as $(target)-g++ 141# and also as either g++ (if native) or $(tooldir)/bin/g++. 142c++.install-common: installdirs 143 -if [ -f cc1plus$(exeext) ] ; then \ 144 if [ -f g++-cross$(exeext) ] ; then \ 145 rm -f $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \ 146 $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \ 147 chmod a+x $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \ 148 rm -f $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext); \ 149 ( cd $(DESTDIR)$(bindir) && \ 150 $(LN) $(GXX_CROSS_NAME)$(exeext) $(CXX_CROSS_NAME)$(exeext) ); \ 151 if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ 152 rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \ 153 $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \ 154 rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \ 155 ( cd $(DESTDIR)$(gcc_tooldir)/bin && \ 156 $(LN) g++$(exeext) c++$(exeext) ); \ 157 else true; fi; \ 158 else \ 159 rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ 160 $(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ 161 chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ 162 rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ 163 ( cd $(DESTDIR)$(bindir) && \ 164 $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ); \ 165 rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \ 166 ( cd $(DESTDIR)$(bindir) && \ 167 $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \ 168 rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \ 169 ( cd $(DESTDIR)$(bindir) && \ 170 $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \ 171 fi ; \ 172 fi 173 174c++.install-info: 175 176c++.install-man: installdirs $(srcdir)/cp/g++.1 177 -if [ -f cc1plus$(exeext) ] ; then \ 178 if [ -f g++-cross$(exeext) ] ; then \ 179 rm -f $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \ 180 $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \ 181 chmod a-x $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \ 182 else \ 183 rm -f $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ 184 $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ 185 chmod a-x $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \ 186 fi; \ 187 else true; fi 188 189c++.uninstall: 190 -rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext) 191 -rm -rf $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext) 192 -rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) 193 -rm -rf $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext) 194 -rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext) 195 -rm -rf $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext) 196# 197# Clean hooks: 198# A lot of the ancillary files are deleted by the main makefile. 199# We just have to delete files specific to us. 200 201c++.mostlyclean: 202 -rm -f cp/*$(objext) 203 -rm -f cp/*$(coverageexts) 204c++.clean: 205c++.distclean: 206 -rm -f cp/config.status cp/Makefile 207 -rm -f $(srcdir)/cp/parse.output 208c++.extraclean: 209c++.maintainer-clean: 210 -rm -f $(srcdir)/cp/parse.c $(srcdir)/cp/parse.h 211# 212# Stage hooks: 213# The main makefile has already created stage?/cp. 214 215c++.stage1: stage1-start 216 -mv cp/*$(objext) stage1/cp 217c++.stage2: stage2-start 218 -mv cp/*$(objext) stage2/cp 219c++.stage3: stage3-start 220 -mv cp/*$(objext) stage3/cp 221c++.stage4: stage4-start 222 -mv cp/*$(objext) stage4/cp 223 224# 225# .o: .h dependencies. 226CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-common.h cp/cp-tree.def c-common.def \ 227 function.h varray.h $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \ 228 $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h 229 230cp/spew.o: cp/spew.c $(CXX_TREE_H) $(srcdir)/cp/parse.h flags.h cp/lex.h \ 231 toplev.h gt-cp-spew.h 232cp/lex.o: cp/lex.c $(CXX_TREE_H) $(srcdir)/cp/parse.h flags.h cp/lex.h \ 233 c-pragma.h toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h \ 234 cp/operators.def $(TM_P_H) 235cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) toplev.h langhooks.h $(LANGHOOKS_DEF_H) \ 236 c-common.h 237cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \ 238 output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(GGC_H) $(RTL_H) \ 239 cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \ 240 debug.h gt-cp-decl.h gtype-cp.h timevar.h input.h 241cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \ 242 output.h except.h toplev.h $(GGC_H) $(RTL_H) c-common.h gt-cp-decl2.h \ 243 timevar.h 244cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \ 245 diagnostic.h 246cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ 247 diagnostic.h 248cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(TARGET_H) 249cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \ 250 $(GGC_H) diagnostic.h gt-cp-call.h 251cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H) 252cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ 253 $(GGC_H) except.h 254cp/method.o: cp/method.c $(CXX_TREE_H) toplev.h $(GGC_H) $(RTL_H) $(EXPR_H) \ 255 $(TM_P_H) $(TARGET_H) 256cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h 257cp/search.o: cp/search.c $(CXX_TREE_H) stack.h flags.h toplev.h $(RTL_H) 258cp/tree.o: cp/tree.c $(CXX_TREE_H) flags.h toplev.h $(GGC_H) $(RTL_H) \ 259 insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h $(TARGET_H) 260cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(SYSTEM_H) 261cp/rtti.o: cp/rtti.c $(CXX_TREE_H) flags.h toplev.h 262cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \ 263 cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h 264cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ 265 except.h $(TM_P_H) 266cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h $(srcdir)/cp/parse.h cp/lex.h \ 267 toplev.h $(GGC_H) $(RTL_H) except.h tree-inline.h gt-cp-pt.h 268cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h \ 269 $(LANGHOOKS_DEF_H) 270cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h \ 271 gt-cp-repo.h 272cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \ 273 flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \ 274 tree-inline.h 275cp/dump.o: cp/dump.c $(CXX_TREE_H) tree-dump.h 276cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \ 277 input.h $(PARAMS_H) debug.h tree-inline.h 278cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h real.h gt-cp-mangle.h $(TM_P_H) 279 280cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \ 281 cp/decl.h $(SYSTEM_H) toplev.h $(GGC_H) gt-cp-parse.h 282 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \ 283 $(srcdir)/cp/parse.c $(OUTPUT_OPTION) 284# 285# These exist for maintenance purposes. 286 287# Update the tags table. 288cp/TAGS: force 289 cd $(srcdir)/cp ; \ 290 etags --no-globals -l c `echo *.c | sed 's/parse.c//'` \ 291 parse.y *.h ../*.c ../*.h; 292 293.PHONY: cp/TAGS 294