* automake.texi: Document LIBOBJS trick.
[platform/upstream/automake.git] / depend2.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996, 1997, 1998 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).P -c $<
30
31 %.lo: %@EXT@
32         @echo '$(LT@PFX@COMPILE) -c $<'; \
33 ## See above to understand implementation weirdness.
34         $(LT@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -c $<
35         @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
36           < .deps/$(*F).p > .deps/$(*F).P
37         @-rm -f .deps/$(*F).p