Re: Need help with a makefile

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

> On Wednesday, 7 February 2024 at 3:21:00 +0000, Jonathan Adams wrote:
> 

> > 7 │ ifeq ($(UNAME),FreeBSD) \
> > 8 │ CFLAGS += -D BSD \
> > 9 │ else ifeq ($(UNAME),Linux) \
> > 10 │ CFLAGS += -D LINUX \
> > 11 │ endif
> 

> This looks like GNU make.
> 

> And you're feeding it to BSD make.

 Doh! Than explains a lot. I mean, of course I know that I'm using BSD make, ;-), it just hadn't yet occurred to me that all the wonderful examples I was reading were GNU make specific. My first clue _should_ have been, when reading the man page, that I actually notice the different conditionals! At least I can be embarrassed about this in front of an understanding group. :-)

> The simple answer: use GNU make.

Yeah, I hadn't yet felt the need to install it, but I can. It is the most straight-forward solution. Though, my program doesn't _have_ to compile on Linux, it's just nice that it can.

> However, I've put this through gmake, and it complains:
> 

> $ gmake
> Makefile:7: extraneous text after 'ifeq' directive
> 

> I don't know GNU make very well, but possibly you can find the reason.
> Quoting, maybe?

  Hmm, OK. I'm just getting started today and haven't yet touched this. I'll play around with this, and see what sort of trouble I can get myself into...

Thanks again Greg,

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