Subject: Re: Circular symlink created when only SHLIB_MAJOR is defined
To: Jachym Holecek <freza@dspfpga.com>
From: Roland Illig <rillig@NetBSD.org>
List: tech-misc
Date: 01/29/2007 09:40:45
Jachym Holecek wrote:
> # Jeremie Le Hen 2007-01-28:
> 
>>On Sun, Jan 28, 2007 at 06:45:48AM -0500, Thor Lancelot Simon wrote:
>>
>>>On Sun, Jan 28, 2007 at 06:59:04AM +0100, Jeremie Le Hen wrote:
>>>
>>>>Hi list,
>>>>
>>>>(Please Cc: in your reply, I'm not subscribed.)
>>>>
>>>>I've already sent this e-mail to tech-toolchain@ but got no answer.
>>>>I dare to resend it here to reach a larger audience.
>>>
>>>The audience dares to point out that a shared library with only a major
>>>number is not supported.
>>>
>>>"Unix gives you enough rope..."
>>
>>Ok, I'm sorry.  Is it possible to trigger an error whenever only the
>>major version if defined ?  NetBSD's make(1) does not have the .error
>>statement, what can I use instead ?
> 
> 
> I usually do something like below.
> 
> 	-- Jachym
> 
> .if !defined(FOO)
> .BEGIN:
> 	@echo "Error ===> FOO not defined"
> 	@exit 1
> .endif

That doesn't scale much, since there will be weird error messages if 
.BEGIN is getting defined multiple times. Since the make(1) error 
messages are not very good, I'm always trying to work around them.

In htdocs, you could do this:

.if !defined(FOO)
ERRORS+=       "[bsd.lib.mk] FOO must be defined."
.endif


# (Later, in a central place ...)
ERRORS?=    # none
.if !empty(ERRORS:M*)
.BEGIN:
	@for e in ${ERRORS}; do echo "ERROR: $$e"; done; exit 1
.endif

(pkgsrc uses the same scheme, but with longer variable names 
(PKG_FAIL_REASON and PKG_SKIP_REASON).)

Roland