]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: commit the tiny FreeBSD makefile stub
authorWilly Tarreau <w@1wt.eu>
Wed, 24 May 2023 15:06:30 +0000 (17:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 May 2023 15:17:36 +0000 (17:17 +0200)
The idea here is to try to detect the use of "make" instead of "gmake"
on FreeBSD. After having long tried, there's no way to construct a
condition that is common to both makefile languages and could serve as
a differentiator since there's simply no common word between the two
languages. However on FreeBSD (the main used BSD platform), "make" is
configured to look for BSDmakefile before the other ones. It allows us
to intercept it and explain to use gmake with an example of a roughly
converted make command line (we just strip "-J xx,xx" that systematically
gets inserted if "-j" is used). A few tricks are used, such as creating
a dummy target on the fly based on the requested one just to silence the
output, and always match "all" since it's used by default when no target
is specified. .DEFAULTS was initially used but finally dropped thanks to
this.

For example:

  $ make -j$(getconf NPROCESSORS_ONLN) TARGET=freebsd USE_OPENSSL=1
  Please use GNU make instead. It is often called gmake.
  Example:
    gmake  -j 4 TARGET=freebsd USE_OPENSSL=1  all

It will often be sufficient to permit a copy-paste and to try again.
Note that the .gitignore was updated.

.gitignore
BSDmakefile [new file with mode: 0644]

index dc36969bd4db15788c37c0f36d7a13dbf6280ffd..95aaa0e0474d63dcacc1d129c5c30d4b0c8df3cb 100644 (file)
@@ -10,6 +10,7 @@
 !/CHANGELOG
 !/LICENSE
 !/BRANCHES
+!/BSDmakefile
 !/Makefile
 !/README
 !/INSTALL
diff --git a/BSDmakefile b/BSDmakefile
new file mode 100644 (file)
index 0000000..76a01af
--- /dev/null
@@ -0,0 +1,10 @@
+# Makefile stub for FreeBSD, it checks BSDmakefile before Makefile so
+# we can be friendly to the user and tell them to use gmake.
+.BEGIN:
+       @echo "Please use GNU make instead. It is often called gmake on BSD systems."
+       @echo "Example:"
+       @echo '  gmake ${MAKEFLAGS} $(.TARGETS)' | sed -e 's, -J[ ]*[0-9,]*,,'
+       @echo
+
+all $(.TARGETS): .SILENT
+       @-