Xref: utzoo comp.bugs.sys5:305 comp.unix.wizards:6219 Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!umd5!purdue!gatech!bloom-beacon!athena.mit.edu!wesommer From: wesommer@athena.mit.edu (William E. Sommerfeld) Newsgroups: comp.bugs.sys5,comp.unix.wizards Subject: Re: make bug? Summary: :: is useful. Message-ID: <2483@bloom-beacon.MIT.EDU> Date: 23 Jan 88 20:44:33 GMT References: <2979@ncrcae.Columbia.NCR.COM> <292@dana.UUCP> <158@ateng.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: wesommer@athena.mit.edu (William E. Sommerfeld) Organization: Massachusetts Institute of Technology Lines: 32 In article <158@ateng.UUCP> chip@ateng.UUCP (Chip Salzenberg) writes: >If you specify a [make] dependency >with two colons instead of one, then you can have a different action for >each dependency line ... >I've never had a need for this feature, but it seems like it should be >useful for _something_. :-) Yep, it is. The X version 11 distribution uses a tool called `imake' (written by Todd Brunhoff of Tektronix), which runs a file through the C preprocessor, then a `cleanup' filter (which gets rid of the # line directives and extra vertical whitespace, and turns `@@' into newline, permitting multiple-line macros), and then through `make'. You can define macros like the following: #define simple(pgm,locallibs,syslibs) @@\ @@\ all:: pgm @@\ @@\ pgm: concat(pgm,.c) locallibs @@\ $(CC) $(CFLAGS) -o $@ $@.c locallibs syslibs @@\ @@\ clean:: @@\ $(RM) pgm concat(pgm,.o) @@\ @@\ instal:: @@\ $(INSTALL) pgm $(INSTALLDIR) and invoke it several times in an Imakefile without running into difficulty. - Bill