Re: Need help with a makefile

From: David Christensen <dpchrist_at_holgerdanske.com>
Date: Wed, 07 Feb 2024 18:40:16 UTC
On 2/7/24 08:00, Jonathan Adams wrote:
> On Wednesday, February 7th, 2024 at 4:21 AM, David Christensen wrote:
>> I also had problems attempting to write one Makefile that worked with
>> both BSD make(1) and GNU make(1) (e.g. Linux). My solution was to
>> choose GNU make(1) for the programming language, install gmake(1) on
>> BSD, rename Makefile to GNUmakefile, and write a BSDmakefile that
>> forwards invocations to gmake(1):
>>
>> $ cat BSDmakefile
>> PHONY : update
>> update :
>> @gmake -s $@
>>
>> DEFAULT :
>> @gmake -s $@
> 
> Hi David. Thanks for sharing your experience. This is an interesting solution; gives me a few ideas..
> ...
> Seems that a very simple and straight-forward approach would be to use GNUmake and have separate targets for BSD and Linux. (??)


TIMTOWTDI.  "GNUmakefile", `make` on Linux, and `gmake` on BSD works. 
My fingers want to type `make` everywhere, so I added the forwarding 
BSDmakefile.


David