diff options
| author | rillig <rillig@NetBSD.org> | 2022-04-18 15:06:27 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2022-04-18 15:06:27 +0000 |
| commit | 686b9d31508b5cf03b7362f4e2f8a28d78bef7d8 (patch) | |
| tree | cca4fc84a4c4f12425cdf1a45acd269d02d56b3b /usr.bin/make/make.1 | |
| parent | 437e498c7a66a13ccb91525f7f4f49e68f107a3c (diff) | |
make: only switch to POSIX mode if '.POSIX:' is the first line
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
says that in order to make a makefile POSIX-conforming, its first
non-comment line must be the special dependency line '.POSIX:' without
any source dependencies.
Previously, make switched to POSIX mode even if such a line occurred
anywhere else, which was allowed by POSIX but was deep in the
"unspecified behavior" area. For NetBSD make, there is no big
difference since it doesn't ship any <posix.mk> file, this change mainly
affects the bmake distribution.
Previously, makefiles that contain '.POSIX:' somewhere in the middle
could fail due to <posix.mk> resetting .SUFFIXES, among other things.
Suggested by Simon J. Gerraty, who also reviewed an earlier version of
this change.
Diffstat (limited to 'usr.bin/make/make.1')
| -rw-r--r-- | usr.bin/make/make.1 | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1 index 446b88511eb..923bfc2324c 100644 --- a/usr.bin/make/make.1 +++ b/usr.bin/make/make.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.307 2022/03/26 15:39:58 sjg Exp $ +.\" $NetBSD: make.1,v 1.308 2022/04/18 15:06:27 rillig Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd March 24, 2022 +.Dd April 18, 2022 .Dt MAKE 1 .Os .Sh NAME @@ -2290,17 +2290,15 @@ Apply the .Ic .PHONY attribute to any specified sources. .It Ic .POSIX -This should be the first non-comment line in a Makefile. -It results in the variable +If this is the first non-comment line in the main makefile, +the variable .Va %POSIX -being defined with the value -.Ql 1003.2 . -The first time -.Ic .POSIX -is encountered, the makefile -.Ql posix.mk -will be included if possible, -to provide POSIX compatible default rules. +is set to the value +.Ql 1003.2 +and the makefile +.Ql <posix.mk> +is included if it exists, +to provide POSIX-compatible default rules. If .Nm is run with the |
