Makefile: fix and simplify test program compilations

This was totally broken due to the make's shell function's temporal
behavior.

quote from the gnu make documentation
(http://www.gnu.org/s/hello/manual/make/Shell-Function.html):
"The commands run by calls to the shell function are run when the
function calls are expanded"
we have used the shell function to echo the test programs to a file.
the file name used was equal for all tests and was overwritten for
each test. the result was that all tests (in a single target?) used
the last test program because the echoing of the test programs was
done before all test compilations(!)
see my mail for details:
http://lists.gnu.org/archive/html/bug-make/2011-08/msg00010.html

also the branching for testing ifeq ($(CONFIG_FT2232_SPI), yes) was
unnecessarily complicated.

in my approach here i am using verbatim variables (allows to define
even complex test programs in the makefile without jumping through
hoops) that get exported to environment variables (via "export",
reference afterwards with "$$<varname>").

i have also added the missing redirection of stderr to the compiler
test and changed the definition of ARCH to use simple expansion (:=).

the latter is still wrong, because it uses $(CC) before we check if
a compiler is installed... makes the compiler check pretty much
useless. The simple expansion just reduces the number of errors
printed to 1.

Corresponding to flashrom svn r1416.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
1 file changed