chiark / gitweb /
[PATCH] udev/libsysfs cross compile fixes
authorlethal@linux-sh.org <lethal@linux-sh.org>
Tue, 5 Aug 2003 08:10:01 +0000 (01:10 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:01:40 +0000 (21:01 -0700)
I noticed that libsysfs doesn't inherently grab cross compilation arguments
that are set in the top-level Makefile, so I've come up with the following
patch to fix this. With the patch, I can succesfully cross compile for other
architectures (such as sh) by doing 'make ARCH=sh CROSS=sh-linux-' in the
top-level directory.

Makefile
libsysfs/Makefile

index b1adf3456c676dc29933591dfbffed2df0a731bc..a7bb01d247cfcc4685e919b7bd1390d7005d412c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,9 @@ CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
 CC = $(CROSS)gcc
 AR = $(CROSS)ar
 STRIP = $(CROSS)strip
+RANLIB = $(CROSS)ranlib
 
+export CROSS CC AR STRIP RANLIB
 
 # code taken from uClibc to determine the current arch
 ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \
index cf07a842b6d59aa28d0ae385fbbd6c3b5e67dcf2..79cc53395932ffdb67e571135cac424956c4a28a 100644 (file)
@@ -1,8 +1,6 @@
 # Makefile for libsysfs.a
 # Copyright (c) International Business Machines Corp., 2003
 
-CC=gcc
-
 H_INCLUDE=../include
 LIB_INCLUDE=.
 OBJS=sysfs_bus.o sysfs_class.o sysfs_device.o sysfs_dir.o sysfs_driver.o \
@@ -19,8 +17,8 @@ LIBSYSFS=libsysfs.a
 RM=rm -f
 
 libsysfs.a: $(OBJS)
-       ar cru $(LIBSYSFS) $(OBJS)
-       ranlib $(LIBSYSFS)
+       $(AR) cru $(LIBSYSFS) $(OBJS)
+       $(RANLIB) $(LIBSYSFS)
 
 sysfs_bus.o: sysfs_bus.c
        $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_bus.c