Article View: comp.unix.programmer
Article #3724Re: Makefile with a function in dependency side
From: Paul D. Smith
Date: Tue, 24 Sep 2002 20:24
Date: Tue, 24 Sep 2002 20:24
46 lines
3403 bytes
3403 bytes
%% throopw@sheol.org (Wayne Throop) writes: wt> But it wouldn't be confusing, nor break any makefiles, to wt> introduce a syntax for expanding things at "dependency time", in wt> addition to the already existing alternatives of expanding things wt> at read-time, and expanding things at execution time (of an wt> action). Well, it would be a new syntax and increase by half again the number of ways that expansion can occur... judging by the number of requests for help and "bug reports" which are not really bugs I answer every week which basically boil down to not understanding the _current_ expansion rules, I've grave concerns :). Nevertheless, you might be interested in the new $(eval ...) function available in 3.80 (unless something happens I expect to release 3.80 in the next week or so). This function allows you to define whole new segments of makefiles essentially anywhere and any time that variable evaluation is performed (that includes within command rules when they're run, if you want to get very bizarre). The function expands its arguments and reads the results as makefile commands. It, itself, expands to the empty string. Combined with the ability to use define/endef to create variable values containing newlines this is a powerful feature. This capability should obsolete a very large percentage of the reasons for using auto-re-exec. Also available in 3.80 is the slightly bizarre SysV $$@ feature, including $$(@D) and $$(@F)--but only for explicit and static pattern rules (not pattern rules). However this is provided mainly for compatibility with SysV make, and is not intended to become a new paradigm (IOW, the re-expansion of escaped items on the prerequisites list is limited to only $$@ and friends, searched for explicitly by the parser: it's not a general thing). -- ------------------------------------------------------------------------------- Paul D. Smith <psmith@gnu.org> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
Technical Details
Message-ID:
<p5y99rqgpc.fsf@lemming.engeast.baynetworks.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!torn!qcarhaaa.nortelnetworks.com!bcarh189.ca.nortel.com!bcarh8ab.ca.nortel.com!not-for-mailReferences:
<bcf444eb.0209230934.19aac7fb@posting.google.com> <p53cs0bni0.fsf@lemming.engeast.baynetworks.com> <bcf444eb.0209240410.51b4c2a@posting.google.com> <p5u1kfsdpc.fsf@lemming.engeast.baynetworks.com> <1032893040@sheol.org>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109f73,b1afc18c7dca1ca8 X-Google-Attributes: gid109f73,public X-Google-Thread: fc89c,b1afc18c7dca1ca8 X-Google-Attributes: gidfc89c,public X-Google-Thread: 1025b4,b1afc18c7dca1ca8 X-Google-Attributes: gid1025b4,public X-Google-ArrivalTime: 2002-09-24 13:28:33 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!torn!qcarhaaa.nortelnetworks.com!bcarh189.ca.nortel.com!bcarh8ab.ca.nortel.com!not-for-mail From: "Paul D. Smith" <psmith@gnu.org> Newsgroups: comp.unix.programmer,gnu.utils.help,gnu.misc.discuss Subject: Re: Makefile with a function in dependency side Date: 24 Sep 2002 16:24:15 -0400 Organization: GNU's Not Unix! Lines: 46 Message-ID: <p5y99rqgpc.fsf@lemming.engeast.baynetworks.com> References: <bcf444eb.0209230934.19aac7fb@posting.google.com> <p53cs0bni0.fsf@lemming.engeast.baynetworks.com> <bcf444eb.0209240410.51b4c2a@posting.google.com> <p5u1kfsdpc.fsf@lemming.engeast.baynetworks.com> <1032893040@sheol.org> Reply-To: psmith@gnu.org NNTP-Posting-Host: lemming.engeast.baynetworks.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2