Thu Feb 12 22:27:05 1998 Tom Tromey <tromey@cygnus.com>
+ * automake.in (get_object_extension): Conditionally include .c.o
+ rule from compile.am.
+ (handle_dependencies): Generate correct code when including new
+ depend2.am.
+ (file_contents_with_transform): Better error reporting.
+ * depend.am (MKDEP): Removed.
+ (.deps/.P): Removed. Don't include .deps/.P.
+ * compile.am (.c.o): Now conditional on dependencies not being
+ generated by compiles.
+ * depend2.am (%.o): New rule.
+ (.deps/%.P): Removed.
+
* tags.am (TAGS): Uniquify list of files. From Harlan Stenn.
* aclocal.in (scan_m4_files): Reverse-sort keys when constructing
done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$i] = 1; } \
- END { for (i in files) print $$i; }'`; \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
* aclocal gives error if `AM_' macro not found
* Passed YFLAGS, not YACCFLAGS, to yacc
* AM_PROG_CC_STDC does not have to come before AC_PROG_CPP
+* Dependencies computed as a side effect of compilation
\f
New in 1.2:
* Bug fixes
$xform = 's/\@CONFIG_INCLUDE_SPEC\@/' . $xform . '/go;';
$output_vars .= &file_contents_with_transform ($xform,
'comp-vars');
- $output_rules .= &file_contents ('compile');
+ $output_rules .=
+ &file_contents_with_transform
+ ($use_dependencies ? 's/^NOTDEPEND.*$//;' : 's/^NOTDEPEND//;',
+ 'compile');
+
&push_phony_cleaners ('compile');
# If using X, include some extra variable definitions. NOTE
$output_rules .= &file_contents ('depend');
push (@clean, 'depend');
&push_phony_cleaners ('depend');
+ # FIXME: should use @EXT@ and @PFX@. I don't know why it
+ # didn't work.
$output_rules .=
- &file_contents_with_transform ('s/\@EXT\@/.c/g;'
- . 's/\@MKDEP\@/MKDEP/g;'
- . 's/^ONLYC//g;',
+ &file_contents_with_transform ('s/EXT/.c/g;'
+ . 's/PFX//g;',
'depend2');
local ($ext);
local ($need_cxx) = 0;
foreach $ext (sort keys %cxx_extensions)
{
+ # FIXME: should use @EXT@ and @PFX@. I don't know why
+ # it didn't work.
$output_rules .=
- &file_contents_with_transform ('s/\@EXT\@/' . $ext .'/g;'
- . 's/\@MKDEP\@/CXXMKDEP/g;'
- . 's/^ONLYC.*$//;',
+ &file_contents_with_transform ('s/EXT/' . $ext .'/g;'
+ . 's/PFX/CXX/g;',
'depend2');
$need_cxx = 1;
}
if ($command ne '' && substr ($command, -1) ne ';')
{
- die "automake: programming error in file_contents_with_transform\n";
+ die "automake: programming error in file_contents_with_transform: $command\n";
}
open (FC_FILE, $file)
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1998 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
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-.c.o:
- $(COMPILE) -c $<
+NOTDEPEND.c.o:
+NOTDEPEND $(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
## on GNU make and gcc. It is only included in the generated
## Makefile.in if `automake' is not passed the `--include-deps' flag.
-## We have to use $(CC), not `gcc', even though we do rely on gcc to
-## do dependency tracking. We have to do this because `gcc' is not
-## the real name of the compiler when cross-compiling.
-MKDEP = $(CC) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-
## We must create the .deps directory if it doesn't exist. We do it
## in this strange way because of a buglet in make -- it won't try to
## create .deps/.P if the .deps directory doesn't exist.
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-## We use ".P" as the name of our placeholder because it can't be
-## duplicated by any C source file. (Well, there could be ".c", but
-## no one does that in practice)
--include .deps/.P
-## This depends on $(BUILT_SOURCES) because that lets us generate
-## dependencies for files that don't exist at the start of a fresh
-## build.
-.deps/.P: $(BUILT_SOURCES)
-## Use ":" here and not "echo timestamp". Otherwise GNU Make barfs:
-## .deps/.P:1: *** missing separator. Stop.
-## Actually, use a plain "echo" and not ":". Why? From the Autoconf
-## manual, node Automatic Remaking:
-## On some old BSD systems, `touch' or any command that results in an
-## empty file does not update the timestamps, so use a command like
-## `echo' as a workaround.
- echo > $@
-include $(DEP_FILES)
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1997, 1998 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
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-.deps/%.P: %@EXT@
- @echo "Computing dependencies for $<..."
- @o='o'; \
-ONLYC test -n "$o" && o='$$o'; \
- $(@MKDEP@) $< >$@.tmp \
- && sed "s,^\(.*\)\.o:,\1.$$o \1.l$$o $@:," < $@.tmp > $@ \
- && rm -f $@.tmp
+## FIXME: should use @EXT@, but that didn't work.
+%.o: %EXT
+## FIXME: should use @PFX@, but that didn't work.
+ @echo '$(PFXCOMPILE) -c $<'; \
+ DEPENDENCIES_OUTPUT='.deps/$(*F).P'; \
+ export DEPENDENCIES_OUTPUT; \
+## Note that using DEPENDENCIES_OUTPUT causes gcc to append to the
+## named file. So we truncate it explicitly.
+ : > .deps/$(*F).P; \
+## FIXME: should use @PFX@, but that didn't work.
+ $(PFXCOMPILE) -c $<
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1998 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
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-.c.o:
- $(COMPILE) -c $<
+NOTDEPEND.c.o:
+NOTDEPEND $(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
## on GNU make and gcc. It is only included in the generated
## Makefile.in if `automake' is not passed the `--include-deps' flag.
-## We have to use $(CC), not `gcc', even though we do rely on gcc to
-## do dependency tracking. We have to do this because `gcc' is not
-## the real name of the compiler when cross-compiling.
-MKDEP = $(CC) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-
## We must create the .deps directory if it doesn't exist. We do it
## in this strange way because of a buglet in make -- it won't try to
## create .deps/.P if the .deps directory doesn't exist.
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-## We use ".P" as the name of our placeholder because it can't be
-## duplicated by any C source file. (Well, there could be ".c", but
-## no one does that in practice)
--include .deps/.P
-## This depends on $(BUILT_SOURCES) because that lets us generate
-## dependencies for files that don't exist at the start of a fresh
-## build.
-.deps/.P: $(BUILT_SOURCES)
-## Use ":" here and not "echo timestamp". Otherwise GNU Make barfs:
-## .deps/.P:1: *** missing separator. Stop.
-## Actually, use a plain "echo" and not ":". Why? From the Autoconf
-## manual, node Automatic Remaking:
-## On some old BSD systems, `touch' or any command that results in an
-## empty file does not update the timestamps, so use a command like
-## `echo' as a workaround.
- echo > $@
-include $(DEP_FILES)
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1997, 1998 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
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-.deps/%.P: %@EXT@
- @echo "Computing dependencies for $<..."
- @o='o'; \
-ONLYC test -n "$o" && o='$$o'; \
- $(@MKDEP@) $< >$@.tmp \
- && sed "s,^\(.*\)\.o:,\1.$$o \1.l$$o $@:," < $@.tmp > $@ \
- && rm -f $@.tmp
+## FIXME: should use @EXT@, but that didn't work.
+%.o: %EXT
+## FIXME: should use @PFX@, but that didn't work.
+ @echo '$(PFXCOMPILE) -c $<'; \
+ DEPENDENCIES_OUTPUT='.deps/$(*F).P'; \
+ export DEPENDENCIES_OUTPUT; \
+## Note that using DEPENDENCIES_OUTPUT causes gcc to append to the
+## named file. So we truncate it explicitly.
+ : > .deps/$(*F).P; \
+## FIXME: should use @PFX@, but that didn't work.
+ $(PFXCOMPILE) -c $<