aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-01-05 07:50:24 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-01-05 07:50:24 +0000
commita5a4ce3c3c0eee620f62210898d661a3b05f283a (patch)
tree4a7fde9382b70c566caa911a671a363b63d0df58 /gcc
parent97fc4caf7d18cd4aaa2a31a55c68b4a4ec7deb36 (diff)
downloadgcc-a5a4ce3c3c0eee620f62210898d661a3b05f283a.zip
gcc-a5a4ce3c3c0eee620f62210898d661a3b05f283a.tar.gz
gcc-a5a4ce3c3c0eee620f62210898d661a3b05f283a.tar.bz2
cpp.texi: Update for -MP.
* cpp.texi: Update for -MP. Clarify behaviour of -MT. * cppinit.c (initialize_dependency_output): Update. (cpp_finish): Output dummy targets for -MP. (OPT_MP): New. (cpp_handle_option): Handle -MP. Don't quote -MT options. * cpplib.h (struct cpp_options): Add deps_phony_targets. * gcc.c (cpp_options): Update to handle -MP. * mkdeps.c (deps_add_target, deps_add_default_target): Update to quote only the default target. (deps_phony_targets): Insert a preceding newline. Rename from deps_dummy_targets for consistency. * mkdeps.h: Update java: * lang.c (lang_decode_option): Change -MA to -MP. * jcf-depend.c (jcf_dependency_add_target, jcf_dependency_set_target): Update to new prototype; do quote targets. (jcf_dependency_write): Update. From-SVN: r38707
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/cpp.texi30
-rw-r--r--gcc/cppinit.c14
-rw-r--r--gcc/cpplib.h5
-rw-r--r--gcc/gcc.c2
-rw-r--r--gcc/java/ChangeLog7
-rw-r--r--gcc/java/jcf-depend.c8
-rw-r--r--gcc/java/lang.c5
-rw-r--r--gcc/mkdeps.c25
-rw-r--r--gcc/mkdeps.h7
10 files changed, 93 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 77a7f79b..d06ad0a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2001-01-05 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cpp.texi: Update for -MP. Clarify behaviour of -MT.
+ * cppinit.c (initialize_dependency_output): Update.
+ (cpp_finish): Output dummy targets for -MP.
+ (OPT_MP): New.
+ (cpp_handle_option): Handle -MP. Don't quote -MT options.
+ * cpplib.h (struct cpp_options): Add deps_phony_targets.
+ * gcc.c (cpp_options): Update to handle -MP.
+ * mkdeps.c (deps_add_target, deps_add_default_target): Update
+ to quote only the default target.
+ (deps_phony_targets): Insert a preceding newline. Rename from
+ deps_dummy_targets for consistency.
+ * mkdeps.h: Update
+
2001-01-05 Alexandre Oliva <aoliva@redhat.com>
* calls.c (emit_library_call_value_1): Support
diff --git a/gcc/cpp.texi b/gcc/cpp.texi
index db7f86b..7df4531 100644
--- a/gcc/cpp.texi
+++ b/gcc/cpp.texi
@@ -3476,14 +3476,38 @@ files into a single dependency file suitable for using with the
Like @samp{-MD} except mention only user header files, not system
header files.
+@item -MP
+@findex -MP
+This option instructs CPP to add a phony target for each dependency
+other than the main file, causing each to depend on nothing. These
+dummy rules work around errors MAKE gives if you remove header files
+without updating the Makefile to match.
+
+This is typical output:-
+
+@smallexample
+/tmp/test.o: /tmp/test.c /tmp/test.h
+
+/tmp/test.h:
+@end smallexample
+
@item -MT @var{target}
@findex -MT
By default CPP uses the base file name and appends the object suffix,
normally ``.o'', to it to obtain the name of the target for dependency
-generation. With @samp{-MT} you can specify one or more of your own
-targets; doing so overrides the default.
+generation. With @samp{-MT} you can specify a target yourself,
+overriding the default one.
+
+If you want multiple targets, you can specify them as a single argument
+to @samp{-MT}, or use multiple @samp{-MT} options.
+
+The targets you specify are output in the order they appear on the
+command line, and, unlike the default target, are not quoted for MAKE.
+This allows you to do things like, for example,
-The targets are output in the order they appear on the command line.
+@smallexample
+-MT '$(objpfx)foo.o $(objpfx)foo.os $(objpfx)foo.op'
+@end smallexample
@item -H
@findex -H
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index de00b2f..310fc04 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -760,7 +760,8 @@ initialize_dependency_output (pfile)
s = strchr (spec, ' ');
if (s)
{
- deps_add_target (pfile->deps, s + 1);
+ /* Let the caller perform MAKE quoting. */
+ deps_add_target (pfile->deps, s + 1, 0);
output_file = (char *) xmalloc (s - spec + 1);
memcpy (output_file, spec, s - spec);
output_file[s - spec] = 0;
@@ -1018,6 +1019,10 @@ cpp_finish (pfile)
if (deps_stream)
{
deps_write (pfile->deps, deps_stream, 72);
+
+ if (CPP_OPTION (pfile, deps_phony_targets))
+ deps_phony_targets (pfile->deps, deps_stream);
+
if (CPP_OPTION (pfile, deps_file))
{
if (ferror (deps_stream) || fclose (deps_stream) != 0)
@@ -1077,6 +1082,7 @@ new_pending_directive (pend, text, handler)
DEF_OPT("MG", 0, OPT_MG) \
DEF_OPT("MM", 0, OPT_MM) \
DEF_OPT("MMD", no_fil, OPT_MMD) \
+ DEF_OPT("MP", 0, OPT_MP) \
DEF_OPT("MT", no_tgt, OPT_MT) \
DEF_OPT("P", 0, OPT_P) \
DEF_OPT("U", no_mac, OPT_U) \
@@ -1496,11 +1502,15 @@ cpp_handle_option (pfile, argc, argv)
CPP_OPTION (pfile, no_output) = 1;
break;
+ case OPT_MP:
+ CPP_OPTION (pfile, deps_phony_targets) = 1;
+ break;
+
case OPT_MT:
/* Add a target. */
if (! pfile->deps)
pfile->deps = deps_init ();
- deps_add_target (pfile->deps, arg);
+ deps_add_target (pfile->deps, arg, 0);
break;
case OPT_A:
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 98e8e1b..c2049d7 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -329,6 +329,9 @@ struct cpp_options
#include <...> as well. */
unsigned char print_deps;
+ /* Nonzero if phony targets are created for each header. */
+ unsigned char deps_phony_targets;
+
/* Nonzero if missing .h files in -M output are assumed to be
generated files and not errors. */
unsigned char print_deps_missing_files;
@@ -570,7 +573,7 @@ struct cpp_reader
cpp_token date;
cpp_token time;
- /* Buffer of -M output. */
+ /* Opaque handle to the dependencies of mkdeps.c. Used by -M etc. */
struct deps *deps;
/* Obstack holding all macro hash nodes. This never shrinks.
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 53c7ba2..b33cacc 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -584,7 +584,7 @@ static const char *cpp_options =
"%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{std*} %{nostdinc*}\
%{C} %{v} %{I*} %{P} %{$} %I\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{MT}\
+ %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{MP} %{MT}\
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index c52b529..0b8306b 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,10 @@
+2001-01-04 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * lang.c (lang_decode_option): Change -MA to -MP.
+ * jcf-depend.c (jcf_dependency_add_target, jcf_dependency_set_target):
+ Update to new prototype; do quote targets.
+ (jcf_dependency_write): Update.
+
2000-12-22 Bryce McKinlay <bryce@albatross.co.nz>
Shorten primitive array allocation path:
diff --git a/gcc/java/jcf-depend.c b/gcc/java/jcf-depend.c
index 501e239..c999560 100644
--- a/gcc/java/jcf-depend.c
+++ b/gcc/java/jcf-depend.c
@@ -1,6 +1,6 @@
/* Functions for handling dependency tracking when reading .class files.
- Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001 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
@@ -74,7 +74,7 @@ jcf_dependency_set_target (name)
{
/* We just handle this the same as an `add_target'. */
if (dependencies != NULL && name != NULL)
- deps_add_target (dependencies, name);
+ deps_add_target (dependencies, name, 1);
}
void
@@ -82,7 +82,7 @@ jcf_dependency_add_target (name)
const char *name;
{
if (dependencies != NULL)
- deps_add_target (dependencies, name);
+ deps_add_target (dependencies, name, 1);
}
void
@@ -138,6 +138,6 @@ jcf_dependency_write ()
deps_write (dependencies, dep_out, 72);
if (print_dummies)
- deps_dummy_targets (dependencies, dep_out);
+ deps_phony_targets (dependencies, dep_out);
fflush (dep_out);
}
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index b90abdb..7565eba9 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -1,5 +1,6 @@
/* Java(TM) language-specific utility routines.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -340,7 +341,7 @@ lang_decode_option (argc, argv)
dependency_tracking |= DEPEND_ENABLE;
return 1;
}
- else if (strcmp (p, "-MA") == 0)
+ else if (strcmp (p, "-MP") == 0)
{
jcf_dependency_print_dummies ();
return 1;
diff --git a/gcc/mkdeps.c b/gcc/mkdeps.c
index 8d3e0bf..f83d82f 100644
--- a/gcc/mkdeps.c
+++ b/gcc/mkdeps.c
@@ -73,8 +73,7 @@ munge (filename)
break;
case '$':
- /* '$' is quoted by doubling it. This can mishandle things
- like "$(" but there's no easy fix. */
+ /* '$' is quoted by doubling it. */
len++;
break;
}
@@ -172,13 +171,14 @@ deps_free (d)
free (d);
}
+/* Adds a target T. We make a copy, so it need not be a permanent
+ string. QUOTE is true if the string should be quoted. */
void
-deps_add_target (d, t)
+deps_add_target (d, t, quote)
struct deps *d;
const char *t;
+ int quote;
{
- t = munge (t); /* Also makes permanent copy. */
-
if (d->ntargets == d->targets_size)
{
d->targets_size *= 2;
@@ -186,11 +186,17 @@ deps_add_target (d, t)
d->targets_size * sizeof (const char *));
}
+ if (quote)
+ t = munge (t); /* Also makes permanent copy. */
+ else
+ t = xstrdup (t);
+
d->targetv[d->ntargets++] = t;
}
/* Sets the default target if none has been given already. An empty
- string as the default target in interpreted as stdin. */
+ string as the default target in interpreted as stdin. The string
+ is quoted for MAKE. */
void
deps_add_default_target (d, tgt)
struct deps *d;
@@ -203,7 +209,7 @@ deps_add_default_target (d, tgt)
return;
if (tgt[0] == '\0')
- deps_add_target (d, "-");
+ deps_add_target (d, "-", 1);
else
{
tgt = base_name (tgt);
@@ -220,7 +226,7 @@ deps_add_default_target (d, tgt)
strcpy (suffix, OBJECT_SUFFIX);
else
strcat (o, OBJECT_SUFFIX);
- deps_add_target (d, o);
+ deps_add_target (d, o, 1);
}
}
@@ -293,7 +299,7 @@ deps_write (d, fp, colmax)
}
void
-deps_dummy_targets (d, fp)
+deps_phony_targets (d, fp)
const struct deps *d;
FILE *fp;
{
@@ -301,6 +307,7 @@ deps_dummy_targets (d, fp)
for (i = 1; i < d->ndeps; i++)
{
+ putc ('\n', fp);
fputs (d->depv[i], fp);
putc (':', fp);
putc ('\n', fp);
diff --git a/gcc/mkdeps.h b/gcc/mkdeps.h
index 727a784..2484af1 100644
--- a/gcc/mkdeps.h
+++ b/gcc/mkdeps.h
@@ -34,8 +34,9 @@ extern struct deps *deps_init PARAMS ((void));
/* Destroy a deps buffer. */
extern void deps_free PARAMS ((struct deps *));
-/* Add a target (appears on left side of the colon) to the deps list. */
-extern void deps_add_target PARAMS ((struct deps *, const char *));
+/* Add a target (appears on left side of the colon) to the deps list. Takes
+ a boolean indicating whether to quote the target for MAKE. */
+extern void deps_add_target PARAMS ((struct deps *, const char *, int));
/* Sets the default target if none has been given already. An empty
string as the default target in interpreted as stdin. */
@@ -56,6 +57,6 @@ extern void deps_write PARAMS ((const struct deps *, FILE *,
file, causing it to depend on nothing. This is used to work around
the intermediate-file deletion misfeature in Make, in some
automatic dependency schemes. */
-extern void deps_dummy_targets PARAMS ((const struct deps *, FILE *));
+extern void deps_phony_targets PARAMS ((const struct deps *, FILE *));
#endif