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
This commit is contained in:
Neil Booth 2001-01-05 07:50:24 +00:00 committed by Neil Booth
parent 97fc4caf7d
commit a5a4ce3c3c
10 changed files with 93 additions and 25 deletions

View File

@ -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

View File

@ -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.
The targets are output in the order they appear on the command line.
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,
@smallexample
-MT '$(objpfx)foo.o $(objpfx)foo.os $(objpfx)foo.op'
@end smallexample
@item -H
@findex -H

View File

@ -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:

View File

@ -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.

View File

@ -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__}}\

View File

@ -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:

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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