aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
diff options
context:
space:
mode:
authorZong Li <zong@andestech.com>2018-05-01 10:58:34 +0800
committerZong Li <zong@andestech.com>2018-06-21 17:18:47 +0800
commitc3cf29a8f2f5f6a0b793bd1f24b083a759370a01 (patch)
treefbbbc55a9a98cbc4be9eb73a151507dde39b85e3 /Makefile.in
parent2cffbf5d8efd9822dbac98e2fde89adba871d4b0 (diff)
downloadriscv-pk-c3cf29a8f2f5f6a0b793bd1f24b083a759370a01.zip
riscv-pk-c3cf29a8f2f5f6a0b793bd1f24b083a759370a01.tar.gz
riscv-pk-c3cf29a8f2f5f6a0b793bd1f24b083a759370a01.tar.bz2
Replace the --enable-32bit option by --with-arch
Get rid of the --enable-32bit option and switch to use --with-arch, which is more standard because it matches the GCC build. 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.
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)