summaryrefslogtreecommitdiff
blob: d9431f9d6e5396b17afc889942ad677529a32369 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From adf5e017030a62ea4cab21067b52ee1d336da222 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 16 Feb 2008 16:25:28 -0500
Subject: [PATCH] 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>
---
 Make.Rules      |    4 +++-
 libcap/Makefile |    4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Make.Rules b/Make.Rules
index 9bccbb7..3f38e72 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -42,7 +42,9 @@ MINOR=06
 
 # 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 @@ cap_names.sed: Makefile $(KERNEL_HEADERS)/linux/capability.h
 	@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)
-- 
1.5.4