Previously, we had hardcoded names of lib32 and lib64. Instead, we now
ask gcc for the actual triple being targeted, (such as, for example,
lib/i386-linux-gnu or lib/x86_64-linux-gnu).
Using these correct names means that the user of Glaze can put a
literal $LIB into LD_PRELOAD or LD_LIBRARY_PATH and the run-time
linker will expand that to the correct name based on the architecture
of the program being linked
libglaze.so*
Makefile.config
*~
libglaze.so*
Makefile.config
*~
TARGETS = $(LIBGLAZE_LIBNAME)
ifeq ($(COMPILER_SUPPORTS_32),Yes)
TARGETS = $(LIBGLAZE_LIBNAME)
ifeq ($(COMPILER_SUPPORTS_32),Yes)
-TARGETS += lib32/libGL.so.1
+TARGETS += $(LIB32_DIR)/libGL.so.1
endif
ifeq ($(COMPILER_SUPPORTS_64),Yes)
endif
ifeq ($(COMPILER_SUPPORTS_64),Yes)
-TARGETS += lib64/libGL.so.1
+TARGETS += $(LIB64_DIR)/libGL.so.1
$(LIBGLAZE_LIBNAME): glaze.c
$(CC) $(GLAZE_CFLAGS) -fPIC -shared -Wl,-Bsymbolic,-soname=$(LIBGLAZE_SONAME) -ldl -o $@ $<
$(LIBGLAZE_LIBNAME): glaze.c
$(CC) $(GLAZE_CFLAGS) -fPIC -shared -Wl,-Bsymbolic,-soname=$(LIBGLAZE_SONAME) -ldl -o $@ $<
-lib64/libGL.so.1: glaze-gl.c glapi.def
- mkdir -p lib64
+$(LIB64_DIR)/libGL.so.1: glaze-gl.c glapi.def
+ mkdir -p $(LIB64_DIR)
$(CC) $(GLAZE_CFLAGS) -m64 -fPIC -shared -Wl,-Bsymbolic -o $@ $<
$(CC) $(GLAZE_CFLAGS) -m64 -fPIC -shared -Wl,-Bsymbolic -o $@ $<
-lib32/libGL.so.1: glaze-gl.c specs/gl.def
- mkdir -p lib32
+$(LIB32_DIR)/libGL.so.1: glaze-gl.c specs/gl.def
+ mkdir -p $(LIB32_DIR)
$(CC) $(GLAZE_CFLAGS) -m32 -fPIC -shared -Wl,-Bsymbolic -o $@ $<
.PHONY: install
install: all
$(CC) $(GLAZE_CFLAGS) -m32 -fPIC -shared -Wl,-Bsymbolic -o $@ $<
.PHONY: install
install: all
- mkdir -p $(DESTDIR)$(LIBDIR)/glaze/lib64
- install -m0644 lib64/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/lib64
- mkdir -p $(DESTDIR)$(LIBDIR)/glaze/lib32
- install -m0644 lib32/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/lib32
+ mkdir -p $(DESTDIR)$(LIBDIR)/glaze/$(LIB64_DIR)
+ install -m0644 $(LIB64_DIR)/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/$(LIB64_DIR)
+ mkdir -p $(DESTDIR)$(LIBDIR)/glaze/$(LIB32_DIR)
+ install -m0644 $(LIB32_DIR)/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/$(LIB32_DIR)
install -m0644 $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)
ln -sf $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBGLAZE_SONAME)
ln -sf $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBGLAZE_LINKER_NAME)
install -m0644 $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)
ln -sf $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBGLAZE_SONAME)
ln -sf $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBGLAZE_LINKER_NAME)
if ${CC} -m32 -o arch-minimal arch-minimal.c > /dev/null 2>&1
then
printf "Yes.\n"
if ${CC} -m32 -o arch-minimal arch-minimal.c > /dev/null 2>&1
then
printf "Yes.\n"
+
+ printf " Target directory for 32-bit targets... "
+
+ lib32_dir=$(gcc -m32 --print-multiarch)
+ printf "${lib32_dir}\n"
+
else
printf "No.\n"
have_m32=No
else
printf "No.\n"
have_m32=No
if ${CC} -m64 -o arch-minimal arch-minimal.c > /dev/null 2>&1
then
printf "Yes.\n"
if ${CC} -m64 -o arch-minimal arch-minimal.c > /dev/null 2>&1
then
printf "Yes.\n"
+
+ printf " Target directory for 64-bit targets... "
+
+ lib64_dir=$(gcc -m64 --print-multiarch)
+ printf "${lib64_dir}\n"
+
else
printf "No.\n"
have_m64=No
else
printf "No.\n"
have_m64=No
# Whether compiler can create 32 or 64-bit binaries
COMPILER_SUPPORTS_32 = ${have_m32}
# Whether compiler can create 32 or 64-bit binaries
COMPILER_SUPPORTS_32 = ${have_m32}
+LIB32_DIR = lib/${lib32_dir}
COMPILER_SUPPORTS_64 = ${have_m64}
COMPILER_SUPPORTS_64 = ${have_m64}
+LIB64_DIR = lib/${lib64_dir}
# Version information for glaze library
MAJOR = ${MAJOR}
# Version information for glaze library
MAJOR = ${MAJOR}