This patch is from https://bugs.gnu.org/55025.
* lib/Automake/Options.pm: declare "posix" option. * bin/automake.in: if the "posix" option is present, add a .POSIX special target as the first non-comment line in the Makefile.in files. * NEWS: mention this. * doc/automake.texi: likewise. --- NEWS | 2 ++ bin/automake.in | 7 +++++++ doc/automake.texi | 6 ++++++ lib/Automake/Options.pm | 1 + 4 files changed, 16 insertions(+) diff --git a/NEWS b/NEWS index ced0fd640..821ae0cf1 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,8 @@ New in 1.17: as given in the Makefile.am will be used. If @setfilename is present, it should be the basename of the Texinfo file, extended with .info. + - New option "posix" to generate a .POSIX special target. + * Bugs fixed - Generated file timestamp checks now handle filesystems with sub-second diff --git a/bin/automake.in b/bin/automake.in index 369a47fa2..edc0488b8 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -8126,6 +8126,13 @@ sub generate_makefile my $output = "$output_vars$output_all$output_header$output_rules$output_trailer"; + # The .POSIX special target must be the first non-comment line; + # otherwise, the behavior of "make" is unspecified by POSIX. + if (option 'posix') + { + $output =~ s/^((#.*)?\n)*\K/.POSIX:\n\n/; + } + # Decide whether we must update the output file or not. # We have to update in the following situations. # * $force_generation is set. diff --git a/doc/automake.texi b/doc/automake.texi index d14b769fd..97e3e3475 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -10679,6 +10679,12 @@ are ordinarily automatically provided by Automake. Don't require @file{texinfo.tex}, even if there are texinfo files in this directory. +@item @option{posix} +@cindex Option, @option{posix} +@opindex posix +Generate a @code{.POSIX} special target as the first non-comment line in +the @file{Makefile.in} files. + @item @option{serial-tests} @cindex Option, @option{serial-tests} @opindex serial-tests diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index 69fc2ecb5..22d527fac 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -290,6 +290,7 @@ sub _is_valid_easy_option ($) no-installman no-texinfo.tex nostdinc + posix readme-alpha serial-tests parallel-tests -- 2.42.0