]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
automake: new option posix to emit .POSIX target first.
authorVincent Lefevre <vincent@vinc17.net>
Fri, 6 Oct 2023 15:18:33 +0000 (08:18 -0700)
committerKarl Berry <karl@freefriends.org>
Fri, 6 Oct 2023 15:18:33 +0000 (08:18 -0700)
This patch is from https://bugs.gnu.org/55025.

* lib/Automake/Options.pm (_is_valid_easy_option): declare new
option "posix".
* bin/automake.in (generate_makefile): 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
bin/automake.in
doc/automake.texi
lib/Automake/Options.pm

diff --git a/NEWS b/NEWS
index ced0fd640bc67417b76a05a38f211a108b524ddd..db2975449264ce26ac18c879b0e29ddab3ad5845 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ New in 1.17:
 
 * New features added
 
+  - New option "posix" to emit the special target .POSIX for make.
+
   - RANLIB may be overridden on a per-target basis.
 
   - AM_PATH_PYTHON will also search for Python versions 3.10 - 3.15.  It has
index 369a47fa22ff37a4c85d9d5e16bf1f92aa164bb7..edc0488b8f50a7d9640db07757404964a521ba91 100644 (file)
@@ -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.
index d14b769fd911540bd6976966e8b639c45f6db0ef..09a5fcc118b803775b2923aac2732165c1bb07a3 100644 (file)
@@ -10679,6 +10679,14 @@ 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 the special target @code{.POSIX} as the first non-comment
+line in the @file{Makefile.in} files.  This alters the behavior of the
+@code{make} program.  @xref{Special targets,, make, The GNU Make
+Manual}.
+
 @item @option{serial-tests}
 @cindex Option, @option{serial-tests}
 @opindex serial-tests
index 69fc2ecb500b6081e2339a6276015ab710366b1c..22d527fac6bfc09c394db8b5b313652f4e7d69cd 100644 (file)
@@ -290,6 +290,7 @@ sub _is_valid_easy_option ($)
     no-installman
     no-texinfo.tex
     nostdinc
+    posix
     readme-alpha
     serial-tests
     parallel-tests