--- gcc/Makefile 2018/04/24 16:44:45 1.1.1.9 +++ gcc/Makefile 2018/04/24 16:48:17 1.1.1.12 @@ -1,5 +1,5 @@ # Makefile for GNU C compiler. -# Copyright (C) 1987 Free Software Foundation, Inc. +# Copyright (C) 1987, 1988 Free Software Foundation, Inc. #This file is part of GNU CC. @@ -24,14 +24,21 @@ CC = cc # OLDCC should not be the GNU C compiler. OLDCC = cc BISON = bison +BISONFLAGS = -v AR = ar SHELL = /bin/sh +# on sysV, define this as cp. +INSTALL = install -bindir = /usr/local -libdir = /usr/local/lib +# Directory in which to put the executable for the command `gcc' +bindir = $(prefix)/usr/local/bin +# Directory in which to put the subprograms used by the compiler. +libdir = $(prefix)/usr/local/lib +# Directory in which to put man pages. +mandir = $(prefix)/usr/local/man/man1 # These are what you would need on HPUX: -# CFLAGS = -Wc,-Ns2000 -Wc,-Ne700 +# CFLAGS = -Wc,-Ns2000 -Wc,-Ne700 -Wc,-Np300 # -g is desirable in CFLAGS, but a compiler bug in HPUX version 5 # bites whenever tree.def, rtl.def or machmode.def is included # (ie., on every source file). @@ -39,6 +46,10 @@ libdir = /usr/local/lib # For CCLIBFLAGS you might want to specify the switch that # forces only 68000 instructions to be used. +# If you are using gas on hp-ux you need the following to fake up some +# system file definitions: +# CFLAGS = -g -I../hp-include + # If you are making gcc for the first time, and if you are compiling it with # a non-gcc compiler, and if your system doesn't have a working alloca() in any # of the standard libraries (as is true for HP/UX or Genix), @@ -47,7 +58,7 @@ libdir = /usr/local/lib # If your system has alloca() in /lib/libPW.a, un-comment the following line: # CLIB= -lPW - + # If your system's malloc() routine fails for any reason (as it does on # certain versions of Genix), try getting the files # malloc.c and getpagesize.h from GNU Emacs and un-comment the following line: @@ -70,9 +81,17 @@ LIBS = $(OBSTACK) $(ALLOCA) $(MALLOC) $( DIR = ../gcc -# Object files of CC1. -OBJS = toplev.o version.o c-parse.tab.o tree.o print-tree.o \ - c-decl.o c-typeck.o c-convert.o stor-layout.o fold-const.o \ +# Language-specific object files for C. +C_OBJS = c-parse.tab.o c-decl.o c-typeck.o c-convert.o + +# Language-specific object files for C++. +# (These are not yet released.) +CPLUS_OBJS = cplus-parse.o cplus-decl.o cplus-typeck.o \ + cplus-cvt.o cplus-search.o cplus-lex.o \ + cplus-class.o cplus-init.o cplus-method.o + +# Language-independent object files. +OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \ rtl.o expr.o stmt.o expmed.o explow.o optabs.o varasm.o \ symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \ integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \ @@ -84,16 +103,16 @@ STAGE_GCC=gcc STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \ insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \ genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \ - cc1 cpp cccp + cc1 cpp cccp # cc1plus # Members of gnulib. -LIBFUNCS = _eprintf \ +LIBFUNCS = _eprintf _builtin_new _builtin_New _builtin_del \ _umulsi3 _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \ - _lshrsi3 _lshlsi3 _ashrsi3 _ashlsi3 \ + _lshrsi3 _lshlsi3 _ashrsi3 _ashlsi3 _cmpdi2 _ucmpdi2 \ _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 _cmpdf2 \ _fixunsdfsi _fixunsdfdi _fixdfsi _fixdfdi \ _floatsidf _floatdidf _truncdfsf2 _extendsfdf2 \ - _addsf3 _negsf2 _subsf3 _cmpsf2 _mulsf3 _divsf3 + _addsf3 _negsf2 _subsf3 _cmpsf2 _mulsf3 _divsf3 _varargs # Header files that are made available to programs compiled with gcc. USER_H = stddef.h stdarg.h assert.h varargs.h va-*.h limits.h @@ -103,10 +122,14 @@ USER_H = stddef.h stdarg.h assert.h vara CONFIG_H = RTL_H = rtl.h rtl.def machmode.def TREE_H = tree.h tree.def machmode.def +CPLUS_TREE_H = $(TREE_H) cplus-tree.h c-tree.h + +all: gnulib gcc cc1 cpp # cc1plus -all: gnulib gcc cc1 cpp +lang-c: gnulib gcc cc1 cpp +# lang-cplus: gnulib gcc cc1plus cpp -doc: cpp.info internals +doc: cpp.info gplus.info gcc.info compilations: ${OBJS} @@ -118,8 +141,11 @@ gcc: gcc.o version.o $(LIBDEPS) gcc.o: gcc.c $(CONFIG_H) $(CC) $(CFLAGS) -c -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-\" gcc.c -cc1: $(OBJS) $(LIBDEPS) - $(CC) $(CFLAGS) $(LDFLAGS) -o cc1 $(OBJS) $(LIBS) +cc1: $(C_OBJS) $(OBJS) $(LIBDEPS) + $(CC) $(CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(LIBS) + +cc1plus: $(CPLUS_OBJS) $(OBJS) $(LIBDEPS) + $(CC) $(CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(OBJS) $(LIBS) #Library of arithmetic subroutines # Don't compile this with gcc! @@ -131,7 +157,7 @@ gnulib: gnulib.c do \ echo $${name}; \ rm -f $${name}.c; \ - ln ../gnulib.c $${name}.c; \ + cp ../gnulib.c $${name}.c; \ $(OLDCC) $(CCLIBFLAGS) -O -I.. -c -DL$${name} $${name}.c; \ $(AR) qc gnulib $${name}.o; \ done @@ -145,16 +171,35 @@ gnulib: gnulib.c # hpxt gnulib-hp gnulib -# C-language specific files. +# C language specific files. c-parse.tab.o : c-parse.tab.c $(CONFIG_H) $(TREE_H) c-parse.h c-tree.h c-parse.tab.c : c-parse.y - $(BISON) -v c-parse.y + $(BISON) $(BISONFLAGS) c-parse.y c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-parse.h flags.h c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) +# C++ language specific files. + +cplus-parse.o : cplus-parse.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h + $(CC) -c $(CFLAGS) -DPARSE_OUTPUT=\"$(PWD)/cplus-parse.output\" cplus-parse.c + +cplus-parse.h cplus-parse.c : cplus-parse.y + @echo expect 49 shift/reduce conflicts and 4 reduce/reduce conflicts + $(BISON) $(BISONFLAGS) -d -o cplus-parse.c cplus-parse.y + +cplus-lex.o : cplus-lex.c $(CONFIG_H) $(CPLUS_TREE_H) cplus-parse.h +cplus-decl.o : cplus-decl.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h +cplus-typeck.o : cplus-typeck.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h +cplus-class.o : cplus-class.c $(CONFIG_H) $(CPLUS_TREE_H) +cplus-init.o : cplus-init.c $(CONFIG_H) $(CPLUS_TREE_H) +cplus-method.o : cplus-method.c $(CONFIG_H) $(CPLUS_TREE_H) +cplus-cvt.o : cplus-cvt.c $(CONFIG_H) $(CPLUS_TREE_H) +cplus-search.o : cplus-search.c $(CONFIG_H) $(CPLUS_TREE_H) +new-method.o : new-method.c $(CONFIG_H) $(CPLUS_TREE_H) + # Language-independent files. tree.o : tree.c $(CONFIG_H) $(TREE_H) @@ -188,7 +233,7 @@ jump.o : jump.c $(CONFIG_H) $(RTL_H) fla stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h -loop.o : loop.c $(CONFIG_H) $(RTL_H) insn-config.h regs.h recog.h +loop.o : loop.c $(CONFIG_H) $(RTL_H) insn-config.h regs.h recog.h flags.h expr.h flow.o : flow.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h combine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h \ insn-config.h regs.h basic-block.h recog.h @@ -208,57 +253,87 @@ final.o : final.c $(CONFIG_H) $(RTL_H) r recog.o : recog.c $(CONFIG_H) $(RTL_H) \ regs.h recog.h hard-reg-set.h insn-config.h +# Normally this target is not used; but it is used if you +# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c +# from the GNU Emacs distribution. +# Note some machines won't allow $(CC) without -S on this source file. +alloca.o: alloca.c + $(CC) $(CFLAGS) -S alloca.c + as alloca.s -o alloca.o + # Now the source files that are generated from the machine description. .PRECIOUS: insn-config.h insn-flags.h insn-codes.h \ insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c -insn-config.h : md genconfig +# The following pair of rules has this effect: +# genconfig is run only if the md has changed since genconfig was last run; +# but the file insn-config.h is touched only when its contents actually change. + +# Each of the other insn-* files is handled by a similar pair of rules. + +insn-config.h: stamp-config.h +stamp-config.h : md genconfig ./genconfig md > tmp-insn-config.h ./move-if-change tmp-insn-config.h insn-config.h + touch stamp-config.h -insn-flags.h : md genflags +insn-flags.h: stamp-flags.h +stamp-flags.h : md genflags ./genflags md > tmp-insn-flags.h ./move-if-change tmp-insn-flags.h insn-flags.h + touch stamp-flags.h -insn-codes.h : md gencodes +insn-codes.h: stamp-codes.h +stamp-codes.h : md gencodes ./gencodes md > tmp-insn-codes.h ./move-if-change tmp-insn-codes.h insn-codes.h + touch stamp-codes.h insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h insn-config.h $(CC) $(CFLAGS) -c insn-emit.c -insn-emit.c : md genemit +insn-emit.c: stamp-emit.c +stamp-emit.c : md genemit ./genemit md > tmp-insn-emit.c ./move-if-change tmp-insn-emit.c insn-emit.c + touch stamp-emit.c insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(CC) $(CFLAGS) -c insn-recog.c -insn-recog.c : md genrecog +insn-recog.c: stamp-recog.c +stamp-recog.c : md genrecog ./genrecog md > tmp-insn-recog.c ./move-if-change tmp-insn-recog.c insn-recog.c + touch stamp-recog.c insn-extract.o : insn-extract.c $(RTL_H) $(CC) $(CFLAGS) -c insn-extract.c -insn-extract.c : md genextract +insn-extract.c: stamp-extract.c +stamp-extract.c : md genextract ./genextract md > tmp-insn-extract.c ./move-if-change tmp-insn-extract.c insn-extract.c + touch stamp-extract.c insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h $(CC) $(CFLAGS) -c insn-peep.c -insn-peep.c : md genpeep +insn-peep.c: stamp-peep.c +stamp-peep.c : md genpeep ./genpeep md > tmp-insn-peep.c ./move-if-change tmp-insn-peep.c insn-peep.c + touch stamp-peep.c insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h insn-config.h insn-flags.h conditions.h output.h aux-output.c $(CC) $(CFLAGS) -c insn-output.c -insn-output.c : md genoutput +insn-output.c: stamp-output.c +stamp-output.c : md genoutput ./genoutput md > tmp-insn-output.c ./move-if-change tmp-insn-output.c insn-output.c + touch stamp-output.c # Now the programs that generate those files. @@ -327,32 +402,46 @@ cccp.o: cccp.c cpp.info: cpp.texinfo makeinfo $< -internals: internals.texinfo +gplus.info: gplus.texinfo + makeinfo $< + +gcc.info: gcc.texinfo makeinfo $< # gnulib is not deleted because deleting it would be inconvenient # for most uses of this target. clean: -rm -f $(STAGESTUFF) $(STAGE_GCC) + -rm -f stamp-*.[ch] -rm -f *.s *.s[0-9] *.co *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop -rm -f core # Get rid of every file that's generated from some other file (except INSTALL). realclean: clean -rm -f cpp.aux cpp.cps cpp.fns cpp.info cpp.kys cpp.pgs cpp.tps cpp.vrs - -rm -f c-parse.tab.c c-parse.output errs gnulib cexp.c TAGS - -rm -f internals internals-* internals.?? internals.??s + #-rm -f cplus-parse.tab.c cplus-parse.output + -rm -f c-parse.tab.c c-parse.output + -rm -f errs gnulib cexp.c TAGS + -rm -f gcc.info* gcc.?? gcc.??s gcc.log gcc.toc gcc.*aux + -rm -f gplus.info* gplus.?? gplus.??s gplus.log gplus.toc gplus.*aux + +# Like realclean but also delete the links made to configure gcc. +cleanlinks: realclean + -rm tm.h aux-output.c config.h md config.status # Copy the files into directories where they will be run. install: all - install cc1 $(libdir)/gcc-cc1 - install -c -m 755 gnulib $(libdir)/gcc-gnulib - if [ -f /usr/bin/ranlib ] ; then ranlib $(libdir)/gcc-gnulib ;fi - install cpp $(libdir)/gcc-cpp - install gcc $(bindir) + if [ -f cc1 ] ; then $(INSTALL) cc1 $(libdir)/gcc-cc1 ;fi + if [ -f cc1plus ] ; then $(INSTALL) cc1plus $(libdir)/gcc-cc1plus ;fi + $(INSTALL) gnulib $(libdir)/gcc-gnulib + if [ -f /usr/bin/ranlib ] ; then (cd $(libdir); ranlib /gcc-gnulib) ;fi + $(INSTALL) cpp $(libdir)/gcc-cpp + $(INSTALL) gcc $(bindir) -mkdir $(libdir)/gcc-include + chmod ugo+rx $(libdir)/gcc-include cd $(libdir)/gcc-include; rm -f $(USER_H) cp $(USER_H) $(libdir)/gcc-include + cp gcc.1 mandir # do make -f ../gcc/Makefile maketest DIR=../gcc # in the intended test directory to make it a suitable test directory. @@ -360,42 +449,49 @@ maketest: ln -s $(DIR)/*.[chy] . ln -s $(DIR)/*.def . ln -s $(DIR)/*.md . + -rm -f =* ln -s $(DIR)/.gdbinit . -ln -s $(DIR)/bison.simple . - ln -s $(DIR)/gcc . + ln -s $(DIR)/config.gcc . ln -s $(DIR)/move-if-change . - ln -s $(DIR)/Makefile test-Makefile - -rm tm.h aux-output.c - make -f test-Makefile clean -# You must create the necessary links tm.h, md and aux-output.c + if [ -f Makefile ] ; then false; else ln -s $(DIR)/Makefile . ; fi + -rm tm.h aux-output.c config.h md + make clean +# You must then run config.gcc to set up for compilation. + +bootstrap: all force + $(MAKE) stage1 + $(MAKE) CC="stage1/gcc -Bstage1/" CFLAGS="-O $(CFLAGS)" + $(MAKE) stage2 + $(MAKE) CC="stage2/gcc -Bstage2/" CFLAGS="-O $(CFLAGS)" # Copy the object files from a particular stage into a subdirectory. stage1: force -mkdir stage1 - mv $(STAGESTUFF) $(STAGE_GCC) stage1 - -rm stage1/gnulib - -ln gnulib stage1 || cp gnulib stage1 + -mv $(STAGESTUFF) $(STAGE_GCC) stage1 + -rm -f stage1/gnulib + -ln gnulib stage1 || (cp gnulib stage1 && ranlib stage1/gnulib) stage2: force -mkdir stage2 - mv $(STAGESTUFF) $(STAGE_GCC) stage2 - -rm stage2/gnulib - -ln gnulib stage2 || cp gnulib stage2 + -mv $(STAGESTUFF) $(STAGE_GCC) stage2 + -rm -f stage2/gnulib + -ln gnulib stage2 || (cp gnulib stage2 && ranlib stage2/gnulib) stage3: force -mkdir stage3 - mv $(STAGESTUFF) $(STAGE_GCC) stage3 - -rm stage3/gnulib - -ln gnulib stage3 || cp gnulib stage3 - -force: + -mv $(STAGESTUFF) $(STAGE_GCC) stage3 + -rm -f stage3/gnulib + -ln gnulib stage3 || (cp gnulib stage3 && ranlib stage3/gnulib) TAGS: force mkdir temp - -mv c-parse.tab.c cexp.c temp + -mv c-parse.tab.c cplus-parse.c cplus-parse.h cexp.c temp etags *.y *.h *.c mv temp/* . rmdir temp #In GNU Make, ignore whether `stage*' exists. -.PHONY: stage1 stage2 stage3 clean realclean TAGS +.PHONY: stage1 stage2 stage3 clean realclean TAGS bootstrap + +force: