Subject: Re: make(8) .PREFIX issue
To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
From: Christos Zoulas <christos@zoulas.com>
List: current-users
Date: 10/21/2004 16:32:27
On Oct 21,  9:04pm, hauke@Espresso.Rhein-Neckar.DE (Hauke Fath) wrote:
-- Subject: Re: make(8) .PREFIX issue

| At 17:00 Uhr +0000 21.10.2004, Christos Zoulas wrote:
| >So $*, or ${.PREFIX} in BSD make will strip directory names and suffix
| >components taking the longest suffix from the list of known suffixes.
| 
| Yes, I've learned that in the meantime.
| 
| >Yes, the man page should be clearer on that,
| 
| ...insert a section about what make(8) sees as a suffix, maybe, and refer
| to that?
| 
| >but the TOG man page is not much better.
| >
| >I suspect that what you want is:
| >
| >foobar.fuh:
| >	@echo ${.TARGET:R}
| 
| In the end, I went with
| 
| 
| MAKEMAP =       /usr/sbin/makemap
| MMOPTS =        -v hash
| DBS =           mailertable.db access.db
| 
| # Else, gives a "make: Graph cycles through mailertable.db"
| .SUFFIXES       : .db
| 
| ${DBS}          : ${.PREFIX}
|         ${MAKEMAP} ${MMOPTS} ${.PREFIX} < ${.PREFIX}
| 
| 
| which does the trick nicely. I'll think about the doc PR.
| 

You can do even better by supplying a suffix rule:

.SUFFIXES:      .db .null
.NULL:          .null

.null.db:       
	${MAKEMAP} ${MMOPTS} ${.PREFIX} < ${.PREFIX}

christos