How to write a FreeBSD-style makefile : checking for external vars existence?

Daniel O'Connor doconnor at gsoft.com.au
Sun Oct 29 01:50:46 UTC 2006


On Sunday 29 October 2006 11:10, Garrett Cooper wrote:
> -How do I go about checking for external variables, as defined by a shell?
> -How do I go about checking for variables as defined in make.conf?
> -What do variable definitions generally look like in each of these
> cases, ie what's the difference between $$VAR, ${VAR}, and VAR?

AFAIK there is no way to differentiate between environmental variables and 
ones set in a makefile. (or ones passed in via the command line)

I don't think $$FOO is a valid construct, also there is no difference between 
$(FOO) ${FOO}, $FOO means ${F}OO.

> 	The reason why I'm asking is because I'm trying to make a set of
> FreeBSD makefiles and the following type of declaration doesn't work for
> some odd reason..
>
> .ifdef $$VAR
> 	@echo define $$VAR please!
> .else
> 	#do something to build program
> .endif

Try
.if !defined(VAR)
...

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20061029/4cce7594/attachment.pgp


More information about the freebsd-hackers mailing list