This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: Build doc files in build directory not source directory


Hi Guys,

  The patch below changes gcc's makefile so that info files and man
  pages are created in the build tree and not the source tree.  This
  allows these files to be created even if the sources are mounted on
  a read-only partition.  It also updates the install-info target to
  handle an arbitrary set of info files, making it simpler to add new
  files in the future.

  May I apply this patch please ?

Cheers
        Nick

2002-05-31  Nick Clifton  <nickc@cambridge.redhat.com>

	* Makefile.in (docbuilddir): Define.
        (mkdocbuilddir): New target.
        (info): Files created in the build tree.
        (cpp.info, gcc.info, gccint.info, cppinternals.info): Create
        in build tree not source tree.
        (generated-manpages): Files created in build tree.
        (gcov.1, cpp1, gcc.1, gfdl.7, gpl.7, fsf-funding.7): Create in
        build tree not source tree.
        (maintainer-clean): Change location of built info files and
        man pages.
        (install-info): Install from build tree.  Handle an arbitrary
        set of info files.
        (install-man): Install from build tree.

Index: gcc/Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.882
diff -c -3 -p -w -r1.882 Makefile.in
*** gcc/Makefile.in	28 May 2002 17:32:04 -0000	1.882
--- gcc/Makefile.in	31 May 2002 09:24:53 -0000
*************** stmp-fixproto: fixhdr.ready fixproto stm
*** 2300,2314 ****
  # Remake the info files.
  
  docdir = $(srcdir)/doc
  
  doc: $(BUILD_INFO) $(GENERATED_MANPAGES) gccbug
! info: $(docdir)/cpp.info $(docdir)/gcc.info $(docdir)/gccint.info lang.info $(docdir)/cppinternals.info
  
! $(docdir)/cpp.info: $(docdir)/cpp.texi $(docdir)/include/fdl.texi \
!   $(docdir)/cppenv.texi $(docdir)/cppopts.texi
! 	cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/cpp.info doc/cpp.texi
  
! $(docdir)/gcc.info: $(docdir)/gcc.texi $(docdir)/include/gcc-common.texi \
  	 $(docdir)/frontends.texi $(docdir)/standards.texi \
  	 $(docdir)/invoke.texi $(docdir)/extend.texi $(docdir)/md.texi \
  	 $(docdir)/objc.texi $(docdir)/gcov.texi $(docdir)/trouble.texi \
--- 2300,2320 ----
  # Remake the info files.
  
  docdir = $(srcdir)/doc
+ docbuilddir = $(objdir)/doc
+ 
+ .PHONY: mkdocbuilddir
+ 
+ mkdocbuilddir:
+ 	-test -d $(docbuilddir) || mkdir $(docbuilddir)
  
  doc: $(BUILD_INFO) $(GENERATED_MANPAGES) gccbug
! info: $(docbuilddir)/cpp.info $(docbuilddir)/gcc.info $(docbuilddir)/gccint.info lang.info $(docbuilddir)/cppinternals.info
  
! $(docbuilddir)/cpp.info: $(docdir)/cpp.texi $(docdir)/include/fdl.texi \
!   $(docdir)/cppenv.texi $(docdir)/cppopts.texi mkdocbuilddir
! 	cd $(docbuilddir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir) -I $(docdir)/include -o cpp.info $(docdir)/cpp.texi
  
! $(docbuilddir)/gcc.info: $(docdir)/gcc.texi $(docdir)/include/gcc-common.texi \
  	 $(docdir)/frontends.texi $(docdir)/standards.texi \
  	 $(docdir)/invoke.texi $(docdir)/extend.texi $(docdir)/md.texi \
  	 $(docdir)/objc.texi $(docdir)/gcov.texi $(docdir)/trouble.texi \
*************** $(docdir)/gcc.info: $(docdir)/gcc.texi $
*** 2316,2325 ****
  	 $(docdir)/contribute.texi $(docdir)/vms.texi \
  	 $(docdir)/include/funding.texi $(docdir)/gnu.texi \
  	 $(docdir)/include/gpl.texi $(docdir)/include/fdl.texi \
! 	 $(docdir)/contrib.texi $(docdir)/cppenv.texi $(docdir)/cppopts.texi
! 	cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/gcc.info doc/gcc.texi
  
! $(docdir)/gccint.info: $(docdir)/gccint.texi \
  	 $(docdir)/include/gcc-common.texi $(docdir)/contribute.texi \
  	 $(docdir)/makefile.texi $(docdir)/configterms.texi \
  	 $(docdir)/portability.texi $(docdir)/interface.texi \
--- 2322,2332 ----
  	 $(docdir)/contribute.texi $(docdir)/vms.texi \
  	 $(docdir)/include/funding.texi $(docdir)/gnu.texi \
  	 $(docdir)/include/gpl.texi $(docdir)/include/fdl.texi \
! 	 $(docdir)/contrib.texi $(docdir)/cppenv.texi $(docdir)/cppopts.texi \
! 	 mkdocbuilddir
! 	cd $(docbuilddir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir) -I $(docdir)/include -o gcc.info $(docdir)/gcc.texi
  
! $(docbuilddir)/gccint.info: $(docdir)/gccint.texi \
  	 $(docdir)/include/gcc-common.texi $(docdir)/contribute.texi \
  	 $(docdir)/makefile.texi $(docdir)/configterms.texi \
  	 $(docdir)/portability.texi $(docdir)/interface.texi \
*************** $(docdir)/gccint.info: $(docdir)/gccint.
*** 2330,2341 ****
  	 $(docdir)/headerdirs.texi $(docdir)/include/funding.texi \
  	 $(docdir)/gnu.texi $(docdir)/include/gpl.texi \
  	 $(docdir)/include/fdl.texi $(docdir)/contrib.texi \
! 	 $(docdir)/languages.texi $(docdir)/sourcebuild.texi
! 	cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/gccint.info doc/gccint.texi
! 
! $(docdir)/cppinternals.info: $(docdir)/cppinternals.texi
! 	cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I doc -I doc/include -o doc/cppinternals.info \
! 		doc/cppinternals.texi
  
  dvi: gcc.dvi gccint.dvi cpp.dvi lang.dvi cppinternals.dvi
  
--- 2337,2349 ----
  	 $(docdir)/headerdirs.texi $(docdir)/include/funding.texi \
  	 $(docdir)/gnu.texi $(docdir)/include/gpl.texi \
  	 $(docdir)/include/fdl.texi $(docdir)/contrib.texi \
! 	 $(docdir)/languages.texi $(docdir)/sourcebuild.texi \
! 	 mkdocbuilddir
! 	cd $(docbuilddir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir) -I $(docdir)/include -o gccint.info $(docdir)/gccint.texi
! 
! $(docbuilddir)/cppinternals.info: $(docdir)/cppinternals.texi
! 	cd $(docbuilddir) && $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir) -I $(docdir)/include -o cppinternals.info \
! 		$(docdir)/cppinternals.texi
  
  dvi: gcc.dvi gccint.dvi cpp.dvi lang.dvi cppinternals.dvi
  
*************** gccint.dvi: $(docdir)/gccint.texi \
*** 2372,2430 ****
  cppinternals.dvi: $(docdir)/cppinternals.texi
  	$(TEXI2DVI) -I $(docdir) -I $(docdir)/include $(docdir)/cppinternals.texi
  
! generated-manpages: $(docdir)/gcov.1 $(docdir)/cpp.1 $(docdir)/gcc.1 \
! 	 $(docdir)/gfdl.7 $(docdir)/gpl.7 $(docdir)/fsf-funding.7 \
! 	 lang.generated-manpages
  
! $(docdir)/gcov.1: $(docdir)/gcov.texi
! 	$(STAMP) $(docdir)/gcov.1
  	-$(TEXI2POD) $(docdir)/gcov.texi > gcov.pod
! 	-($(POD2MAN) --section=1 gcov.pod > $(docdir)/gcov.1.T$$$$ && \
! 		mv -f $(docdir)/gcov.1.T$$$$ $(docdir)/gcov.1) || \
! 		(rm -f $(docdir)/gcov.1.T$$$$ && exit 1)
  	-rm -f gcov.pod
  
! $(docdir)/cpp.1: $(docdir)/cpp.texi $(docdir)/cppenv.texi \
    $(docdir)/cppopts.texi
! 	$(STAMP) $(docdir)/cpp.1
  	-$(TEXI2POD) $(docdir)/cpp.texi > cpp.pod
! 	-($(POD2MAN) --section=1 cpp.pod > $(docdir)/cpp.1.T$$$$ && \
! 		mv -f $(docdir)/cpp.1.T$$$$ $(docdir)/cpp.1) || \
! 		(rm -f $(docdir)/cpp.1.T$$$$ && exit 1)
  	-rm -f cpp.pod
  
! $(docdir)/gcc.1: $(docdir)/invoke.texi $(docdir)/cppenv.texi \
    $(docdir)/cppopts.texi
! 	$(STAMP) $(docdir)/gcc.1
  	-$(TEXI2POD) $(docdir)/invoke.texi > gcc.pod
! 	-($(POD2MAN) --section=1 gcc.pod > $(docdir)/gcc.1.T$$$$ && \
! 		mv -f $(docdir)/gcc.1.T$$$$ $(docdir)/gcc.1) || \
! 		(rm -f $(docdir)/gcc.1.T$$$$ && exit 1)
  	-rm -f gcc.pod
  
! $(docdir)/gfdl.7: $(docdir)/include/fdl.texi
! 	$(STAMP) $(docdir)/gfdl.7
  	-$(TEXI2POD) $(docdir)/include/fdl.texi > gfdl.pod
! 	-($(POD2MAN) --section=7 gfdl.pod > $(docdir)/gfdl.7.T$$$$ && \
! 		mv -f $(docdir)/gfdl.7.T$$$$ $(docdir)/gfdl.7) || \
! 		(rm -f $(docdir)/gfdl.7.T$$$$ && exit 1)
  	-rm -f gfdl.pod
  
! $(docdir)/gpl.7: $(docdir)/include/gpl.texi
! 	$(STAMP) $(docdir)/gpl.7
  	-$(TEXI2POD) $(docdir)/include/gpl.texi > gpl.pod
! 	-($(POD2MAN) --section=7 gpl.pod > $(docdir)/gpl.7.T$$$$ && \
! 		mv -f $(docdir)/gpl.7.T$$$$ $(docdir)/gpl.7) || \
! 		(rm -f $(docdir)/gpl.7.T$$$$ && exit 1)
  	-rm -f gpl.pod
  
! $(docdir)/fsf-funding.7: $(docdir)/include/funding.texi
! 	$(STAMP) $(docdir)/fsf-funding.7
  	-$(TEXI2POD) $(docdir)/include/funding.texi > fsf-funding.pod
  	-($(POD2MAN) --section=7 fsf-funding.pod \
! 		> $(docdir)/fsf-funding.7.T$$$$ && \
! 	    mv -f $(docdir)/fsf-funding.7.T$$$$ $(docdir)/fsf-funding.7) || \
! 	    (rm -f $(docdir)/fsf-funding.7.T$$$$ && exit 1)
  	-rm -f fsf-funding.pod
  
  #
--- 2380,2438 ----
  cppinternals.dvi: $(docdir)/cppinternals.texi
  	$(TEXI2DVI) -I $(docdir) -I $(docdir)/include $(docdir)/cppinternals.texi
  
! generated-manpages: $(docbuilddir)/gcov.1 $(docbuilddir)/cpp.1 \
! 	 $(docbuilddir)/gcc.1 $(docbuilddir)/gfdl.7 $(docbuilddir)/gpl.7 \
! 	 $(docbuilddir)/fsf-funding.7 lang.generated-manpages
  
! $(docbuilddir)/gcov.1: $(docdir)/gcov.texi
! 	$(STAMP) $(docbuilddir)/gcov.1
  	-$(TEXI2POD) $(docdir)/gcov.texi > gcov.pod
! 	-($(POD2MAN) --section=1 gcov.pod > $(docbuilddir)/gcov.1.T$$$$ && \
! 		mv -f $(docbuilddir)/gcov.1.T$$$$ $(docbuilddir)/gcov.1) || \
! 		(rm -f $(docbuilddir)/gcov.1.T$$$$ && exit 1)
  	-rm -f gcov.pod
  
! $(docbuilddir)/cpp.1: $(docdir)/cpp.texi $(docdir)/cppenv.texi \
    $(docdir)/cppopts.texi
! 	$(STAMP) $(docbuilddir)/cpp.1
  	-$(TEXI2POD) $(docdir)/cpp.texi > cpp.pod
! 	-($(POD2MAN) --section=1 cpp.pod > $(docbuilddir)/cpp.1.T$$$$ && \
! 		mv -f $(docbuilddir)/cpp.1.T$$$$ $(docbuilddir)/cpp.1) || \
! 		(rm -f $(docbuilddir)/cpp.1.T$$$$ && exit 1)
  	-rm -f cpp.pod
  
! $(docbuilddir)/gcc.1: $(docdir)/invoke.texi $(docdir)/cppenv.texi \
    $(docdir)/cppopts.texi
! 	$(STAMP) $(docbuilddir)/gcc.1
  	-$(TEXI2POD) $(docdir)/invoke.texi > gcc.pod
! 	-($(POD2MAN) --section=1 gcc.pod > $(docbuilddir)/gcc.1.T$$$$ && \
! 		mv -f $(docbuilddir)/gcc.1.T$$$$ $(docbuilddir)/gcc.1) || \
! 		(rm -f $(docbuilddir)/gcc.1.T$$$$ && exit 1)
  	-rm -f gcc.pod
  
! $(docbuilddir)/gfdl.7: $(docdir)/include/fdl.texi
! 	$(STAMP) $(docbuilddir)/gfdl.7
  	-$(TEXI2POD) $(docdir)/include/fdl.texi > gfdl.pod
! 	-($(POD2MAN) --section=7 gfdl.pod > $(docbuilddir)/gfdl.7.T$$$$ && \
! 		mv -f $(docbuilddir)/gfdl.7.T$$$$ $(docbuilddir)/gfdl.7) || \
! 		(rm -f $(docbuilddir)/gfdl.7.T$$$$ && exit 1)
  	-rm -f gfdl.pod
  
! $(docbuilddir)/gpl.7: $(docdir)/include/gpl.texi
! 	$(STAMP) $(docbuilddir)/gpl.7
  	-$(TEXI2POD) $(docdir)/include/gpl.texi > gpl.pod
! 	-($(POD2MAN) --section=7 gpl.pod > $(docbuilddir)/gpl.7.T$$$$ && \
! 		mv -f $(docbuilddir)/gpl.7.T$$$$ $(docbuilddir)/gpl.7) || \
! 		(rm -f $(docbuilddir)/gpl.7.T$$$$ && exit 1)
  	-rm -f gpl.pod
  
! $(docbuilddir)/fsf-funding.7: $(docdir)/include/funding.texi
! 	$(STAMP) $(docbuilddir)/fsf-funding.7
  	-$(TEXI2POD) $(docdir)/include/funding.texi > fsf-funding.pod
  	-($(POD2MAN) --section=7 fsf-funding.pod \
! 		> $(docbuilddir)/fsf-funding.7.T$$$$ && \
! 	    mv -f $(docbuilddir)/fsf-funding.7.T$$$$ $(docbuilddir)/fsf-funding.7) || \
! 	    (rm -f $(docbuilddir)/fsf-funding.7.T$$$$ && exit 1)
  	-rm -f fsf-funding.pod
  
  #
*************** maintainer-clean:
*** 2555,2564 ****
  	-rm -f c-parse.y c-parse.c c-parse.output TAGS
  	-rm -f cpp.??s cpp.*aux
  	-rm -f gcc.??s gcc.*aux
! 	-rm -f $(docdir)/cpp.info* $(docdir)/gcc.info* $(docdir)/gccint.info*
! 	-rm -f $(docdir)/cppinternals.info*
! 	-rm -f $(docdir)/gcov.1 $(docdir)/cpp.1 $(docdir)/gcc.1
! 	-rm -f $(docdir)/fsf-funding.7 $(docdir)/gfdl.7 $(docdir)/gpl.7
  #
  # Entry points `install' and `uninstall'.
  # Also use `install-collect2' to install collect2 when the config files don't.
--- 2563,2571 ----
  	-rm -f c-parse.y c-parse.c c-parse.output TAGS
  	-rm -f cpp.??s cpp.*aux
  	-rm -f gcc.??s gcc.*aux
! 	-rm -f $(docbuilddir)/cpp.info* $(docbuilddir)/gcc.info* $(docbuilddir)/gccint.info*
! 	-rm -f $(docbuilddir)/cppinternals.info*
! 	-rm -f $(generated-manpages)
  #
  # Entry points `install' and `uninstall'.
  # Also use `install-collect2' to install collect2 when the config files don't.
*************** install-driver: installdirs xgcc$(exeext
*** 2698,2749 ****
  # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
  # to do the install.
  install-info: doc installdirs lang.install-info
! 	-rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
! 	-rm -f $(infodir)/cppinternals.info* $(infodir)/gccint.info*
! 	if [ -f $(docdir)/gcc.info ]; then \
! 	  for f in $(docdir)/cpp.info* $(docdir)/gcc.info* \
! 		$(docdir)/cppinternals.info* $(docdir)/gccint.info*; do \
  	    realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
  	    $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
! 	  done; \
! 	else true; fi
  	-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
  	  if [ -f $(infodir)/dir ] ; then \
! 	    for f in cpp.info gcc.info gccint.info cppinternals.info; do \
  		if [ -f $(infodir)/$$f ]; then \
  		  install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \
  		else true; fi; \
  	    done; \
  	  else true; fi; \
  	else true; fi;
! 	-chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
! 	-chmod a-x $(infodir)/cppinternals.info* $(infodir)/gccint.info*
  
  # Install the man pages.
  install-man: installdirs $(GENERATED_MANPAGES) lang.install-man
  	-if [ -f gcc-cross$(exeext) ] ; then \
  	  rm -f $(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \
! 	  $(INSTALL_DATA) $(docdir)/gcc.1 $(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \
  	  chmod a-x $(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \
  	else \
  	  rm -f $(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \
! 	  $(INSTALL_DATA) $(docdir)/gcc.1 $(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \
  	  chmod a-x $(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \
  	fi
  	-rm -f $(man1dir)/cpp$(man1ext)
! 	-$(INSTALL_DATA) $(docdir)/cpp.1 $(man1dir)/cpp$(man1ext)
  	-chmod a-x $(man1dir)/cpp$(man1ext)
  	-rm -f $(man1dir)/gcov$(man1ext)
! 	-$(INSTALL_DATA) $(docdir)/gcov.1 $(man1dir)/gcov$(man1ext)
  	-chmod a-x $(man1dir)/gcov$(man1ext)
  	-rm -f $(man7dir)/fsf-funding$(man7ext)
! 	-$(INSTALL_DATA) $(docdir)/fsf-funding.7 $(man7dir)/fsf-funding$(man7ext)
  	-chmod a-x $(man7dir)/fsf-funding$(man7ext)
  	-rm -f $(man7dir)/gfdl$(man7ext)
! 	-$(INSTALL_DATA) $(docdir)/gfdl.7 $(man7dir)/gfdl$(man7ext)
  	-chmod a-x $(man7dir)/gfdl$(man7ext)
  	-rm -f $(man7dir)/gpl$(man7ext)
! 	-$(INSTALL_DATA) $(docdir)/gpl.7 $(man7dir)/gpl$(man7ext)
  	-chmod a-x $(man7dir)/gpl$(man7ext)
  
  # Install the library.
--- 2705,2751 ----
  # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
  # to do the install.
  install-info: doc installdirs lang.install-info
! 	-for f in $(docbuilddir)/*.info*; do \
! 	  rm -f $(infodir)/$$f; \
  	  realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
  	  $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
! 	done
  	-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
  	  if [ -f $(infodir)/dir ] ; then \
! 	    for f in $(docbuilddir)/*.info; do \
  		if [ -f $(infodir)/$$f ]; then \
  		  install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \
  		else true; fi; \
  	    done; \
  	  else true; fi; \
  	else true; fi;
! 	-chmod a-x $(infodir)/*.info*
  
  # Install the man pages.
  install-man: installdirs $(GENERATED_MANPAGES) lang.install-man
  	-if [ -f gcc-cross$(exeext) ] ; then \
  	  rm -f $(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \
! 	  $(INSTALL_DATA) $(docbuilddir)/gcc.1 $(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \
  	  chmod a-x $(man1dir)/$(GCC_CROSS_NAME)$(man1ext); \
  	else \
  	  rm -f $(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \
! 	  $(INSTALL_DATA) $(docbuilddir)/gcc.1 $(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \
  	  chmod a-x $(man1dir)/$(GCC_INSTALL_NAME)$(man1ext); \
  	fi
  	-rm -f $(man1dir)/cpp$(man1ext)
! 	-$(INSTALL_DATA) $(docbuilddir)/cpp.1 $(man1dir)/cpp$(man1ext)
  	-chmod a-x $(man1dir)/cpp$(man1ext)
  	-rm -f $(man1dir)/gcov$(man1ext)
! 	-$(INSTALL_DATA) $(docbuilddir)/gcov.1 $(man1dir)/gcov$(man1ext)
  	-chmod a-x $(man1dir)/gcov$(man1ext)
  	-rm -f $(man7dir)/fsf-funding$(man7ext)
! 	-$(INSTALL_DATA) $(docbuilddir)/fsf-funding.7 $(man7dir)/fsf-funding$(man7ext)
  	-chmod a-x $(man7dir)/fsf-funding$(man7ext)
  	-rm -f $(man7dir)/gfdl$(man7ext)
! 	-$(INSTALL_DATA) $(docbuilddir)/gfdl.7 $(man7dir)/gfdl$(man7ext)
  	-chmod a-x $(man7dir)/gfdl$(man7ext)
  	-rm -f $(man7dir)/gpl$(man7ext)
! 	-$(INSTALL_DATA) $(docbuilddir)/gpl.7 $(man7dir)/gpl$(man7ext)
  	-chmod a-x $(man7dir)/gpl$(man7ext)
  
  # Install the library.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]