Edit

kc3-lang/automake/lib/am/depend2.am

Branch :

  • Show log

    Commit

  • Author : Tom Tromey
    Date : 1999-01-06 12:41:34
    Hash : dd97b9db
    Message : * depend2.am (%.o): Use \012, not \n, to avoid losing `tr's. From Bill Currie. (%.lo): Likewise.

  • lib/am/depend2.am
  • ## automake - create Makefile.in from Makefile.am
    ## Copyright (C) 1994-1998, 1999 Free Software Foundation, Inc.
    
    ## This program is free software; you can redistribute it and/or modify
    ## it under the terms of the GNU General Public License as published by
    ## the Free Software Foundation; either version 2, or (at your option)
    ## any later version.
    
    ## This program is distributed in the hope that it will be useful,
    ## but WITHOUT ANY WARRANTY; without even the implied warranty of
    ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ## GNU General Public License for more details.
    
    ## You should have received a copy of the GNU General Public License
    ## along with this program; if not, write to the Free Software
    ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    ## 02111-1307, USA.
    %.o: %@EXT@
    	@echo '$(@PFX@COMPILE) -c $<'; \
    ## There are various ways to get dependency output from gcc.  Here's
    ## why we pick this rather obscure method:
    ## - Don't want to use -MD because we'd like the dependencies to end
    ##   up in a subdir.  Having to rename by hand is ugly.
    ##   (We might end up doing this anyway to support other compilers.)
    ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
    ##   -MM, not -M (despite what the docs say).
    ## - Using -M directly means running the compiler twice (even worse
    ##   than renaming).
    	$(@PFX@COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
    ## This next piece of magic avoids the `deleted header file' problem.
    ## The problem is that when a header file which appears in a .P file
    ## is deleted, the dependency causes make to die (because there is
    ## typically no way to rebuild the header).  We avoid this by adding
    ## dummy dependencies for each header file.  Too bad gcc doesn't do
    ## this for us directly.
    	@-cp .deps/$(*F).pp .deps/$(*F).P; \
    	tr ' ' '\012' < .deps/$(*F).pp \
    ## Some versions of gcc put a space before the `:'.  On the theory
    ## that the space means something, we add a space to the output as
    ## well.
    	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
    	    >> .deps/$(*F).P; \
    	rm .deps/$(*F).pp
    
    %.lo: %@EXT@
    	@echo '$(LT@PFX@COMPILE) -c $<'; \
    ## See above to understand implementation weirdness.
    	$(LT@PFX@COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
    ## Account for versions of gcc that put a space before the `:'.
    	@-sed -e 's/^\([^:]*\)\.o[ 	]*:/\1.lo \1.o :/' \
    	  < .deps/$(*F).pp > .deps/$(*F).P; \
    ## See above to understand deleted header file trick.
    	tr ' ' '\012' < .deps/$(*F).pp \
    ## Some versions of gcc put a space before the `:'.  On the theory
    ## that the space means something, we add a space to the output as
    ## well.
    	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
    	    >> .deps/$(*F).P; \
    	rm -f .deps/$(*F).pp