aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.in')
-rw-r--r--Makefile.in24
1 files changed, 21 insertions, 3 deletions
diff --git a/Makefile.in b/Makefile.in
index 0268629..75a7eaf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -48,6 +48,19 @@ else
project_ver:=@PACKAGE_VERSION@
endif
+# If --with-arch is not specified, it defaults to whatever the compiler's
+# default is. The -with-abi is not necessary for this project. Unconditionally
+# compile it with a no-float ABI. i.e., ilp32 for 32-bit and lp64 for 64-bit.
+
+ifeq (@WITH_ARCH@,)
+ march := -march=$(shell @CC@ -v 2>&1 | \
+ sed 's/ /\n/g' | grep with-arch | awk -F= '{print $$2}')
+else
+ march := -march=@WITH_ARCH@
+endif
+is_32bit := $(findstring 32,$(march))
+mabi := -mabi=$(if $(is_32bit),ilp32,lp64)
+
# Installation directories
prefix := @prefix@
@@ -57,7 +70,12 @@ ifeq ($(enable_stow),yes)
stow_pkg_dir := $(prefix)/pkgs
INSTALLDIR ?= $(DESTDIR)/$(stow_pkg_dir)/$(project_name)-$(project_ver)
else
- INSTALLDIR ?= $(DESTDIR)/$(prefix)/@install_subdir@
+ ifeq ($(is_32bit),)
+ install_subdir := @host_alias@
+ else
+ install_subdir := $(shell echo @host_alias@ | sed -e 's/64/32/g')
+ endif
+ INSTALLDIR ?= $(DESTDIR)/$(prefix)/$(install_subdir)
endif
install_hdrs_dir := $(INSTALLDIR)/include/$(project_name)
@@ -85,7 +103,7 @@ VPATH := $(addprefix $(src_dir)/, $(sprojs_enabled))
CC := @CC@
READELF := @READELF@
OBJCOPY := @OBJCOPY@
-CFLAGS := @CFLAGS@ $(CFLAGS) -DBBL_PAYLOAD=\"bbl_payload\" -DBBL_LOGO_FILE=\"bbl_logo_file\"
+CFLAGS := @CFLAGS@ $(CFLAGS) $(march) $(mabi) -DBBL_PAYLOAD=\"bbl_payload\" -DBBL_LOGO_FILE=\"bbl_logo_file\"
BBL_PAYLOAD := @BBL_PAYLOAD@
COMPILE := $(CC) -MMD -MP $(CFLAGS) \
$(sprojs_include)
@@ -94,7 +112,7 @@ COMPILE := $(CC) -MMD -MP $(CFLAGS) \
# - LIBS : Library flags (eg. -l)
LD := $(CC)
-LDFLAGS := @LDFLAGS@ -nostartfiles -nostdlib -static $(LDFLAGS)
+LDFLAGS := @LDFLAGS@ -nostartfiles -nostdlib -static $(LDFLAGS) $(march) $(mabi)
LIBS := @LIBS@
LINK := $(LD) $(LDFLAGS)