@@ -30,6 +30,7 @@ ENABLE_GCOV := 0
30
30
ENABLE_GPROF := 0
31
31
ENABLE_DEBUG := 0
32
32
ENABLE_NDEBUG := 0
33
+ ENABLE_CCACHE := 0
33
34
LINK_CURSES := 0
34
35
LINK_TERMCAP := 0
35
36
LINK_ABC := 0
@@ -81,7 +82,7 @@ all: top-all
81
82
YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST ) ) )
82
83
VPATH := $(YOSYS_SRC )
83
84
84
- CXXFLAGS := $(CXXFLAGS ) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC ) " -MD -D_YOSYS_ -fPIC -I$(PREFIX ) /include
85
+ CXXFLAGS := $(CXXFLAGS ) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC ) " -MD -MP - D_YOSYS_ -fPIC -I$(PREFIX ) /include
85
86
LDLIBS := $(LDLIBS ) -lstdc++ -lm
86
87
PLUGIN_LDFLAGS :=
87
88
@@ -122,7 +123,7 @@ LDFLAGS += -rdynamic
122
123
LDLIBS += -lrt
123
124
endif
124
125
125
- YOSYS_VER := 0.9+2406
126
+ YOSYS_VER := 0.9+3683
126
127
GIT_REV := $(shell cd $(YOSYS_SRC ) && git rev-parse --short HEAD 2> /dev/null || echo UNKNOWN)
127
128
OBJS = kernel/version_$(GIT_REV ) .o
128
129
170
171
PYTHON_CONFIG := $(PYTHON_EXECUTABLE ) -config
171
172
endif
172
173
173
- PYTHON_PREFIX := $(shell $(PYTHON_CONFIG ) --prefix)
174
- PYTHON_DESTDIR := $(PYTHON_PREFIX ) /lib/python$(PYTHON_VERSION ) /site-packages
174
+ PYTHON_DESTDIR := $(shell $(PYTHON_EXECUTABLE ) -c "import site; print(site.getsitepackages() [-1]);")
175
175
176
176
# Reload Makefile.conf to override python specific variables if defined
177
177
ifneq ($(wildcard Makefile.conf) ,)
@@ -246,7 +246,7 @@ CXXFLAGS := -std=c++11 $(filter-out -fPIC -ggdb,$(CXXFLAGS))
246
246
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
247
247
EMCCFLAGS := -Os -Wno-warn-absolute-paths
248
248
EMCCFLAGS += --memory-init-file 0 --embed-file share -s NO_EXIT_RUNTIME=1
249
- EMCCFLAGS += -s EXPORTED_FUNCTIONS="['_main','_run','_prompt','_errmsg']"
249
+ EMCCFLAGS += -s EXPORTED_FUNCTIONS="['_main','_run','_prompt','_errmsg','_memset' ]"
250
250
EMCCFLAGS += -s TOTAL_MEMORY=134217728
251
251
EMCCFLAGS += -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]'
252
252
# https://github.com/kripken/emscripten/blob/master/src/settings.js
@@ -528,6 +528,10 @@ ifeq ($(ENABLE_COVER),1)
528
528
CXXFLAGS += -DYOSYS_ENABLE_COVER
529
529
endif
530
530
531
+ ifeq ($(ENABLE_CCACHE ) ,1)
532
+ CXX := ccache $(CXX )
533
+ endif
534
+
531
535
define add_share_file
532
536
EXTRA_TARGETS += $(subst //,/,$(1 ) /$(notdir $(2 ) ) )
533
537
$(subst //,/,$(1 ) /$(notdir $(2 ) ) ) : $(2 )
@@ -580,13 +584,16 @@ $(eval $(call add_include_file,kernel/modtools.h))
580
584
$(eval $(call add_include_file,kernel/macc.h))
581
585
$(eval $(call add_include_file,kernel/utils.h))
582
586
$(eval $(call add_include_file,kernel/satgen.h))
587
+ $(eval $(call add_include_file,kernel/ff.h))
588
+ $(eval $(call add_include_file,kernel/ffinit.h))
589
+ $(eval $(call add_include_file,kernel/mem.h))
583
590
$(eval $(call add_include_file,libs/ezsat/ezsat.h))
584
591
$(eval $(call add_include_file,libs/ezsat/ezminisat.h))
585
592
$(eval $(call add_include_file,libs/sha1/sha1.h))
586
593
$(eval $(call add_include_file,libs/json11/json11.hpp))
587
594
$(eval $(call add_include_file,passes/fsm/fsmdata.h))
588
595
$(eval $(call add_include_file,frontends/ast/ast.h))
589
- $(eval $(call add_include_file,backends/ilang/ilang_backend .h))
596
+ $(eval $(call add_include_file,backends/rtlil/rtlil_backend .h))
590
597
$(eval $(call add_include_file,backends/cxxrtl/cxxrtl.h))
591
598
$(eval $(call add_include_file,backends/cxxrtl/cxxrtl_vcd.h))
592
599
$(eval $(call add_include_file,backends/cxxrtl/cxxrtl_capi.cc))
@@ -595,7 +602,7 @@ $(eval $(call add_include_file,backends/cxxrtl/cxxrtl_vcd_capi.cc))
595
602
$(eval $(call add_include_file,backends/cxxrtl/cxxrtl_vcd_capi.h))
596
603
597
604
OBJS += kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/yosys.o
598
- OBJS += kernel/cellaigs.o kernel/celledges.o
605
+ OBJS += kernel/cellaigs.o kernel/celledges.o kernel/satgen.o kernel/mem.o
599
606
600
607
kernel/log.o : CXXFLAGS += -DYOSYS_SRC='"$(YOSYS_SRC ) "'
601
608
kernel/yosys.o : CXXFLAGS += -DYOSYS_DATDIR='"$(DATDIR ) "' -DYOSYS_PROGRAM_PREFIX='"$(PROGRAM_PREFIX ) "'
@@ -627,7 +634,7 @@ include $(YOSYS_SRC)/techlibs/*/Makefile.inc
627
634
else
628
635
629
636
include $(YOSYS_SRC ) /frontends/verilog/Makefile.inc
630
- include $(YOSYS_SRC ) /frontends/ilang /Makefile.inc
637
+ include $(YOSYS_SRC ) /frontends/rtlil /Makefile.inc
631
638
include $(YOSYS_SRC ) /frontends/ast/Makefile.inc
632
639
include $(YOSYS_SRC ) /frontends/blif/Makefile.inc
633
640
@@ -644,7 +651,7 @@ include $(YOSYS_SRC)/passes/opt/Makefile.inc
644
651
include $(YOSYS_SRC ) /passes/techmap/Makefile.inc
645
652
646
653
include $(YOSYS_SRC ) /backends/verilog/Makefile.inc
647
- include $(YOSYS_SRC ) /backends/ilang /Makefile.inc
654
+ include $(YOSYS_SRC ) /backends/rtlil /Makefile.inc
648
655
649
656
include $(YOSYS_SRC ) /techlibs/common/Makefile.inc
650
657
@@ -654,6 +661,10 @@ ifeq ($(LINK_ABC),1)
654
661
OBJS += $(PROGRAM_PREFIX ) yosys-libabc.a
655
662
endif
656
663
664
+ # prevent the CXXFLAGS set by this Makefile from reaching abc/Makefile,
665
+ # especially the -MD flag which will break the build when CXX is clang
666
+ unexport CXXFLAGS
667
+
657
668
top-all : $(TARGETS ) $(EXTRA_TARGETS )
658
669
@echo " "
659
670
@echo " Build successful."
@@ -679,7 +690,7 @@ endif
679
690
680
691
% .pyh : % .h
681
692
$(Q ) mkdir -p $(dir $@ )
682
- $(P ) cat $< | grep -E -v " #[ ]*(include|error)" | $(LD ) -x c++ -o $@ -E -P -
693
+ $(P ) cat $< | grep -E -v " #[ ]*(include|error)" | $(LD ) $( CXXFLAGS ) -x c++ -o $@ -E -P -
683
694
684
695
ifeq ($(ENABLE_PYOSYS ) ,1)
685
696
$(PY_WRAPPER_FILE ) .cc : misc/$(PY_GEN_SCRIPT ) .py $(PY_WRAP_INCLUDES )
@@ -783,6 +794,7 @@ test: $(TARGETS) $(EXTRA_TARGETS)
783
794
+cd tests/arch/anlogic && bash run-test.sh $(SEEDOPT )
784
795
+cd tests/arch/gowin && bash run-test.sh $(SEEDOPT )
785
796
+cd tests/arch/intel_alm && bash run-test.sh $(SEEDOPT )
797
+ +cd tests/arch/nexus && bash run-test.sh $(SEEDOPT )
786
798
+cd tests/rpc && bash run-test.sh
787
799
+cd tests/memfile && bash run-test.sh
788
800
+cd tests/verilog && bash run-test.sh
@@ -839,9 +851,9 @@ ifeq ($(ENABLE_LIBYOSYS),1)
839
851
$(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR)/
840
852
$(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so
841
853
ifeq ($(ENABLE_PYOSYS ) ,1)
842
- $(INSTALL_SUDO) mkdir -p $(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
843
- $(INSTALL_SUDO) cp libyosys.so $(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so
844
- $(INSTALL_SUDO) cp misc/__init__.py $(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/
854
+ $(INSTALL_SUDO) mkdir -p $(DESTDIR)$( PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
855
+ $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$( PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so
856
+ $(INSTALL_SUDO) cp misc/__init__.py $(DESTDIR)$( PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/
845
857
endif
846
858
endif
847
859
@@ -851,9 +863,9 @@ uninstall:
851
863
ifeq ($(ENABLE_LIBYOSYS ) ,1)
852
864
$(INSTALL_SUDO) rm -vf $(DESTDIR)$(LIBDIR)/libyosys.so
853
865
ifeq ($(ENABLE_PYOSYS ) ,1)
854
- $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so
855
- $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/__init__.py
856
- $(INSTALL_SUDO) rmdir $(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
866
+ $(INSTALL_SUDO) rm -vf $(DESTDIR)$( PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so
867
+ $(INSTALL_SUDO) rm -vf $(DESTDIR)$( PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/__init__.py
868
+ $(INSTALL_SUDO) rmdir $(DESTDIR)$( PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
857
869
endif
858
870
endif
859
871
0 commit comments