Need help with a makefile [RESOLVED]

From: Jonathan Adams <jfadams1963_at_proton.me>
Date: Wed, 07 Feb 2024 19:10:11 UTC
On Tuesday, February 6th, 2024 at 10:38 PM, Greg 'groggy' Lehey <grog@freebsd.org> wrote:

> However, I've put this through gmake, and it complains:
>
> $ gmake
> Makefile:7: extraneous text after 'ifeq' directive

Hi Greg, et al.,
  The above error was do to the line continuation backslashes. Installed gmake, took out the backslashes and, presto, it "just works". On FBSD, that is.
  In my little project, I was using getpass(), but have changed to readpassphrase(). Great, but on Linux that's in /usr/include/bsd. So I added to my main source file:

#ifdef BSD
    #include <readpassphrase.h>
#endif

#ifdef LINUX
    #include <bsd/readpassphrase.h>
#endif

And as I say, no problem on FBSD.

  To try it on Linux, I fired up my GitPod Ubuntu/Debian instance and found that I had to install the libbsd0 and libbsd-dev packages first. However, when I first compiled, GCC complained:
undefined reference to `readpassphrase'
Oops! I added `-l:libbsd.a` to the linker arguments and it compiles fine under Linux now.

ifeq ($(UNAME),FreeBSD)
        CFLAGS += -DBSD
else ifeq ($(UNAME),Linux)
        CFLAGS += -DLINUX
        LDFLAGS += -l:libbsd.a
endif

  Unfortunatly, the program segfaults when I run it! Works fine on FBSD. Well, I've got something "constructive" to do today!

Thanks again everyone,

- Jonathan
____________________________________________
"Before Turing, things were done to numbers.
After Turing, numbers began doing things"
- George Dyson