From 44b47b57e3825821438460bb7cccd3ff661e4948 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 31 Jan 2017 10:06:06 -0300 Subject: use Homebrew only if installed --- Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 01e1f6ad4..57e935174 100644 --- a/Makefile +++ b/Makefile @@ -62,15 +62,17 @@ 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 homebrew's libffi include and library path - CXXFLAGS += $(shell PKG_CONFIG_PATH=$$(brew list libffi | grep pkgconfig | xargs dirname) pkg-config --silence-errors --cflags libffi) - LDFLAGS += $(shell PKG_CONFIG_PATH=$$(brew list libffi | grep pkgconfig | xargs dirname) pkg-config --silence-errors --libs libffi) - # use bison installed by homebrew if available - BISON = $(shell (brew list bison | grep -m1 "bin/bison") || echo bison) - SED = sed + # 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) else LDFLAGS += -rdynamic LDLIBS += -lrt -- cgit v1.2.3 From 19f36271c2634f6829b4f7fe75b848aa74fd168d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 7 Feb 2017 11:09:15 -0300 Subject: Allow standard tools to be overwritten in make invocation --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 57e935174..280c9d6a1 100644 --- a/Makefile +++ b/Makefile @@ -57,9 +57,9 @@ CXXFLAGS += -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -D_YOSYS_ -fPIC -I$(PRE LDFLAGS += -L$(LIBDIR) LDLIBS = -lstdc++ -lm -PKG_CONFIG = pkg-config -SED = sed -BISON = bison +PKG_CONFIG ?= pkg-config +SED ?= sed +BISON ?= bison ifeq (Darwin,$(findstring Darwin,$(shell uname))) BREW := $(shell command -v brew 2> /dev/null) -- cgit v1.2.3 From 7e08e37961a061807cec7aa335edbbab47891ce9 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 7 Feb 2017 11:12:12 -0300 Subject: Fix compilation on OS X in order to support both MacPorts and Homebrew --- Makefile | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 280c9d6a1..11cef84a2 100644 --- a/Makefile +++ b/Makefile @@ -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; }) -- cgit v1.2.3 From 94c76f85da755e1d6bcba7d746deba2223016dcf Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 9 Feb 2017 18:53:37 -0300 Subject: Applied fixes from @joshhead (thanks for your effors!) --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 11cef84a2..50dc1b865 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,8 @@ 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) +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 @@ -81,7 +82,8 @@ 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) +PKG_CONFIG_PATH := $(PORT_PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH) + export PATH := $(PORT_PREFIX)/bin:$(PATH) endif @@ -224,8 +226,8 @@ endif endif ifeq ($(ENABLE_PLUGINS),1) -CXXFLAGS += -DYOSYS_ENABLE_PLUGINS $(shell $(PKG_CONFIG) --silence-errors --cflags libffi) -LDLIBS += $(shell $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi) -ldl +CXXFLAGS += -DYOSYS_ENABLE_PLUGINS $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags libffi) +LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi) -ldl endif ifeq ($(ENABLE_TCL),1) -- cgit v1.2.3 From 9eca3671abe054e973b6c38c6670b0053954b4c2 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 10 Feb 2017 10:04:42 -0300 Subject: Dont mix Homebrew and MacPorts build options --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 50dc1b865..1a430277f 100644 --- a/Makefile +++ b/Makefile @@ -73,10 +73,9 @@ LDFLAGS += -L$(BREW_PREFIX)/readline/lib 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),) +else ifneq ($(shell which port),) PORT_PREFIX := $(patsubst %/bin/port,%,$(shell which port)) CXXFLAGS += -I$(PORT_PREFIX)/include -- cgit v1.2.3 From 422ffd5c0699613f98cff3c45267b0af7d944a80 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 10 Feb 2017 10:06:54 -0300 Subject: Use pkg-config for linking tcl-tk Both MacPorts and Homebrew have a pkg-config file for TCL. So lets use it. --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1a430277f..50b189081 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ CXXFLAGS += -I$(BREW_PREFIX)/readline/include LDFLAGS += -L$(BREW_PREFIX)/readline/lib PKG_CONFIG_PATH := $(BREW_PREFIX)/libffi/lib/pkgconfig:$(PKG_CONFIG_PATH) +PKG_CONFIG_PATH := $(BREW_PREFIX)/tcl-tk/lib/pkgconfig:$(PKG_CONFIG_PATH) export PATH := $(BREW_PREFIX)/bison/bin:$(BREW_PREFIX)/gettext/bin:$(BREW_PREFIX)/flex/bin:$(PATH) @@ -225,15 +226,16 @@ endif endif ifeq ($(ENABLE_PLUGINS),1) -CXXFLAGS += -DYOSYS_ENABLE_PLUGINS $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags libffi) +CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags libffi) -DYOSYS_ENABLE_PLUGINS LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi) -ldl endif ifeq ($(ENABLE_TCL),1) TCL_VERSION ?= tcl$(shell bash -c "tclsh <(echo 'puts [info tclversion]')") TCL_INCLUDE ?= /usr/include/$(TCL_VERSION) -CXXFLAGS += -I$(TCL_INCLUDE) -DYOSYS_ENABLE_TCL -LDLIBS += -l$(TCL_VERSION) + +CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags tcl || echo -I$(TCL_INCLUDE)) -DYOSYS_ENABLE_TCL +LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo -l$(TCL_VERSION)) endif ifeq ($(ENABLE_GPROF),1) -- cgit v1.2.3