mf@UUNET.UU.NET (mf) (11/24/89)
Wildcard characters and functions do not work in static pattern rules.
The following is an excerpt of a Makefile in a directory including
3 (say) man pages, pp.1, qq.2, rr.3, which should end up in
/usr/local/man/man{1,2,3}, respectively, when one of the destination
is out of date. (Makefile is in the "source" directory, not the
destination one).
MANDIR = /usr/local/man
PAGES = pp.1 qq.2 rr.3
DESTPAGES = $(foreach page, $(PAGES), $(MANDIR)/man$(suffix $(page))/$(page))
$(DESTPAGES) : % : @(notdir %)
install -c -g wheel -m 0644 $< $(MANDIR)/man$(suffix $<)
The static rule was meant to say /usr/local/man/man1/pp.1 depends on
pp.1 etc... But the way % works, the stem is added on the right
hand side *after* the @notdir is invoked.
I tried
$(DESTPAGES) : $(MANDIR)/man?/% : %
but this does not work, either. The only solution I found was to have
separate rules for each section, which is a drag. Any suggestions?
Thanks!
Michael Fingerhutmf@UUNET.UU.NET (mf) (11/28/89)
There is no way to specify ")" as a substitution character in substitution
references nor in addprefix, addsuffix and the like.
Problem: I have an automatically generated list of objects, say:
A := a.o b.o c.o ...
and I want to generate
L := libmylib.a(a.o) libmylib.a(b.o) libmylib.a(c.o) ...
Although adding "libmylib.a(" as a prefix works (maybe because it just
looks for a matching ")" ) I found no way to add the ")". Any suggestions?
Thanks,
Michael Fingerhutmf@UUNET.UU.NET (mf) (11/28/89)
I note that the make file contains "automatically generated dependencies." However, I found no tool to do so. I'd be very interested in one... Michael Fingerhut