automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] branch master updated: automake: new option posix to e


From: Karl Berry
Subject: [automake-commit] branch master updated: automake: new option posix to emit .POSIX target first.
Date: Fri, 06 Oct 2023 11:18:48 -0400

This is an automated email from the git hooks/post-receive script.

karl pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=1c618bce5c6034fe5dd874eac71465f041c09082

The following commit(s) were added to refs/heads/master by this push:
     new 1c618bce5 automake: new option posix to emit .POSIX target first.
1c618bce5 is described below

commit 1c618bce5c6034fe5dd874eac71465f041c09082
Author: Vincent Lefevre <vincent@vinc17.net>
AuthorDate: Fri Oct 6 08:18:33 2023 -0700

    automake: new option posix to emit .POSIX target first.
    
    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                    | 2 ++
 bin/automake.in         | 7 +++++++
 doc/automake.texi       | 8 ++++++++
 lib/Automake/Options.pm | 1 +
 4 files changed, 18 insertions(+)

diff --git a/NEWS b/NEWS
index ced0fd640..db2975449 100644
--- 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
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..09a5fcc11 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -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
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]