[gnu.g++.bug] Makefile

sps@magoo.mcnc.org (Stephen Schaefer) (12/23/88)

Due to our source management system (see ``Rtools...'', p.85 Summer
1988 USENIX Proceeding), we find it necessary to explicitly list all
dependencies in our makefiles.  I further believe it to be a good
practice in any environment.  The diffs also reflect some
idiosyncratic changes: the location of executables and libraries,
choice of architecture compiler flags according to the directory in
which we are compiling, and -v flag sent to gcc in a couple places.

The unconditional inclusion of gcc flag -Um68k appears to be an error;
its omission for compilation on a 4.3BSD vax has not (yet) caused any
(known) trouble.  

I am using the 4.3BSD ld.  My first attempts at compilation gave me
``multiply defined'' errors for the symbols defined in
/usr/lib/libg.a.  Removing the explicit mention of -lg corrected that
problem (gcc adds its own -lg argument to the ld invocation).

I may have missed some dependencies on aux-output.c, config.h, md, and
tm.h since those don't fit our architecture independent compilation
model, and I hack around them.

I hope this is useful to someone.

*** /tmp/d10800	Thu Dec 22 16:47:35 1988
--- Makefile	Thu Dec 22 09:53:01 1988
***************
*** 29,35 ****
  SHELL = /bin/sh
  
! bindir = $(HOME)/usr/local/bin
! libdir = $(HOME)/usr/local/lib
! startdir = $(HOME)/usr/local/lib
  
  # These are what you would need on HPUX:
--- 29,35 ----
  SHELL = /bin/sh
  
! bindir = /usr/local/std/bin
! libdir = /usr/local/std/lib
! startdir = /usr/local/std/lib
  
  # These are what you would need on HPUX:
***************
*** 98,104 ****
  # If you want to recompile everything, just do rm *.o.
  # CONFIG_H = config.h tm.h
! CONFIG_H =
  RTL_H = rtl.h rtl.def machmode.def
  TREE_H = tree.h tree.def machmode.def
  
  all: g++ c++ cpp+ gnulib+ crt0+.o crt1+.o ld++ # collect
--- 98,108 ----
  # If you want to recompile everything, just do rm *.o.
  # CONFIG_H = config.h tm.h
! # CONFIG_H =
! # ...but we tell the truth to Make/Build
! CONFIG_H = config.h tm.h
  RTL_H = rtl.h rtl.def machmode.def
  TREE_H = tree.h tree.def machmode.def
+ CPTREE_H = cplus-tree.h c-tree.h
+ EXPR_H = expr.h insn-codes.h
  
  all: g++ c++ cpp+ gnulib+ crt0+.o crt1+.o ld++ # collect
***************
*** 109,128 ****
  
  g++: gcc.o $(OBSTACK1) version.o
! 	$(CC) -g -o g++ $(PROFILE) gcc.o version.o -lg $(LIBS) -lc
  
! gcc.o: gcc.c $(CONFIG_H)
  	$(CC) $(CFLAGS) -c -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-\" gcc.c
  
! ld.o: ld.c
! #	uncomment the following line for Sun 3's
! #	$(CC) -Dmc68020 -DSUN3=3 -DTARGET=SUN3 -c $(PROFILE) $(CFLAGS) ld.c
! #	uncomment the following line for Sun 2's
! #	$(CC) -Dmc68010 -c $(PROFILE) $(CFLAGS) ld.c
! #	uncomment the following line for Sun 4's
! 	$(CC) -DSUN4=4 -DTARGET=SUN4 -c $(PROFILE) $(CFLAGS) ld.c -DDEFAULT_SEARCH_PREFIX=\"/home/sioux/mdt/usr/local/lib\"
! #	uncomment the following line for the other machines
! #	$(CC) -c $(PROFILE) $(CFLAGS) ld.c
  
! ld++: ld.o
  	$(CC) -o ld++ $(PROFILE) ld.o -lg -lc
  
--- 113,138 ----
  
  g++: gcc.o $(OBSTACK1) version.o
! 	$(CC) -v -g -o g++ $(PROFILE) gcc.o version.o $(LIBS) -lc
  
! gcc.o: gcc.c $(CONFIG_H) obstack.h
  	$(CC) $(CFLAGS) -c -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-\" gcc.c
  
! ld.o: ld.c symseg.h version.c
! 	case `pwd` in \
! 	*/sun3/local/std/g++) \
! 		$(CC) -Dmc68020 -DSUN3=3 -DTARGET=SUN3 -DDEFAULT_SEARCH_PREFIX=\"$(libdir)\" -c $(PROFILE) $(CFLAGS) ld.c \
! 		;; \
! 	*/sun/local/std/g++) \
! 		$(CC) -Dmc68010 -DDEFAULT_SEARCH_PREFIX=\"$(libdir)\" -c $(PROFILE) $(CFLAGS) ld.c \
! 		;; \
! 	*/sun4/local/std/g++) \
! 		$(CC) -DSUN4=4 -DTARGET=SUN4 -DDEFAULT_SEARCH_PREFIX=\"$(libdir)\" -c $(PROFILE) $(CFLAGS) ld.c \
! 		;; \
! 	*) \
! 		$(CC) -DDEFAULT_SEARCH_PREFIX=\"$(libdir)\" -c $(PROFILE) $(CFLAGS) ld.c \
! 		;; \
! 	esac
  
! ld++: ld.o symseg.h
  	$(CC) -o ld++ $(PROFILE) ld.o -lg -lc
  
***************
*** 133,156 ****
  
  crt0+.o: crt0.c config.h
! #	uncomment the next line for VAX systems
! #	$(CC) -D"CRT0_DUMMIES=" -g -c crt0.c
! #	uncomment the next line for hp 9000 systems
! #	$(CC) -Um68k -Umc68000 -g -c crt0.c
! #	uncomment the next line for Sequent Balance systems
! #	$(CC) -D"CRT0_DUMMIES=" -DDOT_GLOBAL_START -g -c crt0.c
! #	uncomment the next line for Sun 2/3/4 systems
! 	$(CC) -Um68k -g -c crt0.c
  	mv crt0.o crt0+.o
  
  crt1+.o: crt1.c config.h
! 	$(CC) -Um68k -g -c crt1.c
! 	mv crt1.o crt1+.o
  
  c++: $(OBJS) $(OBSTACK1)
! 	$(CC) -g -o c++ $(PROFILE) $(OBJS) /usr/lib/debug/malloc.o -lg $(LIBS) -lc
  
  #Library of arithmetic subroutines
  # Don't compile this with gcc!
! gnulib+: gnulib.c
  	-mkdir libtemp
  	cd libtemp; \
--- 143,183 ----
  
  crt0+.o: crt0.c config.h
! 	set -x ;\
! 	case `pwd` in \
! 	*/bsd43/local/std/g++|*/ultrix/local/std/g++) \
! 		$(CC) -D"CRT0_DUMMIES=" -g -c crt0.c \
! 		;; \
! 	*/hp9000/local/std/g++) \
! 		$(CC) -Um68k -Umc68000 -g -c crt0.c \
! 		;; \
! 	*/sequent/local/std/g++) \
! 		$(CC) -D"CRT0_DUMMIES=" -DDOT_GLOBAL_START -g -c crt0.c \
! 		;; \
! 	*/sun*/local/std/g++) \
! 		$(CC) -Um68k -g -c crt0.c \
! 		;; \
! 	esac
  	mv crt0.o crt0+.o
  
  crt1+.o: crt1.c config.h
! 	set -x ; \
! 	case `pwd` in \
! 	*/sun*/local/std/g++|*/hp9000/local/std/g++|*/sequent/local/std/g++) \
! 		$(CC) -Um68k -g -c crt1.c; mv crt1.o crt1+.o \
! 	;; \
! 	*/bsd43/local/std/g++|*/ultrix/local/std/g++) \
! 		$(CC) -g -c crt1.c; mv crt1.o crt1+.o \
! 	;; \
! 	*) \
! 		touch crt1+.o \
! 	;; \
! 	esac
  
  c++: $(OBJS) $(OBSTACK1)
! 	$(CC) -v -g -o c++ $(PROFILE) $(OBJS) $(LIBS)
  
  #Library of arithmetic subroutines
  # Don't compile this with gcc!
! gnulib+: gnulib.c config.h
  	-mkdir libtemp
  	cd libtemp; \
***************
*** 173,191 ****
  #	hpxt gnulib-hp gnulib
  
! cplus-decl.o : cplus-decl.c $(CONFIG_H) $(TREE_H) flags.h cplus-parse.h c-tree.h
! cplus-typeck.o : cplus-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
! tree.o : tree.c $(CONFIG_H) $(TREE_H)
! print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
! stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H)
  fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H)
! toplev.o : toplev.c $(CONFIG_H) $(TREE_H) flags.h
  	$(CC) -c $(CFLAGS) -DSORRY_EXIT_CODE=35 toplev.c
  
! cplus-overload.o : cplus-overload.c $(CONFIG_H) $(TREE_H) c-tree.h
! cplus-class.o : cplus-class.c $(CONFIG_H) $(TREE_H) c-tree.h
! cplus-init.o : cplus-init.c $(CONFIG_H) $(TREE_H) c-tree.h
! cplus-method.o : cplus-method.c $(CONFIG_H) $(TREE_H) c-tree.h
! cplus-convert.o : cplus-convert.c $(CONFIG_H) $(TREE_H) c-tree.h
! cplus-search.o : cplus-search.c $(CONFIG_H) $(TREE_H) c-tree.h
  new-cplus-method.o : new-cplus-method.c $(CONFIG_H) $(TREE_H) c-tree.h
  
--- 200,218 ----
  #	hpxt gnulib-hp gnulib
  
! cplus-decl.o : cplus-decl.c $(CONFIG_H) $(TREE_H) $(CPTREE_H) flags.h cplus-parse.h assert.h
! cplus-typeck.o : cplus-typeck.c $(CONFIG_H) $(TREE_H) $(CPTREE_H) flags.h assert.h
! tree.o : tree.c $(CONFIG_H) $(TREE_H) obstack.h varargs.h assert.h
! print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H) $(RTL_H)
! stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) $(RTL_H)
  fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H)
! toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h c-tree.h
  	$(CC) -c $(CFLAGS) -DSORRY_EXIT_CODE=35 toplev.c
  
! cplus-overload.o : cplus-overload.c $(CONFIG_H) $(TREE_H) $(RTL_H) $(CPTREE_H)
! cplus-class.o : cplus-class.c $(CONFIG_H) $(TREE_H) $(RTL_H) $(CPTREE_H) flags.h
! cplus-init.o : cplus-init.c $(CONFIG_H) $(TREE_H) $(CPTREE_H)
! cplus-method.o : cplus-method.c $(CONFIG_H) $(TREE_H) $(CPTREE_H)
! cplus-convert.o : cplus-convert.c $(CONFIG_H) $(TREE_H) $(CPTREE_H)
! cplus-search.o : cplus-search.c $(CONFIG_H) $(TREE_H) $(CPTREE_H) obstack.h flags.h
  new-cplus-method.o : new-cplus-method.c $(CONFIG_H) $(TREE_H) c-tree.h
  
***************
*** 193,215 ****
  	$(CC) -c $(CFLAGS) -DESKIT -DPARSE_OUTPUT=\"$(PWD)/cplus-parse.output\" cplus-parse.tab.c
  
! cplus-parse.tab.c : cplus-parse.y
  	@echo expect 49 shift/reduce conflicts and 4 reduce/reduce conflicts
  	$(BISON) $(BISONFLAGS) cplus-parse.y
  
! cplus-lex.o : cplus-lex.c $(CONFIG_H) $(TREE_H) c-tree.h cplus-parse.h cplus-parse.tab.h
  rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
  
! varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h expr.h
  stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
!    insn-flags.h expr.h insn-config.h regs.h
  expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
!    insn-flags.h insn-codes.h expr.h insn-config.h recog.h
  expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
!    insn-flags.h insn-codes.h expr.h insn-config.h recog.h
! explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h
  optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
!    insn-flags.h insn-codes.h expr.h insn-config.h recog.h
! symout.o : symout.c $(CONFIG_H) $(TREE_H) $(RTL_H) symseg.h gdbfiles.h
! dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H)
  sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h
  
--- 220,242 ----
  	$(CC) -c $(CFLAGS) -DESKIT -DPARSE_OUTPUT=\"$(PWD)/cplus-parse.output\" cplus-parse.tab.c
  
! cplus-parse.tab.c : cplus-parse.y $(CPTREE_H)
  	@echo expect 49 shift/reduce conflicts and 4 reduce/reduce conflicts
  	$(BISON) $(BISONFLAGS) cplus-parse.y
  
! cplus-lex.o : cplus-lex.c $(CONFIG_H) $(TREE_H) $(CPTREE_H) cplus-parse.h cplus-parse.tab.h obstack.h parse.tab.h parse.h flags.h
  rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
  
! varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h $(EXPR_H) obstack.h
  stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
!    insn-flags.h $(EXPR_H) insn-config.h regs.h
  expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
!    insn-flags.h $(EXPR_H) insn-config.h recog.h
  expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
!    insn-flags.h $(EXPR_H) insn-config.h recog.h
! explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h $(EXPR_H)
  optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
!    insn-flags.h $(EXPR_H) insn-config.h recog.h
! symout.o : symout.c $(CONFIG_H) $(TREE_H) $(RTL_H) symseg.h gdbfiles.h stddef.h
! dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h
  sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h
  
***************
*** 216,220 ****
  emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) regs.h insn-config.h
  
! integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-flags.h
  
  jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h regs.h
--- 243,247 ----
  emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) regs.h insn-config.h
  
! integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h $(EXPR_H) insn-flags.h obstack.h
  
  jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h regs.h
***************
*** 222,226 ****
  
  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 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  \
--- 249,253 ----
  
  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 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  \
***************
*** 240,243 ****
--- 267,271 ----
  recog.o : recog.c $(CONFIG_H) $(RTL_H)  \
     regs.h recog.h hard-reg-set.h insn-config.h
+ obstack.o : obstack.c obstack.h
  
  # Now the source files that are generated from the machine description.
***************
*** 246,265 ****
    insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c
  
! insn-config.h : md genconfig
  	./genconfig md > tmp-insn-config.h
  	./move-if-change tmp-insn-config.h insn-config.h
  
! insn-flags.h : md genflags
  	./genflags md > tmp-insn-flags.h
  	./move-if-change tmp-insn-flags.h insn-flags.h
  
! insn-codes.h : md gencodes
  	./gencodes md > tmp-insn-codes.h
  	./move-if-change tmp-insn-codes.h insn-codes.h
  
! insn-emit.o : insn-emit.c $(RTL_H) expr.h insn-config.h
  	$(CC) $(CFLAGS) -c insn-emit.c
  
! insn-emit.c : md genemit
  	./genemit md > tmp-insn-emit.c
  	./move-if-change tmp-insn-emit.c insn-emit.c
--- 274,293 ----
    insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c
  
! insn-config.h : md genconfig move-if-change
  	./genconfig md > tmp-insn-config.h
  	./move-if-change tmp-insn-config.h insn-config.h
  
! insn-flags.h : md genflags move-if-change
  	./genflags md > tmp-insn-flags.h
  	./move-if-change tmp-insn-flags.h insn-flags.h
  
! insn-codes.h : md gencodes move-if-change
  	./gencodes md > tmp-insn-codes.h
  	./move-if-change tmp-insn-codes.h insn-codes.h
  
! insn-emit.o : insn-emit.c $(RTL_H) $(EXPR_H) insn-config.h
  	$(CC) $(CFLAGS) -c insn-emit.c
  
! insn-emit.c : md genemit move-if-change
  	./genemit md > tmp-insn-emit.c
  	./move-if-change tmp-insn-emit.c insn-emit.c
***************
*** 268,272 ****
  	$(CC) $(CFLAGS) -c insn-recog.c
  
! insn-recog.c : md genrecog
  	./genrecog md > tmp-insn-recog.c
  	./move-if-change tmp-insn-recog.c insn-recog.c
--- 296,300 ----
  	$(CC) $(CFLAGS) -c insn-recog.c
  
! insn-recog.c : md genrecog move-if-change
  	./genrecog md > tmp-insn-recog.c
  	./move-if-change tmp-insn-recog.c insn-recog.c
***************
*** 275,279 ****
  	$(CC) $(CFLAGS) -c insn-extract.c
  
! insn-extract.c : md genextract
  	./genextract md > tmp-insn-extract.c
  	./move-if-change tmp-insn-extract.c insn-extract.c
--- 303,307 ----
  	$(CC) $(CFLAGS) -c insn-extract.c
  
! insn-extract.c : md genextract move-if-change
  	./genextract md > tmp-insn-extract.c
  	./move-if-change tmp-insn-extract.c insn-extract.c
***************
*** 282,286 ****
  	$(CC) $(CFLAGS) -c insn-peep.c
  
! insn-peep.c : md genpeep
  	./genpeep md > tmp-insn-peep.c
  	./move-if-change tmp-insn-peep.c insn-peep.c
--- 310,314 ----
  	$(CC) $(CFLAGS) -c insn-peep.c
  
! insn-peep.c : md genpeep move-if-change
  	./genpeep md > tmp-insn-peep.c
  	./move-if-change tmp-insn-peep.c insn-peep.c
***************
*** 289,293 ****
  	$(CC) $(CFLAGS) -c insn-output.c
  
! insn-output.c : md genoutput
  	./genoutput md > tmp-insn-output.c
  	./move-if-change tmp-insn-output.c insn-output.c
--- 317,321 ----
  	$(CC) $(CFLAGS) -c insn-output.c
  
! insn-output.c : md genoutput move-if-change
  	./genoutput md > tmp-insn-output.c
  	./move-if-change tmp-insn-output.c insn-output.c
--
	Stephen P. Schaefer, Postmaster	MCNC
	sps@mcnc.org			P.O. Box 12889
	...!mcnc!sps			RTP, NC 27709