chip@ateng.UUCP (Chip Salzenberg) (01/22/88)
In article <292@dana.UUCP> worley@dana.UUCP (John Worley) writes: > >In make, it is possible to specify multiple dependency lines: > > [example deleted] > > Exactly zero or one of these can have an action... This is only true for "normal" dependencies. If you specify a dependency with two colons instead of one, then you can have a different action for each dependency line: # If bar1 is newer than foo, do this foo:: bar1 echo bar1 # If bar2 is newer than foo, do this foo:: bar2 echo bar2 I've never had a need for this feature, but it seems like it should be useful for _something_. :-) -- Chip Salzenberg UUCP: "{codas,uunet}!ateng!chip" A T Engineering My employer's opinions are a trade secret. "Anything that works is better than anything that doesn't."
wesommer@athena.mit.edu (William E. Sommerfeld) (01/24/88)
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