Re: Need help with a makefile
- In reply to: Jonathan Adams : "Need help with a makefile"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 07 Feb 2024 03:40:17 UTC
On Tue, Feb 6, 2024 at 10:21 PM Jonathan Adams <jfadams1963@proton.me>
wrote:
> Hi all,
> I'm having a heck of a time getting my makefile conditional statements
> to not cause `make` to have fits. Could sure use some help on this. This is
> a makefile that works great _without_ the conditions, and my program
> compiles and runs on FBSD and Linux.
> I've just added a function who's header file is in a different location
> on Linux, so I'm needing detect the OS and set the correct preprocessor
> directives. I get the same errors without the line continuation
> backslashes. (More errors actually; one for lines 7, 9, 10, and 11 each)
> I'm using tabs for indent, and have checked for extraneous/misplaced spaces
> too.
>
> Here is the start of the makefile including the troublesome bits:
>
> 1 │ CC = cc
> 2 │ CFLAGS = -g -w -Wall -Wextra
> 3 │ LDFLAGS = -Wl,--allow-multiple-definition -lssl -lcrypto
>
> 4 │ RM = rm -f
> 5 │ UNAME := $(shell uname)
> 6 │
>
> 7 │ ifeq ($(UNAME),FreeBSD) \
> 8 │ CFLAGS += -D BSD \
> 9 │ else ifeq ($(UNAME),Linux) \
> 10 │ CFLAGS += -D LINUX \
> 11 │ endif
> <snip>
>
> And here are the errors from `make`:
> ~/portable/src$ make
> make: "/home/jfa/portable/src/makefile" line 7: Invalid line type
> make: Fatal errors encountered -- cannot continue
> make: stopped in /home/jfa/portable/src
>
> I'm working on 14.0-RELEASE-p4. I've found plenty of advice on
> Stackoverflow, but nothing that solves the issue. Duckduckgo-ing produces
> more of the same, so I thought I'd reach out here.
>
> Thanks!
>
> - Jonathan
> ____________________________________________
> "Before Turing, things were done to numbers.
> After Turing, numbers began doing things"
> - George Dyson
ifeq is gmake centric.
make(1) will show you all available statements.
gmake != make
~Paul
--
__________________
:(){ :|:& };: