Article View: comp.unix.programmer
Article #3749Re: Generic and platform-specific Makefiles
From: Valentin Nechayev
Date: Sat, 23 Aug 2003 06:49
Date: Sat, 23 Aug 2003 06:49
34 lines
2498 bytes
2498 bytes
>>> Alex Vinokur wrote: AV> If I compile the program on Cygwin (Windows 2000) AV> the Makefile must contain the following line : AV> ------------------------- AV> LIBS = -lwsock32 AV> ------------------------- AV> If I compile the program on Linux AV> the Makefile must not contain that line. AV> What ways should be used to create such a Makefile? : AV> * generic Makefile for all platforms? AV> * main Makefile including platform-specific definitions? AV> * something else? AV> What techniques exist to do that? Look at existing methods and choose one the best for you. There are two main global approaches: 1) use feature tests, independently on target platform 2) use predefined knowledge of target platform features and one can also use mix of them (e.g. most data are from feature tests, but some rare or highly-specific platforms are registered as having some predefined characteristics). For first approach, look at GNU autoconf and at huge bunch of programs using it. For second approach, look at, e.g., sendmail, postfix, exim - they all do minimum of tests, but create makefiles using knowledge of platform features. -netch-
Technical Details
Message-ID:
<20030823064943.GA1922@iv.nn.kiev.ua>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!proxad.net!newsfeed.stueberl.de!npeer.de.kpn-eurorings.net!news.esico.net!centaur.lucky.net!carrier.kiev.ua!news.lucky.net!not-for-mailReferences:
<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-22 23:53:48 PST 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!proxad.net!newsfeed.stueberl.de!npeer.de.kpn-eurorings.net!news.esico.net!centaur.lucky.net!carrier.kiev.ua!news.lucky.net!not-for-mail From: Valentin Nechayev <netch@segfault.kiev.ua> Newsgroups: comp.unix.programmer,gnu.utils.help Subject: Re: Generic and platform-specific Makefiles Date: Sat, 23 Aug 2003 09:49:43 +0300 Organization: Dark side of coredump Lines: 34 Distribution: world Message-ID: <20030823064943.GA1922@iv.nn.kiev.ua> References: <bi2ar0$4h8si$1@ID-79865.news.uni-berlin.de> Reply-To: netch@segfault.kiev.ua NNTP-Posting-Host: news.lucky.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.lucky.net 1061621627 10262 193.193.193.102 (23 Aug 2003 06:53:47 GMT) X-Complaints-To: usenet@news.lucky.net NNTP-Posting-Date: Sat, 23 Aug 2003 06:53:47 +0000 (UTC) X-Comment-To: Alex Vinokur <alexvn@connect.to> X-Return-Path: netch@iv.nn.kiev.ua