forked from Mirrors/opensbi
makefile: add support for building on macOS
On macOS the readlink command does not include a -f flag. Instead default to using GNU readlink (which is often installed as greadlink). Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> Signed-off-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:

committed by
Anup Patel

parent
2c2bbe7374
commit
5ff1ab0ed8
13
Makefile
13
Makefile
@@ -12,10 +12,17 @@
|
|||||||
# o Do not print "Entering directory ...";
|
# o Do not print "Entering directory ...";
|
||||||
MAKEFLAGS += -r --no-print-directory
|
MAKEFLAGS += -r --no-print-directory
|
||||||
|
|
||||||
|
# Readlink -f requires GNU readlink
|
||||||
|
ifeq ($(shell uname -s),Darwin)
|
||||||
|
READLINK ?= greadlink
|
||||||
|
else
|
||||||
|
READLINK ?= readlink
|
||||||
|
endif
|
||||||
|
|
||||||
# Find out source, build, and install directories
|
# Find out source, build, and install directories
|
||||||
src_dir=$(CURDIR)
|
src_dir=$(CURDIR)
|
||||||
ifdef O
|
ifdef O
|
||||||
build_dir=$(shell readlink -f $(O))
|
build_dir=$(shell $(READLINK) -f $(O))
|
||||||
else
|
else
|
||||||
build_dir=$(CURDIR)/build
|
build_dir=$(CURDIR)/build
|
||||||
endif
|
endif
|
||||||
@@ -23,7 +30,7 @@ ifeq ($(build_dir),$(CURDIR))
|
|||||||
$(error Build directory is same as source directory.)
|
$(error Build directory is same as source directory.)
|
||||||
endif
|
endif
|
||||||
ifdef I
|
ifdef I
|
||||||
install_dir=$(shell readlink -f $(I))
|
install_dir=$(shell $(READLINK) -f $(I))
|
||||||
else
|
else
|
||||||
install_dir=$(CURDIR)/install
|
install_dir=$(CURDIR)/install
|
||||||
endif
|
endif
|
||||||
@@ -34,7 +41,7 @@ ifeq ($(install_dir),$(build_dir))
|
|||||||
$(error Install directory is same as build directory.)
|
$(error Install directory is same as build directory.)
|
||||||
endif
|
endif
|
||||||
ifdef PLATFORM_DIR
|
ifdef PLATFORM_DIR
|
||||||
platform_dir_path=$(shell readlink -f $(PLATFORM_DIR))
|
platform_dir_path=$(shell $(READLINK) -f $(PLATFORM_DIR))
|
||||||
ifdef PLATFORM
|
ifdef PLATFORM
|
||||||
platform_parent_dir=$(platform_dir_path)
|
platform_parent_dir=$(platform_dir_path)
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user