svn commit: r318592 - head/benchmarks/mdtest

Alexey Dokuchaev danfe at FreeBSD.org
Wed May 22 11:28:37 UTC 2013


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


More information about the svn-ports-all mailing list