1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
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)
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.
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
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
29 $(@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -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 @-tr '\\ ' '\n\n' < .deps/$(*F).p \
37 ## The very first nondeleted line is always the primary source file.
38 ## No need for that, so we remove it too via `1d'.
39 | sed -e '/^$$/ d' -e '/:$$/ d' -e 1d -e 's/$$/:/' > .deps/$(*F).P; \
43 @echo '$(LT@PFX@COMPILE) -c $<'; \
44 ## See above to understand implementation weirdness.
45 $(LT@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -c $<
46 @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
47 < .deps/$(*F).p > .deps/$(*F).P; \
48 ## See above to understand deleted header file trick.
49 tr '\\ ' '\n\n' < .deps/$(*F).p \
50 ## The very first nondeleted line is always the primary source file.
51 ## No need for that, so we remove it too via `1d'.
52 | sed -e '/^$$/ d' -e '/:$$/ d' -e 1d -e 's/$$/:/' \
53 ## Note subtle difference: here we append to the .P file.