"Portable" conditionalization of Makefiles

Ronald F. Guilmette rfg at tristatelogic.com
Wed Mar 21 18:14:24 UTC 2018

In message <alpine.LRH.2.21.1803210851190.6509 at sas1.nber.org>, 
Daniel Feenberg <feenberg at nber.org> wrote:

>On Tue, 20 Mar 2018, Ronald F. Guilmette wrote:
>> I have a pile of (mostly) C code that I wrote myself over the past
>> several years.  I developed it on FreeBSD but have always thought
>> that it would be Nice if it compiled and ran also on Linux.
>> I just spent about a day editing the various files to make it all
>> compile and link OK on Linux.  So that part is all done now.  But
>> here's the one remaining problem:
>> There's a chance that I may distribute this stuff someday.  When and
>> if I do, I'd like to be able to tell people to "just run make" in the
>> top-level directory, regardless of whether they are on Linux or *BSD.
>> (I -could- just tell people to use gmake if they are on *BSD, but I'd
>> rather not.)
>Why not concatenate all the C code (including the library) into a single 
>large file and let people just compile it on whatever system they have? 
>Make is for developers, so that they can avoid compiling everything when 
>they change a small routine. But your users are not developers, and don't 
>recompile every day, so they don't benefit from make, it only introduces 
>an incompatibility.

Well, I guess that's one way of looking at it.

I could also just distribute pre-built binaries only.  But as a tinkerer
myself, if I gave some of my code to other people then I would greatly
prefer to do in in a way that would be supportive of their further
tinkering with the code.

Thus, I would only ever want to give out the C code, as it is, nicely
separated out into several separate files, and all with a Makefile

More information about the freebsd-questions mailing list