[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] trouble with mintlib + gcc 4.4.2



Miro Kropacek wrote:
         echo `which cpp | sed -e 's/\/cpp//'`

when I run this on easymint as "make all", I get:

/bin/sh: alias: command not found
/usr/local/bin

Does anybody know where that "command not found" comes from? It does not
happen in linux.

which which
will tell you the answer :-)

Remember that by default the makefile commands are interpreted by /bin/sh, not your favourite shell.
So you should run manually sh and test your command there.

One solution could be to use:
/usr/bin/which cpp
because it will force using the external program and not the alias.
But I don't like the absolute path.

Another solution could be:
env which cpp
but it involves 2 external programs: env and which.

An alternative could be the "type -p" sh builtin, but it may not be available on all shells.

Personally I prefer the following:
rpcgen-cmd := $(srcdir)/rpcgen -Y $(patsubst %/cpp,%,$(shell which cpp))

It is optimal because the only external command run is "which", executed directly from make without an intermediate sh. The the make function pathsubst remove the trailing filename. And note the := which initializes the rpcgen-cmd variable once and not on every invokation.

MiKRO, check what is good for you, and please provide a patch.

--
Vincent Rivière