From: Nishanth Aravamudan <nacc@us.ibm.com>

I noticed today, while trying to build with the O= make option (which
allows the objects to be in a different directory than the source), that
ATM throws a warning.  Turns out there is an explicit dependency on where
include is.  But, with O=, include only contains asm-offsets.s and include2
contains the appropriate files.

Here is a first attempt at a fix...  Ideally, I could just check
KBUILD_OUTPUT's value (which should be set with O= or the environmental
variable KBUILD_OUTPUT).  But I couldn't get that to work (can try again
with some guidance, though).  Instead, I just check if the source and
object trees are different -- which I think can only be the case if you use
O= or KBUILD_OUTPUT.  I think the change from $(src) to $(obj) is also
correct...

Description: Fix the build process for ATM when the make command-line
option O= is used.  The current code assumes the files will be availabled
in the src directory (not the case with O=) and that include is the
directory to look in (not the case with O=).  I would prefer to use
KBUILD_OUTPUT, but was unable to get it working.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/atm/Makefile |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)

diff -puN drivers/atm/Makefile~fix-atm-build-with-o= drivers/atm/Makefile
--- 25/drivers/atm/Makefile~fix-atm-build-with-o=	2005-05-13 22:14:17.000000000 -0700
+++ 25-akpm/drivers/atm/Makefile	2005-05-13 22:14:17.000000000 -0700
@@ -39,7 +39,11 @@ ifeq ($(CONFIG_ATM_FORE200E_PCA),y)
   fore_200e-objs		+= fore200e_pca_fw.o
   # guess the target endianess to choose the right PCA-200E firmware image
   ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y)
-    CONFIG_ATM_FORE200E_PCA_FW = $(shell if test -n "`$(CC) -E -dM $(src)/../../include/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo $(obj)/pca200e.bin; else echo $(obj)/pca200e_ecd.bin2; fi)
+    ifneq ($(srctree),$(objtree))
+      CONFIG_ATM_FORE200E_PCA_FW = $(shell if test -n "`$(CC) -E -dM $(obj)/../../include2/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo $(obj)/pca200e.bin; else echo $(obj)/pca200e_ecd.bin2; fi)
+    else
+      CONFIG_ATM_FORE200E_PCA_FW = $(shell if test -n "`$(CC) -E -dM $(obj)/../../include/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo $(obj)/pca200e.bin; else echo $(obj)/pca200e_ecd.bin2; fi)
+    endif
   endif
 endif
 
_