diff --git a/Makefile b/Makefile index 9cdb8d2db..7c5cab8d3 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ SANITIZER = # SANITIZER = cfi +OS := $(shell uname -s) PREFIX ?= /usr/local INSTALL_SUDO := @@ -216,6 +217,9 @@ endif ifeq ($(ENABLE_READLINE),1) CXXFLAGS += -DYOSYS_ENABLE_READLINE +ifeq ($(OS), FreeBSD) +CXXFLAGS += -I/usr/local/include +endif LDLIBS += -lreadline ifeq ($(LINK_CURSES),1) LDLIBS += -lcurses @@ -237,21 +241,33 @@ endif ifeq ($(ENABLE_PLUGINS),1) 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 +LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi) +ifneq ($(OS), FreeBSD) +LDLIBS += -ldl +endif endif ifeq ($(ENABLE_TCL),1) TCL_VERSION ?= tcl$(shell bash -c "tclsh <(echo 'puts [info tclversion]')") +ifeq ($(OS), FreeBSD) +TCL_INCLUDE ?= /usr/local/include/$(TCL_VERSION) +else TCL_INCLUDE ?= /usr/include/$(TCL_VERSION) +endif ifeq ($(CONFIG),mxe) CXXFLAGS += -DYOSYS_ENABLE_TCL LDLIBS += -ltcl86 -lwsock32 -lws2_32 -lnetapi32 else CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags tcl || echo -I$(TCL_INCLUDE)) -DYOSYS_ENABLE_TCL +ifeq ($(OS), FreeBSD) +# FreeBSD uses tcl8.6, but lib is named "libtcl86" +LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo -l$(TCL_VERSION) | tr -d '.') +else LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo -l$(TCL_VERSION)) endif endif +endif ifeq ($(ENABLE_GPROF),1) CXXFLAGS += -pg diff --git a/README.md b/README.md index 2a7a3b6ee..d5184bd7d 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,14 @@ Similarily, on Mac OS X MacPorts or Homebrew can be used to install dependencies $ sudo port install bison flex readline gawk libffi \ git mercurial graphviz pkgconfig python36 +On FreeBSD use the following command to install all prerequisites: + + # pkg install bison flex readline gawk libffi\ + git mercurial graphviz pkgconfig python3 python36 tcl-wrapper + +On FreeBSD system use gmake instead of make. To run tests use: + % MAKE=gmake CC=cc gmake test + There are also pre-compiled Yosys binary packages for Ubuntu and Win32 as well as a source distribution for Visual Studio. Visit the Yosys download page for more information: http://www.clifford.at/yosys/download.html diff --git a/tests/tools/autotest.sh b/tests/tools/autotest.sh index d0b0a89d7..31a6ae8ab 100755 --- a/tests/tools/autotest.sh +++ b/tests/tools/autotest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash libs="" genvcd=false