Strange behavior of 'exists' function. Need help with Makefile.
Yevgen Krapiva
ykrapiva at gmail.com
Tue Dec 29 07:58:09 UTC 2009
Thanks Ulrich,
I've discovered the following issue:
!!! This example works: !!!
MY_FILE= /usr/local/share/openjsip/conf/proxy.properties
do-check:
.for f in ${MY_FILE}
. if !exists(${f})
@${ECHO_MSG} ">> File ${f} doesn't exists"
. else
@${ECHO_MSG} ">> File ${f} exists"
. endif
.endfor
!!! And this one doesn't: !!!
MY_FILE= proxy.properties
do-check:
.for f in ${MY_FILE}
. if !exists(${DATADIR}/conf/${f})
@${ECHO_MSG} ">> File ${DATADIR}/conf/${f} doesn't exists"
. else
@${ECHO_MSG} ">> File ${DATADIR}/conf/${f} exists"
. endif
.endfor
So, I will use the first method... But anyway I would like to know why
the second
example doesn't work.
P.S. The second example was copied from tomcat6 port :\
On Mon, 2009-12-28 at 17:11 +0100, Ulrich Spörlein wrote:
> On Mon, 28.12.2009 at 10:13:42 +0200, Yevgen Krapiva wrote:
> > Hi guys,
> >
> > I'm trying to create my own port. I'm stucked with the following
> > Makefile:
> >
> > PORTNAME= openjsip
> > PORTVERSION= 0.0.4
> > ...
> > ...
> > MY_FILE= proxy.properties
> >
> > do-check:
> >
> > #FIRST TEST
> > . if !exists(/usr/local/share/openjsip/conf/proxy.properties)
> > @${ECHO_MSG} ">> /usr/local/share/openjsip/conf/proxy.properties
> > doesn't exist"
> > . else
> > @${ECHO_MSG} ">> /usr/local/share/openjsip/conf/proxy.properties
> > exists"
> > . endif
> >
> > #SECOND TEST
> > @${ECHO_MSG} ">> DATADIR=${DATADIR}"
> >
> > .for f in ${MY_FILE}
> > . if !exists(${DATADIR}/conf/${f})
> > @${ECHO_MSG} ">> File ${DATADIR}/conf/${f} doesn't exist"
> > . else
> > @${ECHO_MSG} ">> File ${DATADIR}/conf/${f} exists"
> > . endif
> > .endfor
> >
> >
> > I'm trying to make script to check the existence of proxy.properties
> > file.
> > The first test works well while to other one (with the use of 'for')
> > doesn't.
> > Can you help me, I don't understand why the second test fails.
>
> First of all, please do not use "empty" lines inside a Makefile, it is
> not an imperative language and care must be taken so that the parser
> gets things right.
>
> Doing a minimal test, I cannot confirm your findings, perhaps you should
> try to trim down your example and see where it breaks or starts to work.
>
> Example:
>
> FILES=/etc/rc.conf /etc/doener.conf
>
> all:
> .for f in ${FILES}
> .if !exists(${f})
> @echo "${f} does not exist"
> .else
> @echo "${f} does exist"
> .endif
> .endfor
>
> % make all
> /etc/rc.conf does exist
> /etc/doener.conf does not exist
>
> hth,
> Uli
>
More information about the freebsd-ports
mailing list