Do not hard code toolchain binaries
If you are cross-compiling, you cannot execute `ar` and `ranlib` on the
target library, otherwise things may break. Here we create standard AR
and RANLIB variables which can easily be overridden by the environment.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
diff --git a/Make.Rules b/Make.Rules
index 9bccbb7..3f38e72 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -42,7 +42,9 @@
# Compilation specifics
-CC=gcc
+CC ?= gcc
+AR ?= ar
+RANLIB ?= ranlib
COPTFLAGS=-O2
DEBUG=-O2 -g #-DDEBUG
WARNINGS=-fPIC -Wall -Wwrite-strings \
diff --git a/libcap/Makefile b/libcap/Makefile
index b108aa9..09a12d2 100644
--- a/libcap/Makefile
+++ b/libcap/Makefile
@@ -40,8 +40,8 @@
@sed -ne '/^#define[ \t]CAP[_A-Z]\+[ \t]\+[0-9]\+/{s/^#define \([^ \t]*\)[ \t]*\([^ \t]*\)/\{\"\1\",\2\},/;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;p;}' < $(KERNEL_HEADERS)/linux/capability.h | fgrep -v 0x > $@
$(STALIBNAME): $(OBJS)
- ar rcs $(STALIBNAME) $(OBJS)
- ranlib $(STALIBNAME)
+ $(AR) rcs $(STALIBNAME) $(OBJS)
+ $(RANLIB) $(STALIBNAME)
$(MINLIBNAME): $(OBJS)
$(LD) $(LDFLAGS) $(COPTFLAG) -Wl,-soname,$(MAJLIBNAME) -o $@ $(OBJS)