🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3747

Re: Generic and platform-specific Makefiles

#3747
From: Gisle Vanem
Date: Thu, 21 Aug 2003 12:52
33 lines
2082 bytes
"Alex Vinokur" <alexvn@bigfoot.com> wrote:

> For instance, I have some program.
>
> If I compile the program on Cygwin (Windows 2000)
>   the Makefile must contain the following line :
> -------------------------
> LIBS          = -lwsock32
> -------------------------
>
> If I compile the program on Linux
>   the Makefile must not contain that line.
>
>
> What ways should be used to create such a Makefile? :
> * generic Makefile for all platforms?
> * main Makefile including platform-specific definitions?
> * something else?
>
> What techniques exist to do that?

You can trust unname on Linux to exist and include "linux".
On Cygwin if it exist, it should include "Windows....". So
this could work:

ifeq ($(findstring Windows, $(shell uname)), Windows)
  LIBS += -lwsock32
endif

--gv

There are only 10 types of people in this world...
those who understand binary, and those who don't.
Technical Details
Message-ID: <3f44c12b$1@news.broadpark.no>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!uio.no!193.75.75.20.MISMATCH!news.eunet.no!news.broadpark.no
References: <bi2ar0$4h8si$1@ID-79865.news.uni-berlin.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109f73,1b57b03510500b7e
X-Google-Attributes: gid109f73,public
X-Google-Thread: fc89c,1b57b03510500b7e
X-Google-Attributes: gidfc89c,public
X-Google-ArrivalTime: 2003-08-21 05:52:45 PST
From: "Gisle Vanem" <giva@users.sourceforge.net>
Newsgroups: comp.unix.programmer,gnu.utils.help
References: <bi2ar0$4h8si$1@ID-79865.news.uni-berlin.de>
Subject: Re: Generic and platform-specific Makefiles
Date: Thu, 21 Aug 2003 14:52:40 +0200
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 125.80-202-225.nextgentel.com
X-Original-NNTP-Posting-Host: 125.80-202-225.nextgentel.com
Message-ID: <3f44c12b$1@news.broadpark.no>
X-Trace: news.broadpark.no 1061470507 125.80-202-225.nextgentel.com (21 Aug 2003 14:55:07 +0200)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!uio.no!193.75.75.20.MISMATCH!news.eunet.no!news.broadpark.no