From c3cf29a8f2f5f6a0b793bd1f24b083a759370a01 Mon Sep 17 00:00:00 2001 From: Zong Li Date: Tue, 1 May 2018 10:58:34 +0800 Subject: 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. --- Makefile.in | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'Makefile.in') 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) -- cgit v1.1