Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 May 2013 11:28:37 +0000
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        Boris Samorodov <bsam@passap.ru>
Cc:        svn-ports-head@freebsd.org, svn-ports-all@freebsd.org, Boris Samorodov <bsam@FreeBSD.org>, ports-committers@freebsd.org
Subject:   Re: svn commit: r318592 - head/benchmarks/mdtest
Message-ID:  <20130522112837.GA54767@FreeBSD.org>
In-Reply-To: <519BA0B0.7010700@passap.ru>
References:  <201305201043.r4KAhCKv031239@svn.freebsd.org> <20130521023448.GA3541@FreeBSD.org> <519BA0B0.7010700@passap.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 21, 2013 at 08:28:32PM +0400, Boris Samorodov wrote:
> First of all this particular commit was not a blind one. And I suspected
> that a discussion may take place.

Noted, sorry; actually, I was not implying you.

> Then I'd say that for me the current state of Makefile is more readable
> and more logical:
> -----
> do-build:
>         (cd ${WRKSRC} && ${MPICC} ${CFLAGS} -o ${PORTNAME} ${PORTNAME}.c
> -lm)
> 
> do-install:
>         (cd ${WRKSRC} && ${INSTALL_PROGRAM} ${PORTNAME} ${PREFIX}/bin)
>         (cd ${WRKSRC} && ${INSTALL_MAN} ${PORTNAME}.1 ${MANPREFIX}/man/man1)

These examples are not quite the same: compiler will generate the file in
(relative to) the current directory unless given absolute name, thus here
cd is slightly less useless: it helps to void specifying ${WRKSRC} twice:
"... -o ${WRKSRC}/${PORTNAME} ${WRKSRC}/${PORTNAME}.c".

Same goes for complicated targets like do-configure and do-build: there are
probably configure scripts that silently, bogusly assume that they would be
run from the current directory, given how widespread was "./configure &&
make && make install" mantra in the old days.

Now, speaking of single INSTALL_* or CP command, preceding cd'ing does no
real good: it does not shorten command line (cf. the MPICC example above),
it does not help readability (only sabotages it), it makes two commands out
of one, and safety braces would require a subshell spawn.  If there would
be several source files in the args, I could agree, but it's hardly worth
for single one (like in the ones quoted).

./danfe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130522112837.GA54767>