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