Skip to content

Commit

Permalink
auto/make: Make GNU make mandatory
Browse files Browse the repository at this point in the history
There is breakage on non-GNU make systems due to the OTEL stuff using
'ifeq'.

We had previously handled this by only using such constructs (and
enabling certain features, such as D= & E=) when using GNU make.

OTEL added this unconditionally. It's used to set the target build
directory appropriately depending on whether we are doing debug or
release builds.

Unfortunately it seems there is no way to control this via cargo/rustc
command line arguments or environment variables.

For BSD make we could use '.if' etc but then trying to handle these two
systems (and possibly more) in the build scripts is going to be
unwieldy.

Let's just bite the bullet and make (no pun intended) GNU make mandatory
to build Unit, it's the default on Linux (I'm sure there's an exception
somewhere...) and it seems the default on macOS. On other systems it's
readily available via gmake(1).

This also brings build feature parity to all systems out the box.

As it happens, this also fixes issues with using gmake...

Fixes: 9d3dcb8 ("otel: add build tooling to include otel code")
Link: <#1520 (comment)>
Signed-off-by: Andrew Clayton <[email protected]>
  • Loading branch information
ac000 committed Jan 7, 2025
1 parent 9906862 commit 0397301
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions auto/make
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ manpage: $NXT_BUILD_DIR/share/man/man8/unitd.8

END


NXT_OS=$(uname -s)
NXT_GNU_MAKE=$(make --version | grep GNU || true)

# Requires GNU make. On OpenIndiana at least we have to use gmake
if [ -n "$NXT_GNU_MAKE" ] || [ $NXT_OS = "SunOS" ]; then

cat << END >> $NXT_MAKEFILE
cat << END >> $NXT_MAKEFILE
# By default compiler etc output is hidden, use
# make V=1 ...
# to show it.
Expand Down Expand Up @@ -78,10 +71,9 @@ endif

END

fi

# potentially set otel lib location
if [ $NXT_OTEL = YES ]; then

cat << END >> $NXT_MAKEFILE

ifeq (\$D,1)
Expand All @@ -91,6 +83,7 @@ else
endif

END

fi

# The include paths list.
Expand Down

0 comments on commit 0397301

Please sign in to comment.