diff options
author | Steffen Vogel <post@steffenvogel.de> | 2017-02-07 11:12:12 -0300 |
---|---|---|
committer | Steffen Vogel <post@steffenvogel.de> | 2017-02-07 11:16:56 -0300 |
commit | 7e08e37961a061807cec7aa335edbbab47891ce9 (patch) | |
tree | ea98b82fcfe4db60c1eb42ec89aac28ccf6581bd /Makefile | |
parent | 19f36271c2634f6829b4f7fe75b848aa74fd168d (diff) | |
download | yosys-7e08e37961a061807cec7aa335edbbab47891ce9.tar.gz yosys-7e08e37961a061807cec7aa335edbbab47891ce9.tar.bz2 yosys-7e08e37961a061807cec7aa335edbbab47891ce9.zip |
Fix compilation on OS X in order to support both MacPorts and Homebrew
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 38 |
1 files changed, 25 insertions, 13 deletions
@@ -62,20 +62,32 @@ SED ?= sed BISON ?= bison ifeq (Darwin,$(findstring Darwin,$(shell uname))) - BREW := $(shell command -v brew 2> /dev/null) - ifdef BREW - export PKG_CONFIG_PATH = $(shell $(BREW) list libffi | grep pkgconfig | xargs dirname) - BISON = $(shell $(BREW) list bison | grep -m1 "bin/bison") - endif - # add macports/homebrew include and library path to search directories, don't use '-rdynamic' and '-lrt': - CXXFLAGS += -I/opt/local/include -I/usr/local/opt/readline/include - LDFLAGS += -L/opt/local/lib -L/usr/local/opt/readline/lib - # add macports/homebrew's libffi include and library path - CXXFLAGS += $(shell pkg-config --silence-errors --cflags libffi) - LDFLAGS += $(shell pkg-config --silence-errors --libs libffi) + +# homebrew search paths +ifneq ($(shell which brew),) +BREW_PREFIX := $(shell brew --prefix)/opt + +CXXFLAGS += -I$(BREW_PREFIX)/readline/include +LDFLAGS += -L$(BREW_PREFIX)/readline/lib + +export PKG_CONFIG_PATH := $(BREW_PREFIX)/libffi/lib/pkgconfig:$(PKG_CONFIG_PATH) +export PATH := $(BREW_PREFIX)/bison/bin:$(BREW_PREFIX)/gettext/bin:$(BREW_PREFIX)/flex/bin:$(PATH) +endif + +# macports search paths +ifneq ($(shell which port),) +PORT_PREFIX := $(patsubst %/bin/port,%,$(shell which port)) + +CXXFLAGS += -I$(PORT_PREFIX)/include +LDFLAGS += -L$(PORT_PREFIX)/lib + +export PKG_CONFIG_PATH := $(PORT_PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH) +export PATH := $(PORT_PREFIX)/bin:$(PATH) +endif + else - LDFLAGS += -rdynamic - LDLIBS += -lrt +LDFLAGS += -rdynamic +LDLIBS += -lrt endif YOSYS_VER := 0.7+$(shell cd $(YOSYS_SRC) && test -e .git && { git log --author=clifford@clifford.at --oneline 61f6811.. | wc -l; }) |