summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSiesh1oo <siesh1oo@siesh1oo.no>2014-03-10 14:38:01 +0100
committerSiesh1oo <siesh1oo@siesh1oo.no>2014-03-10 14:38:01 +0100
commit0fb044a58f7cc66364af3a0a53c8b5089e0149ad (patch)
treeb5b7ab5ced1a1d682285ebfd3e5a82786144d0b6 /Makefile
parent9327d434d522f888609e5f4a42a6e06f01864e79 (diff)
- Makefile, kernel/posix_compatibility.h/.cc: provide POSIX.2008 fake implementation of open_memstream()/fmemopen() for pre-POSIX.2008 systems.
- Makefile: OSX build rules (Apple's gcc and clang have no -rdynamic option and no librt). - Makefile: Generate debugger symbols and don't optimize for size in debug target (otherwise the debugger pretty hard to use). - Makefile: Reorder target concatenation in order to avoid use-before-built problems for source-include and linker dependencies. - Makefile: On OSX/macports, qmake-qt4 is named 'qmake' (the default Qt4 installation name, unless the distribution changes it). - Makefile: For OSX/Macports, we need to pass -I/opt/local/include and -L/opt/local/lib to give GNU libraries precedence over Apple's. - Makefile: Build a local minisat copy just like abc (to avoid dependency on broken/unmaintained distribution header files). - .gitignore: Ignore minisat directory.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 36 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index a68ceccb..c0d43a2c 100644
--- a/Makefile
+++ b/Makefile
@@ -19,14 +19,24 @@ INSTALL_SUDO :=
OBJS =
GENFILES =
EXTRA_TARGETS =
-TARGETS = yosys yosys-config
+TARGETS =
all: top-all
-CXXFLAGS = -Wall -Wextra -ggdb -I"$(shell pwd)" -MD -D_YOSYS_ -fPIC
-LDFLAGS = -rdynamic
-LDLIBS = -lstdc++ -lreadline -lm -ldl -lrt
-QMAKE = qmake-qt4
+CXXFLAGS = -Wall -Wextra -ggdb -I"$(shell pwd)" -I${DESTDIR}/include -MD -D_YOSYS_ -fPIC -include kernel/posix_compatibility.h
+LDFLAGS = -I${DESTDIR}/lib
+LDLIBS = -lstdc++ -lreadline -lm -ldl
+
+ifeq (Darwin,$(findstring Darwin,$(shell uname)))
+ # add macports include and library path to search directories, don't use '-rdynamic' and '-lrt':
+ CXXFLAGS += -I/opt/local/include
+ LDFLAGS += -L/opt/local/lib
+ QMAKE = qmake
+else
+ LDFLAGS += -rdynamic
+ LDLIBS += -lrt
+ QMAKE = qmake-qt4
+endif
YOSYS_VER := 0.2.0+
GIT_REV := $(shell git rev-parse --short HEAD || echo UNKOWN)
@@ -41,16 +51,18 @@ OBJS = kernel/version_$(GIT_REV).o
ABCREV = 2058c8ccea68
ABCPULL = 1
+MINISATREV = HEAD
+
-include Makefile.conf
ifeq ($(CONFIG),clang-debug)
CXX = clang
-CXXFLAGS += -std=c++11 -Os
+CXXFLAGS += -std=c++11 -g -O0 -Wall
endif
ifeq ($(CONFIG),gcc-debug)
CXX = gcc
-CXXFLAGS += -std=gnu++0x -Os
+CXXFLAGS += -std=gnu++0x -g -O0 -Wall
endif
ifeq ($(CONFIG),release)
@@ -70,8 +82,8 @@ CXXFLAGS += -pg -fno-inline
LDFLAGS += -pg
endif
-ifeq ($(ENABLE_QT4),1)
-TARGETS += yosys-svgviewer
+ifeq ($(ENABLE_MINISAT),1)
+TARGETS += yosys-minisat
endif
ifeq ($(ENABLE_ABC),1)
@@ -85,7 +97,14 @@ CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -D'VERIFIC_DI
LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS))
endif
-OBJS += kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o
+# Build yosys after minisat and abc (we need to access the local copies of the downloaded/installed header files).
+TARGETS += yosys yosys-config
+
+ifeq ($(ENABLE_QT4),1)
+TARGETS += yosys-svgviewer
+endif
+
+OBJS += kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/posix_compatibility.o
OBJS += libs/bigint/BigIntegerAlgorithms.o libs/bigint/BigInteger.o libs/bigint/BigIntegerUtils.o
OBJS += libs/bigint/BigUnsigned.o libs/bigint/BigUnsignedInABase.o
@@ -123,6 +142,13 @@ yosys-svgviewer: libs/svgviewer/*.h libs/svgviewer/*.cpp
cd libs/svgviewer && $(QMAKE) && make
cp libs/svgviewer/svgviewer yosys-svgviewer
+yosys-minisat: $(DESTDIR)/bin/minisat
+$(DESTDIR)/bin/minisat:
+ test -d minisat || ( git clone https://github.com/niklasso/minisat.git minisat && sed -i -e 's/PRIi64/ & /' minisat/minisat/utils/Options.h )
+ ( cd minisat && git checkout $(MINISATREV) )
+ ( cd minisat && $(MAKE) prefix=$(DESTDIR) DESTDIR="" config install )
+ @( cd minisat && echo "Installed minisat version `git describe --always --dirty` into $(DESTDIR)." )
+
abc/abc-$(ABCREV):
ifneq ($(ABCREV),default)
if ( cd abc && hg identify; ) | grep -q +; then \