Re: Need help with a makefile

From: grarpamp <grarpamp_at_gmail.com>
Date: Wed, 07 Feb 2024 07:41:53 UTC
On 2/6/24, Jonathan Adams <jfadams1963@proton.me> wrote:
>    5   │ UNAME  := $(shell uname)
>    7   │ ifeq ($(UNAME),FreeBSD) \
> make: "/home/jfa/portable/src/makefile" line 7: Invalid line type
>   I'm working on 14.0-RELEASE-p4.

Many makefile systems are incompatible.
You could try to write compatible makefiles,
or force the user to install whichever make or build system you're using,
or ship a separate makefile.<os> for their platform,
whereby in this example the only tabs prefix the a1 section...

# env - UNAME='' U='bar' make -dA -r -f ./makefile.freebsd a1

.if (!defined(UNAME) || empty(UNAME))
 note=was_either_unset_or_null
 UNAME!=uname
.elif ${UNAME} == "FreeBSD"
 note=was_FreeBSD
 CFLAGS+=-DBSD
.elif ${UNAME} == "foo"
 note=was_foo
.else
.info was something else
.endif
a1: .NOTMAIN
        @echo "note: ${note}"
        @echo "uvar: ${UNAME}"
        @echo "cvar: ${CFLAGS}"
        @echo ----------
        uname -a
        echo $$(uname -K)
        echo $UNAME