Path: news1.icaen!news.uiowa.edu!news.physics.uiowa.edu!math.ohio-state.edu!jussieu.fr!fu-berlin.de!news-peer.gip.net!news.gsl.net!gip.net!news.maxwell.syr.edu!news.mel.connect.com.au!munnari.OZ.AU!comp.vuw.ac.nz!news.actrix.gen.nz!dempson From: dempson@actrix.gen.nz (David Empson) Newsgroups: comp.sys.apple2.gno Subject: Re: dmake recipe Date: Thu, 16 Apr 1998 04:47:45 +1200 Organization: Empsoft Lines: 66 Message-ID: <1d7k9fp.17rv6b1hbwwxsN@dempson.actrix.gen.nz> References: <352f3ca3.7420055@netnews.msn.com> NNTP-Posting-Host: news2.actrix.gen.nz Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: MacSOUP 2.3 Xref: news1.icaen comp.sys.apple2.gno:6636 Sönke Behrens wrote: > Dragon King wrote: > > >Just thought I'd share a recipe I've come up with to help with making > >object libraries from dmake(1). > > > > %$A : ; $(AR) $(ARFLAGS) $@ +$(?:t" +") > > Thanks for sharing that. Wow. Looks complicated. Been a while since I > had a close enough look at dmake to actually understand this. Care to > break it into its component parts and explain how it works? > > Might help others on this group to get a better understanding of > dmake, too ;-) Yes, indeed. I know normal make, but I've never looked at dmake. Most of that makes vague sense, but some parts are unfamiliar. Here is my guess (which I'm sure will be corrected and/or clarified): I have no idea what the % in front of $A means, unless it is required to distinguish a rule from a macro definition. I assume $A is the macro which contains the name of the object library. The colon appears to separate the target from the dependents list. There are no dependents here, so this rule will always be executed. The semicolon separates the dependents list from the command to build the target. $(AR) is the macro containing the command (presumably AR for ARCHIVER, thus the macro will be set to mklib or equivalent), and $(ARFLAGS) is the optional flags for the archiver. $@ is the target name for this rule, which is the first non-flag parameter to the archiver program. As to the rest of it - this looks like some kind of regular expression (perl uses (?:...) as a special grouping notation). My guess: it expands into a list of files to be included in the library, each of which will be separated by a space and a plus sign. The initial plus is the prefix for the first file. Assuming I'm right, this means the general form is $(?:macro"sep") where 'macro' is the macro name and 'sep' is the text to separate each word in the macro. For example, if t is defined as: t = fileA fileB fileC then $(?:t" +") will expand to fileA +fileB +fileC (The quoted rule adds an initial '+' explictly, on the assumption that there is at least one object file to be added to the library.) This means that $(?:t" ") is exactly the same as $t, assuming the words in the macro 't' are separated by single spaces in its definition. I invented a similar mechanism in my own version of make (which I use on the PC at work), but my notation is $e(macro, prefix, sep, suffix). This allows file extensions and paths to be added to each word in a macro. So how did I do? :-) -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand