aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMel Gorman <mel@skynet.ie>2008-10-23 17:30:10 +0100
committerEric B Munson <ebmunson@us.ibm.com>2008-10-27 10:41:06 +0000
commit3431ae05c03ca1fa4b4f666acb657c5c314ff4fe (patch)
tree320d95bf43d9d2238fc6de5a01bf6b8da55d3eb2 /Makefile
parent52817da87bb467f38913df92ddfb9a98940103ec (diff)
downloadlibhugetlbfs-3431ae05c03ca1fa4b4f666acb657c5c314ff4fe.tar.gz
Handle the case where lib64 and lib32 resolve to the same place
On recent 64-bit Debian systems, /usr/lib64 is a symbolic link to /usr/lib and 64-bit libraries are installed to /usr/lib/$ARCH-linux-gnu. In this case, the 64-bit install of libhugetlbfs overwrites the 32-bit version of the library. It's different in Ubuntu where lib can be the 64-bit directory, lib32 the 32-bit one and lib64 a symbolic link to lib. When installing with PREFIX=/usr, this leads to all sorts of hilarity and the bizarre situation where the 64-bit install overwrites the 32-bit install. How each distro arranges 32/64 bit libraries in /usr varies considerably so rather than trying to figure out what to do, inform the user when the library installation paths are going to the same place and allow them to manually specify the correct library path names within the prefix. Signed-off-by: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 34 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 1085687..b9e2540 100644
--- a/Makefile
+++ b/Makefile
@@ -31,8 +31,8 @@ ARCH = $(shell uname -m | sed -e s/i.86/i386/)
ifeq ($(ARCH),ppc64)
CC64 = gcc -m64
ELF64 = elf64ppc
-LIB64 = lib64
-LIB32 = lib
+TMPLIB64 = lib64
+TMPLIB32 = lib
ifneq ($(BUILDTYPE),NATIVEONLY)
CC32 = gcc -m32
ELF32 = elf32ppclinux
@@ -41,18 +41,18 @@ else
ifeq ($(ARCH),ppc)
CC32 = gcc -m32
ELF32 = elf32ppclinux
-LIB32 = lib
+TMPLIB32 = lib
else
ifeq ($(ARCH),i386)
CC32 = gcc
ELF32 = elf_i386
-LIB32 = lib
+TMPLIB32 = lib
else
ifeq ($(ARCH),x86_64)
CC64 = gcc -m64
ELF64 = elf_x86_64
-LIB64 = lib64
-LIB32 = lib
+TMPLIB64 = lib64
+TMPLIB32 = lib
ifneq ($(BUILDTYPE),NATIVEONLY)
CC32 = gcc -m32
ELF32 = elf_i386
@@ -60,19 +60,19 @@ endif
else
ifeq ($(ARCH),ia64)
CC64 = gcc
-LIB64 = lib64
+TMPLIB64 = lib64
CFLAGS += -DNO_ELFLINK
else
ifeq ($(ARCH),sparc64)
CC64 = gcc -m64
-LIB64 = lib64
+TMPLIB64 = lib64
CFLAGS += -DNO_ELFLINK
else
ifeq ($(ARCH),s390x)
CC64 = gcc -m64
CC32 = gcc -m31
-LIB64 = lib64
-LIB32 = lib
+TMPLIB64 = lib64
+TMPLIB32 = lib
CFLAGS += -DNO_ELFLINK
else
$(error "Unrecognized architecture ($(ARCH))")
@@ -106,6 +106,30 @@ endif
LIBOBJS32 += $(LIBOBJS:%=obj32/%)
LIBOBJS64 += $(LIBOBJS:%=obj64/%)
+ifeq ($(LIB32),)
+LIB32 = $(TMPLIB32)
+endif
+
+ifdef TMPLIB64
+ifeq ($(LIB64),)
+LIB64 = $(TMPLIB64)
+endif
+endif
+
+# If TMPLIB64 is set, then sure we are not resolving LIB32 and LIB64 to the
+# same place
+ifdef TMPLIB64
+
+REALLIB32 = $(realpath $(PREFIX)/$(LIB32))
+REALLIB64 = $(realpath $(PREFIX)/$(LIB64))
+ifneq ($(realpath $(PREFIX)),)
+ifeq ($(REALLIB32),$(REALLIB64))
+$(error LIB32 ($(PREFIX)/$(LIB32) to $(REALLIB32)) and LIB64 ($(PREFIX)/$(LIB64) to $(REALLIB64)) are resolving to the same place. Manually specify LIB32 and LIB64. e.g. make PREFIX=$(PREFIX) LIB32=lib32 LIB64=lib64)
+endif
+endif
+
+endif
+
HEADERDIR = $(PREFIX)/include
LIBDIR32 = $(PREFIX)/$(LIB32)
LIBDIR64 = $(PREFIX)/$(LIB64)